






'''simple docstring'''

import json
from typing import List, Optional, Tuple

from tokenizers import normalizers
from tokenizers.pre_tokenizers import BertPreTokenizer, PreTokenizer

from ...tokenization_utils_fast import PreTrainedTokenizerFast
from ...utils import logging
from .tokenization_roformer import RoFormerTokenizer
from .tokenization_utils import JiebaPreTokenizer


SCREAMING_SNAKE_CASE__      =   logging.get_logger(__name__)

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

SCREAMING_SNAKE_CASE__      =   {
    'vocab_file': {
        'junnyu/roformer_chinese_small': 'https://huggingface.co/junnyu/roformer_chinese_small/resolve/main/vocab.txt',
        'junnyu/roformer_chinese_base': 'https://huggingface.co/junnyu/roformer_chinese_base/resolve/main/vocab.txt',
        'junnyu/roformer_chinese_char_small': (
            'https://huggingface.co/junnyu/roformer_chinese_char_small/resolve/main/vocab.txt'
        ),
        'junnyu/roformer_chinese_char_base': (
            'https://huggingface.co/junnyu/roformer_chinese_char_base/resolve/main/vocab.txt'
        ),
        'junnyu/roformer_small_discriminator': (
            'https://huggingface.co/junnyu/roformer_small_discriminator/resolve/main/vocab.txt'
        ),
        'junnyu/roformer_small_generator': (
            'https://huggingface.co/junnyu/roformer_small_generator/resolve/main/vocab.txt'
        ),
    }
}

SCREAMING_SNAKE_CASE__      =   {
    'junnyu/roformer_chinese_small': 1_5_3_6,
    'junnyu/roformer_chinese_base': 1_5_3_6,
    'junnyu/roformer_chinese_char_small': 5_1_2,
    'junnyu/roformer_chinese_char_base': 5_1_2,
    'junnyu/roformer_small_discriminator': 1_2_8,
    'junnyu/roformer_small_generator': 1_2_8,
}


SCREAMING_SNAKE_CASE__      =   {
    'junnyu/roformer_chinese_small': {'do_lower_case': True},
    'junnyu/roformer_chinese_base': {'do_lower_case': True},
    'junnyu/roformer_chinese_char_small': {'do_lower_case': True},
    'junnyu/roformer_chinese_char_base': {'do_lower_case': True},
    'junnyu/roformer_small_discriminator': {'do_lower_case': True},
    'junnyu/roformer_small_generator': {'do_lower_case': True},
}






class 				a_						(			lowerCamelCase				):
  lowercase     		=      VOCAB_FILES_NAMES
  lowercase     		=      PRETRAINED_VOCAB_FILES_MAP
  lowercase     		=      PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
  lowercase     		=      PRETRAINED_INIT_CONFIGURATION
  lowercase     		=      RoFormerTokenizer

  def __init__(      self			,		_SCREAMING_SNAKE_CASE=None			,		_SCREAMING_SNAKE_CASE=None			,		_SCREAMING_SNAKE_CASE=True			,		_SCREAMING_SNAKE_CASE="[UNK]"			,		_SCREAMING_SNAKE_CASE="[SEP]"			,		_SCREAMING_SNAKE_CASE="[PAD]"			,		_SCREAMING_SNAKE_CASE="[CLS]"			,		_SCREAMING_SNAKE_CASE="[MASK]"			,		_SCREAMING_SNAKE_CASE=True			,		_SCREAMING_SNAKE_CASE=None			,		**_SCREAMING_SNAKE_CASE			,		)  ->      Any:



        """simple docstring"""






        super().__init__(
            A__			,		tokenizer_file=A__			,		do_lower_case=A__			,		unk_token=A__			,		sep_token=A__			,		pad_token=A__			,		cls_token=A__			,		mask_token=A__			,		tokenize_chinese_chars=A__			,		strip_accents=A__			,		**A__			,		)

        UpperCamelCase				  =					json.loads(self.backend_tokenizer.normalizer.__getstate__()      )
        if (
            pre_tok_state.get("""lowercase"""			,		A__      ) != do_lower_case
            or pre_tok_state.get("""strip_accents"""			,		A__      ) != strip_accents
        ):
              UpperCamelCase				  =					getattr(A__			,		pre_tok_state.pop("""type"""      )      )
              UpperCamelCase				  =					do_lower_case
              UpperCamelCase				  =					strip_accents
              UpperCamelCase				  =					pre_tok_class(**A__      )

        UpperCamelCase				  =					do_lower_case

  def __getstate__(      self      )  ->      List[str]:



        """simple docstring"""






        UpperCamelCase				  =					self.__dict__.copy()
        UpperCamelCase				  =					BertPreTokenizer()
        return state

  def __setstate__(      self			,		_SCREAMING_SNAKE_CASE      )  ->      Tuple:



        """simple docstring"""






        UpperCamelCase				  =					d
        UpperCamelCase				  =					self.__dict__["""_tokenizer"""].get_vocab()
        UpperCamelCase				  =					PreTokenizer.custom(JiebaPreTokenizer(A__      )      )

  def   A__						(      self			,		_SCREAMING_SNAKE_CASE			,		_SCREAMING_SNAKE_CASE=None      )  ->      Any:



        """simple docstring"""






        UpperCamelCase				  =					[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   A__						(      self			,		_SCREAMING_SNAKE_CASE			,		_SCREAMING_SNAKE_CASE = None      )  ->      Optional[int]:



        """simple docstring"""






        UpperCamelCase				  =					[self.sep_token_id]
        UpperCamelCase				  =					[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   A__						(      self			,		_SCREAMING_SNAKE_CASE			,		_SCREAMING_SNAKE_CASE = None      )  ->      Dict:



        """simple docstring"""






        UpperCamelCase				  =					self._tokenizer.model.save(A__			,		name=A__      )
        return tuple(A__      )


  def   A__						(      self			,		_SCREAMING_SNAKE_CASE			,		_SCREAMING_SNAKE_CASE=None			,		_SCREAMING_SNAKE_CASE=None			,		_SCREAMING_SNAKE_CASE=False			,		**_SCREAMING_SNAKE_CASE			,		)  ->      int:



        """simple docstring"""






        UpperCamelCase				  =					BertPreTokenizer()
        return super().save_pretrained(A__			,		A__			,		A__			,		A__			,		**A__      )



import string

def 						UpperCamelCase					(lowercase_: str					)     ->      None:
	for key in range(len(string.ascii_uppercase					)					):
		A__							:    Dict        =		""""""
		for symbol in message:
			if symbol in string.ascii_uppercase:
				A__							:    Dict        =		string.ascii_uppercase.find(lowercase_					)
				A__							:    Optional[int]        =		num - key
				if num < 0:
					A__							:    Optional[int]        =		num + len(string.ascii_uppercase					)
				A__							:    Any        =		translated + string.ascii_uppercase[num]
			else:
				A__							:    Optional[Any]        =		translated + symbol
		print(f"""Decryption using Key #{key}: {translated}"""					)

def 						UpperCamelCase					()     ->      None:
	A__							:    Optional[Any]        =		input("""Encrypted message: """					)
	A__							:    Optional[Any]        =		message.upper()
	decrypt(lowercase_					)


if __name__ == "__main__":
	import doctest

	doctest.testmod()
	main()



