



'''simple docstring'''





import os
import tempfile
import unittest
from typing import List

from transformers.models.esm.tokenization_esm import VOCAB_FILES_NAMES, EsmTokenizer
from transformers.testing_utils import require_tokenizers
from transformers.tokenization_utils import PreTrainedTokenizer
from transformers.tokenization_utils_base import PreTrainedTokenizerBase






@require_tokenizers
class        UpperCAmelCase_       (						unittest.TestCase							):

 '''simple docstring'''
 lowercase_				:						Any				=       EsmTokenizer







 def        UpperCamelCase     (				self		:     Any   ):



   '''simple docstring'''




   super().setUp()
   UpperCAmelCase__			:				Dict												=       tempfile.mkdtemp()
   # fmt: off
   UpperCAmelCase__			:				List[str]												=       ["<cls>", "<pad>", "<eos>", "<unk>", "L", "A", "G", "V", "S", "E", "R", "T", "I", "D", "P", "K", "Q", "N", "F", "Y", "M", "H", "W", "C", "X", "B", "U", "Z", "O", ".", "-", "<null_1>", "<mask>"]  # noqa: E501
   # fmt: on
   UpperCAmelCase__			:				int												=       os.path.join(self.tmpdirname ,							VOCAB_FILES_NAMES["vocab_file"]   )
   with open(self.vocab_file ,							"w" ,							encoding="utf-8"   ) as vocab_writer:
     vocab_writer.write("".join([x + "\n" for x in vocab_tokens]   )   )







 def        UpperCamelCase     (				self		:     Union[str, Any] ,							**snake_case__		:     int   ):



   '''simple docstring'''




   return [self.get_tokenizer(**snake_case__   )]







 def        UpperCamelCase     (				self		:     List[Any] ,							**snake_case__		:     Union[str, Any]   ):



   '''simple docstring'''




   return self.tokenizer_class.from_pretrained(self.tmpdirname ,							**snake_case__   )







 def        UpperCamelCase     (				self		:     Dict   ):



   '''simple docstring'''




   UpperCAmelCase__			:				Optional[int]												=       self.tokenizer_class(self.vocab_file   )

   UpperCAmelCase__			:				Dict												=       tokenizer.tokenize("LAGVS"   )
   self.assertListEqual(snake_case__ ,							["L", "A", "G", "V", "S"]   )
   self.assertListEqual(tokenizer.convert_tokens_to_ids(snake_case__   ) ,							[4, 5, 6, 7, 8]   )







 def        UpperCamelCase     (				self		:     List[str]   ):



   '''simple docstring'''




   UpperCAmelCase__			:				Any												=       self.tokenizer_class(self.vocab_file   )

   UpperCAmelCase__			:				Union[str, Any]												=       "LAGVS"
   self.assertListEqual(tokenizer.encode(snake_case__   ) ,							[0, 4, 5, 6, 7, 8, 2]   )







 def        UpperCamelCase     (				self		:     Tuple   ):



   '''simple docstring'''




   UpperCAmelCase__			:				Optional[int]												=       self.tokenizer_class(self.vocab_file   )

   UpperCAmelCase__			:				Union[str, Any]												=       ["LAGVS", "WCB"]
   UpperCAmelCase__			:				Dict												=       tokenizer(snake_case__ ,							padding=snake_case__   )["input_ids"]

   self.assertListEqual(snake_case__ ,							[[0, 4, 5, 6, 7, 8, 2], [0, 22, 23, 25, 2]]   )







 def        UpperCamelCase     (				self		:     Optional[int]   ):



   '''simple docstring'''




   UpperCAmelCase__			:				Union[str, Any]												=       self.tokenizer_class(self.vocab_file   )

   UpperCAmelCase__			:				int												=       ["LAGVS", "WCB"]
   UpperCAmelCase__			:				Dict												=       tokenizer(snake_case__ ,							padding=snake_case__   )["input_ids"]

   self.assertListEqual(snake_case__ ,							[[0, 4, 5, 6, 7, 8, 2], [0, 22, 23, 25, 2, 1, 1]]   )







 def        UpperCamelCase     (				self		:     Dict   ):



   '''simple docstring'''




   UpperCAmelCase__			:				List[Any]												=       self.get_tokenizers(fast=snake_case__   )
   for tokenizer in tokenizers:
     with self.subTest(F"""{tokenizer.__class__.__name__}"""   ):
       UpperCAmelCase__			:				int												=       "<unk>"
       UpperCAmelCase__			:				int												=       "<mask>"

       UpperCAmelCase__			:				List[Any]												=       tokenizer.tokenize(snake_case__   )
       UpperCAmelCase__			:				Optional[int]												=       tokenizer.tokenize(snake_case__   )

       self.assertEqual(len(snake_case__   ) ,							1   )
       self.assertEqual(len(snake_case__   ) ,							1   )
       self.assertEqual(token_a[0] ,							snake_case__   )
       self.assertEqual(token_a[0] ,							snake_case__   )





'''simple docstring'''





def snake_case_    (				lowercase__      ,					lowercase__ = 1_3		):
  UpperCAmelCase__			:				Optional[Any]												=       ""
  for c in s:
    if "A" <= c <= "Z":
      out += chr(ord("A"		) + (ord(lowercase__		) - ord("A"		) + n) % 2_6		)
    elif "a" <= c <= "z":
      out += chr(ord("a"		) + (ord(lowercase__		) - ord("a"		) + n) % 2_6		)
    else:
      out += c
  return out







def snake_case_    (				):
  UpperCAmelCase__			:				Dict												=       input("Enter message: "		)

  UpperCAmelCase__			:				Optional[int]												=       dencrypt(lowercase__      ,					1_3		)
  print("Encryption:"      ,					lowercase__		)

  UpperCAmelCase__			:				Union[str, Any]												=       dencrypt(lowercase__      ,					1_3		)
  print("Decryption: "      ,					lowercase__		)


if __name__ == "__main__":
      import doctest

      doctest.testmod()
      main()



