

"""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


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

UpperCAmelCase													={
    "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"
        ),
    },
}

UpperCAmelCase													={
    "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,
}

UpperCAmelCase													={
    "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'''




    _lowerCamelCase					=   VOCAB_FILES_NAMES
    _lowerCamelCase					=   PRETRAINED_VOCAB_FILES_MAP
    _lowerCamelCase					=   PRETRAINED_INIT_CONFIGURATION
    _lowerCamelCase					=   PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
    _lowerCamelCase					=   ElectraTokenizer




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

          A				  =		json.loads(self.backend_tokenizer.normalizer.__getstate__()    )
          if (
              normalizer_state.get("""lowercase""" ,lowerCamelCase_    ) != do_lower_case
              or normalizer_state.get("""strip_accents""" ,lowerCamelCase_    ) != strip_accents
              or normalizer_state.get("""handle_chinese_chars""" ,lowerCamelCase_    ) != tokenize_chinese_chars
          ):
                A				  =		getattr(lowerCamelCase_ ,normalizer_state.pop("""type"""    )    )
                A				  =		do_lower_case
                A				  =		strip_accents
                A				  =		tokenize_chinese_chars
                A				  =		normalizer_class(**lowerCamelCase_    )

          A				  =		do_lower_case




    def UpperCamelCase__		( self ,lowerCamelCase_ ,lowerCamelCase_=None    )    ->      List[str]:
          A				  =		[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 ,lowerCamelCase_ ,lowerCamelCase_ = None    )    ->      List[int]:
          A				  =		[self.sep_token_id]
          A				  =		[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 ,lowerCamelCase_ ,lowerCamelCase_ = None    )    ->      Tuple[str]:
          A				  =		self._tokenizer.model.save(lowerCamelCase_ ,name=lowerCamelCase_    )
          return tuple(lowerCamelCase_    )







"""simple docstring"""


import random





class lowerCamelCase__   :



    '''simple docstring'''




    @staticmethod
    def UpperCamelCase__		( lowerCamelCase_    )    ->      tuple[list[int], list[int]]:
          A				  =		[ord(lowerCamelCase_    ) for i in text]
          A				  =		[]
          A				  =		[]
          for i in plain:
                A				  =		random.randint(1 ,3_0_0    )
                A				  =		(i + k) * k
                cipher.append(lowerCamelCase_    )
                key.append(lowerCamelCase_    )
          return cipher, key




    @staticmethod
    def UpperCamelCase__		( lowerCamelCase_ ,lowerCamelCase_    )    ->      str:
          A				  =		[]
          for i in range(len(lowerCamelCase_    )    ):
                A				  =		int((cipher[i] - (key[i]) ** 2) / key[i]    )
                plain.append(chr(lowerCamelCase_    )    )
          return "".join(lowerCamelCase_    )


if __name__ == "__main__":
  UpperCAmelCase							,			UpperCAmelCase													=Onepad().encrypt("Hello")
  print(c, k)
  print(Onepad().decrypt(c, k))




