



'''simple docstring'''





import json
from typing import List, Optional, Tuple

from tokenizers import normalizers

from ...tokenization_utils_fast import PreTrainedTokenizerFast
from .tokenization_electra import ElectraTokenizer


_lowerCAmelCase										=     {'''vocab_file''': '''vocab.txt''', '''tokenizer_file''': '''tokenizer.json'''}

_lowerCAmelCase										=     {
    '''vocab_file''': {
        '''google/electra-small-generator''': (
            '''https://huggingface.co/google/electra-small-generator/resolve/main/vocab.txt'''
        ),
        '''google/electra-base-generator''': '''https://huggingface.co/google/electra-base-generator/resolve/main/vocab.txt''',
        '''google/electra-large-generator''': (
            '''https://huggingface.co/google/electra-large-generator/resolve/main/vocab.txt'''
        ),
        '''google/electra-small-discriminator''': (
            '''https://huggingface.co/google/electra-small-discriminator/resolve/main/vocab.txt'''
        ),
        '''google/electra-base-discriminator''': (
            '''https://huggingface.co/google/electra-base-discriminator/resolve/main/vocab.txt'''
        ),
        '''google/electra-large-discriminator''': (
            '''https://huggingface.co/google/electra-large-discriminator/resolve/main/vocab.txt'''
        ),
    },
    '''tokenizer_file''': {
        '''google/electra-small-generator''': (
            '''https://huggingface.co/google/electra-small-generator/resolve/main/tokenizer.json'''
        ),
        '''google/electra-base-generator''': (
            '''https://huggingface.co/google/electra-base-generator/resolve/main/tokenizer.json'''
        ),
        '''google/electra-large-generator''': (
            '''https://huggingface.co/google/electra-large-generator/resolve/main/tokenizer.json'''
        ),
        '''google/electra-small-discriminator''': (
            '''https://huggingface.co/google/electra-small-discriminator/resolve/main/tokenizer.json'''
        ),
        '''google/electra-base-discriminator''': (
            '''https://huggingface.co/google/electra-base-discriminator/resolve/main/tokenizer.json'''
        ),
        '''google/electra-large-discriminator''': (
            '''https://huggingface.co/google/electra-large-discriminator/resolve/main/tokenizer.json'''
        ),
    },
}

_lowerCAmelCase										=     {
    '''google/electra-small-generator''': 512,
    '''google/electra-base-generator''': 512,
    '''google/electra-large-generator''': 512,
    '''google/electra-small-discriminator''': 512,
    '''google/electra-base-discriminator''': 512,
    '''google/electra-large-discriminator''': 512,
}

_lowerCAmelCase										=     {
    '''google/electra-small-generator''': {'''do_lower_case''': True},
    '''google/electra-base-generator''': {'''do_lower_case''': True},
    '''google/electra-large-generator''': {'''do_lower_case''': True},
    '''google/electra-small-discriminator''': {'''do_lower_case''': True},
    '''google/electra-base-discriminator''': {'''do_lower_case''': True},
    '''google/electra-large-discriminator''': {'''do_lower_case''': True},
}






