o
    i                     @   sd   d dl mZ dee dedeee df fddZdee ded	edeee ee f fd
dZdS )    )	Tokenizerlist_valuereturn.c                 C   s^   | d g}t | dd D ]\}}||kr&|gt| d| d |R   S || q|fS )aJ  Split a list of integers by a given value.

    Args:
        list_: The list to split.
        value: The value to split the list by.

    Returns:
        A tuple of lists of integers.

    Examples:
        >>> _split_integer_list_by_value([1, 2, 3, 4, 5], 3)
        ([1, 2], [3, 4, 5])
        >>> _split_integer_list_by_value([1, 2, 3, 4, 5], 6)
        ([1, 2, 3, 4, 5],)
        >>> _split_integer_list_by_value([1, 2, 3, 4, 5], 1)
        ([1, 2, 3, 4, 5],)
        >>> _split_integer_list_by_value([1, 2, 3, 4, 5, 3, 5, 6, 7], 3)
        ([1, 2], [3, 4, 5], [3, 5, 6, 7])
    r      N)	enumerate_split_integer_list_by_valueappend)r   r   resultiitem r   U/home/ubuntu/.local/lib/python3.10/site-packages/mistral_common/experimental/utils.pyr      s   
"r   	tokenizercontrol_tokenc                 C   s\   | |}t| |^}}t|dkrtd| dt|dkr(td| d||d fS )zSplit a list of integers by a given control token.

    Raises:
        ValueError: If the control token is not found in the list or if it is found more than once.
    r   zControl token z! not found in the list of tokens.r   z, found more than once in the list of tokens.)get_special_tokenr   len
ValueError)r   r   r   control_token_idfirstrestr   r   r   -_split_tokens_by_one_occurrence_control_token    s   
r   N)%mistral_common.tokens.tokenizers.baser   listinttupler   strr   r   r   r   r   <module>   s    &