




"""simple docstring"""


import json
from typing import List, Optional, Tuple

from tokenizers import normalizers

from ...tokenization_utils_fast import PreTrainedTokenizerFast
from .tokenization_lxmert import LxmertTokenizer


_A													=      {"""vocab_file""": """vocab.txt""", """tokenizer_file""": """tokenizer.json"""}

_A													=      {
    """vocab_file""": {
        """unc-nlp/lxmert-base-uncased""": """https://huggingface.co/unc-nlp/lxmert-base-uncased/resolve/main/vocab.txt""",
    },
    """tokenizer_file""": {
        """unc-nlp/lxmert-base-uncased""": (
            """https://huggingface.co/unc-nlp/lxmert-base-uncased/resolve/main/tokenizer.json"""
        ),
    },
}

_A													=      {
    """unc-nlp/lxmert-base-uncased""": 5_1_2,
}

_A													=      {
    """unc-nlp/lxmert-base-uncased""": {"""do_lower_case""": True},
}


class _lowerCamelCase    (					a_						):
   _lowerCamelCase    :Tuple     				=     VOCAB_FILES_NAMES
   _lowerCamelCase    :Optional[Any]     				=     PRETRAINED_VOCAB_FILES_MAP
   _lowerCamelCase    :int     				=     PRETRAINED_INIT_CONFIGURATION
   _lowerCamelCase    :Any     				=     PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
   _lowerCamelCase    :int     				=     LxmertTokenizer






   def __init__(		self       :		Any   ,     UpperCamelCase       :		List[Any]=None   ,     UpperCamelCase       :		Tuple=None   ,     UpperCamelCase       :		str=True   ,     UpperCamelCase       :		Tuple="[UNK]"   ,     UpperCamelCase       :		Dict="[SEP]"   ,     UpperCamelCase       :		List[Any]="[PAD]"   ,     UpperCamelCase       :		str="[CLS]"   ,     UpperCamelCase       :		Union[str, Any]="[MASK]"   ,     UpperCamelCase       :		str=True   ,     UpperCamelCase       :		List[str]=None   ,     **UpperCamelCase       :		Any   ,     )			->						Optional[int]:

         """simple docstring"""
         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__      :			Dict   =	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__      :			Optional[int]   =	getattr(UpperCamelCase   ,     normalizer_state.pop("""type"""   )   )
               lowerCAmelCase__      :			str   =	do_lower_case
               lowerCAmelCase__      :			Tuple   =	strip_accents
               lowerCAmelCase__      :			List[Any]   =	tokenize_chinese_chars
               lowerCAmelCase__      :			int   =	normalizer_class(**UpperCamelCase   )

         lowerCAmelCase__      :			Tuple   =	do_lower_case






   def 	_lowerCAmelCase   (		self       :		List[Any]   ,     UpperCamelCase       :		str   ,     UpperCamelCase       :		Optional[int]=None   )			->						Any:

         """simple docstring"""
         lowerCAmelCase__      :			Optional[Any]   =	[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 	_lowerCAmelCase   (		self       :		Tuple   ,     UpperCamelCase       :		List[int]   ,     UpperCamelCase       :		Optional[List[int]] = None   )			->						List[int]:

         """simple docstring"""
         lowerCAmelCase__      :			Dict   =	[self.sep_token_id]
         lowerCAmelCase__      :			int   =	[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 	_lowerCAmelCase   (		self       :		Tuple   ,     UpperCamelCase       :		str   ,     UpperCamelCase       :		Optional[str] = None   )			->						Tuple[str]:

         """simple docstring"""
         lowerCAmelCase__      :			Optional[Any]   =	self._tokenizer.model.save(UpperCamelCase   ,     name=UpperCamelCase   )
         return tuple(UpperCamelCase   )











"""simple docstring"""


def 	lowercase_				(			__UpperCAmelCase				)						->    str:
      if not all(char in """01""" for char in bin_string				):
            raise ValueError("""Non-binary value was passed to the function"""				)
      if not bin_string:
            raise ValueError("""Empty string was passed to the function"""				)
      lowerCAmelCase__      :			List[str]   =	""""""
      while len(__UpperCAmelCase				) % 3 != 0:
            lowerCAmelCase__      :			Optional[Any]   =	"""0""" + bin_string
      lowerCAmelCase__      :			List[Any]   =	[
          bin_string[index : index + 3]
          for index in range(len(__UpperCAmelCase				)				)
          if index % 3 == 0
      ]
      for bin_group in bin_string_in_3_list:
            lowerCAmelCase__      :			Optional[int]   =	0
            for index, val in enumerate(__UpperCAmelCase				):
                  oct_val += int(2 ** (2 - index) * int(__UpperCAmelCase				)				)
            oct_string += str(__UpperCAmelCase				)
      return oct_string


if __name__ == "__main__":
  from doctest import testmod

  testmod()