class 	lowerCAmelCase_(    SCREAMING_SNAKE_CASE_					):
  '''simple docstring'''




  __lowercase							:				str           =				VOCAB_FILES_NAMES
  __lowercase							:				str           =				PRETRAINED_VOCAB_FILES_MAP
  __lowercase							:				Dict           =				PRETRAINED_INIT_CONFIGURATION
  __lowercase							:				int           =				PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
  __lowercase							:				Dict           =				ElectraTokenizer




  def __init__(   self  ,__UpperCAmelCase=None  ,__UpperCAmelCase=None  ,__UpperCAmelCase=True  ,__UpperCAmelCase="[UNK]"  ,__UpperCAmelCase="[SEP]"  ,__UpperCAmelCase="[PAD]"  ,__UpperCAmelCase="[CLS]"  ,__UpperCAmelCase="[MASK]"  ,__UpperCAmelCase=True  ,__UpperCAmelCase=None  ,**__UpperCAmelCase  ,)   ->		Optional[int]:
      super().__init__(
          __UpperCAmelCase  ,tokenizer_file=__UpperCAmelCase  ,do_lower_case=__UpperCAmelCase  ,unk_token=__UpperCAmelCase  ,sep_token=__UpperCAmelCase  ,pad_token=__UpperCAmelCase  ,cls_token=__UpperCAmelCase  ,mask_token=__UpperCAmelCase  ,tokenize_chinese_chars=__UpperCAmelCase  ,strip_accents=__UpperCAmelCase  ,**__UpperCAmelCase  ,)

      lowerCAmelCase__			:  str											= json.loads(self.backend_tokenizer.normalizer.__getstate__()				)
      if (
          normalizer_state.get("""lowercase"""  ,__UpperCAmelCase				) != do_lower_case
          or normalizer_state.get("""strip_accents"""  ,__UpperCAmelCase				) != strip_accents
          or normalizer_state.get("""handle_chinese_chars"""  ,__UpperCAmelCase				) != tokenize_chinese_chars
      ):
          lowerCAmelCase__			:  List[str]											= getattr(__UpperCAmelCase  ,normalizer_state.pop("""type"""				)				)
          lowerCAmelCase__			:  List[Any]											= do_lower_case
          lowerCAmelCase__			:  Optional[int]											= strip_accents
          lowerCAmelCase__			:  Dict											= tokenize_chinese_chars
          lowerCAmelCase__			:  int											= normalizer_class(**__UpperCAmelCase				)

      lowerCAmelCase__			:  Tuple											= do_lower_case




  def 							UpperCAmelCase_     (   self  ,__UpperCAmelCase  ,__UpperCAmelCase=None				)   ->		Tuple:
      lowerCAmelCase__			:  Tuple											= [self.cls_token_id] + token_ids_a + [self.sep_token_id]

      if token_ids_a:
          output += token_ids_a + [self.sep_token_id]

      return output




  def 							UpperCAmelCase_     (   self  ,__UpperCAmelCase  ,__UpperCAmelCase = None				)   ->		List[int]:
      lowerCAmelCase__			:  Any											= [self.sep_token_id]
      lowerCAmelCase__			:  Optional[Any]											= [self.cls_token_id]
      if token_ids_a is None:
          return len(cls + token_ids_a + sep				) * [0]
      return len(cls + token_ids_a + sep				) * [0] + len(token_ids_a + sep				) * [1]






  def 							UpperCAmelCase_     (   self  ,__UpperCAmelCase  ,__UpperCAmelCase = None				)   ->		Tuple[str]:
      lowerCAmelCase__			:  List[str]											= self._tokenizer.model.save(__UpperCAmelCase  ,name=__UpperCAmelCase				)
      return tuple(__UpperCAmelCase				)







'''simple docstring'''





def        _SCREAMING_SNAKE_CASE  (	UpperCamelCase      ):



    """simple docstring"""





    if any(not isinstance(UpperCamelCase							,   UpperCamelCase      ) or x < 0 for x in sequence      ):
        raise TypeError("""Sequence must be list of non-negative integers"""      )
    for _ in range(len(UpperCamelCase      )      ):
        for i, (rod_upper, rod_lower) in enumerate(zip(UpperCamelCase							,   sequence[1:]      )      ):
            if rod_upper > rod_lower:
                sequence[i] -= rod_upper - rod_lower
                sequence[i + 1] += rod_upper - rod_lower
    return sequence


if __name__ == "__main__":
 assert bead_sort([5, 4, 3, 2, 1]) == [1, 2, 3, 4, 5]
 assert bead_sort([7, 9, 4, 3, 5]) == [3, 4, 5, 7, 9]


