o
    #1 i                     @   st   d dl mZmZ 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 )    )ListTuple)	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   m/home/app/PaddleOCR-VL-test/.venv_paddleocr/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.)Zget_control_tokenr
   len
ValueError)r   r   r   Zcontrol_token_idfirstrestr   r   r   ,_split_tokens_by_one_occurence_control_token"   s   
r   N)	typingr   r   Z%mistral_common.tokens.tokenizers.baser   intr
   strr   r   r   r   r   <module>   s    &