<commit_before>use std::iter::Iterator;

use self::SequenceItem::{Number, Range, Wildcard};

/// This represents an individual item in the list of requested message ids
/// passed by the client
/// The client can pass a number representing a single id, a wildcard
/// (represented by *) or a range which is made up of a start non-range sequence
/// item and an end non-range sequence item separated by a colon
/// A range represents all items with ids between its start and end, inclusive.
#[derive(Clone, PartialEq, Debug)]
pub enum SequenceItem {
    Number(usize),
    Range(Box<SequenceItem>, Box<SequenceItem>),
    Wildcard
}

fn parse_item(item: &str) -> Option<SequenceItem> {
    let intseq_opt: Option<usize> = item.parse();
    match intseq_opt {
        Ok(intseq) => {
            // item is a valid number so return that
            Some(Number(intseq))
        }
        Err(_) => {
            // item is not a valid number
            // If it is the wildcard value return that
            // Otherwise, return no sequence item
            if item == "*" {
                Some(Wildcard)
            } else {
                None
            }
        }
    }
}

/// Given a string as passed in from the client, create a list of sequence items
/// If the string does not represent a valid list, return None
pub fn parse(sequence_string: &str) -> Option<Vec<SequenceItem>> {
    let mut sequences = sequence_string.split(',');
    let mut sequence_set = Vec::new();
    for sequence in sequences {
        let mut range = sequence.split(':');
        let start = match range.next() {
            None => return None,<commit_msg>Remove unnecessary type annotation<commit_after>use std::iter::Iterator;

use self::SequenceItem::{Number, Range, Wildcard};

/// This represents an individual item in the list of requested message ids
/// passed by the client
/// The client can pass a number representing a single id, a wildcard
/// (represented by *) or a range which is made up of a start non-range sequence
/// item and an end non-range sequence item separated by a colon
/// A range represents all items with ids between its start and end, inclusive.
#[derive(Clone, PartialEq, Debug)]
pub enum SequenceItem {
    Number(usize),
    Range(Box<SequenceItem>, Box<SequenceItem>),
    Wildcard
}

fn parse_item(item: &str) -> Option<SequenceItem> {
    let intseq_opt = item.parse();
    match intseq_opt {
        Ok(intseq) => {
            // item is a valid number so return that
            Some(Number(intseq))
        }
        Err(_) => {
            // item is not a valid number
            // If it is the wildcard value return that
            // Otherwise, return no sequence item
            if item == "*" {
                Some(Wildcard)
            } else {
                None
            }
        }
    }
}

/// Given a string as passed in from the client, create a list of sequence items
/// If the string does not represent a valid list, return None
pub fn parse(sequence_string: &str) -> Option<Vec<SequenceItem>> {
    let mut sequences = sequence_string.split(',');
    let mut sequence_set = Vec::new();
    for sequence in sequences {
        let mut range = sequence.split(':');
        let start = match range.next() {
            None => return None,
{'fraction_non_alphanumeric': 0.10170006071645415, 'fraction_numerical': 0.0, 'mean_word_length': 2.3451776649746194, 'pattern_counts': {'":': 0, '<': 14, '<?xml version=': 0, '>': 24, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7192219', 'n_tokens_mistral': 869, 'n_tokens_neox': 863, 'n_words': 363}