






'''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     ):
    __lowerCamelCase:				str						    =      EsmTokenizer




    def 			lowerCAmelCase__			(     self					:    int     ):






       '''simple docstring'''






       super().setUp()
       lowercase_		:      Any          =       tempfile.mkdtemp()
       # fmt: off
       lowercase_		:      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
       lowercase_		:      List[str]          =       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 			lowerCAmelCase__			(     self					:    List[str]					,       **a					:    Any     ):






       '''simple docstring'''






       return [self.get_tokenizer(**a     )]




    def 			lowerCAmelCase__			(     self					:    Dict					,       **a					:    Dict     ):






       '''simple docstring'''






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




    def 			lowerCAmelCase__			(     self					:    List[Any]     ):






       '''simple docstring'''






       lowercase_		:      Tuple          =       self.tokenizer_class(self.vocab_file     )

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




    def 			lowerCAmelCase__			(     self					:    Dict     ):






       '''simple docstring'''






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

       lowercase_		:      List[Any]          =       "LAGVS"
       self.assertListEqual(tokenizer.encode(a     )					,       [0, 4, 5, 6, 7, 8, 2]     )




    def 			lowerCAmelCase__			(     self					:    int     ):






       '''simple docstring'''






       lowercase_		:      List[str]          =       self.tokenizer_class(self.vocab_file     )

       lowercase_		:      Tuple          =       ["LAGVS", "WCB"]
       lowercase_		:      Optional[Any]          =       tokenizer(a					,       padding=a     )["input_ids"]

       self.assertListEqual(a					,       [[0, 4, 5, 6, 7, 8, 2], [0, 2_2, 2_3, 2_5, 2]]     )




    def 			lowerCAmelCase__			(     self					:    Optional[int]     ):






       '''simple docstring'''






       lowercase_		:      List[Any]          =       self.tokenizer_class(self.vocab_file     )

       lowercase_		:      Tuple          =       ["LAGVS", "WCB"]
       lowercase_		:      str          =       tokenizer(a					,       padding=a     )["input_ids"]

       self.assertListEqual(a					,       [[0, 4, 5, 6, 7, 8, 2], [0, 2_2, 2_3, 2_5, 2, 1, 1]]     )





    def 			lowerCAmelCase__			(     self					:    Dict     ):






       '''simple docstring'''






       lowercase_		:      Optional[int]          =       self.get_tokenizers(fast=a     )
       for tokenizer in tokenizers:
          with self.subTest(f"""{tokenizer.__class__.__name__}"""     ):
             lowercase_		:      int          =       "<unk>"
             lowercase_		:      int          =       "<mask>"

             lowercase_		:      Optional[int]          =       tokenizer.tokenize(a     )
             lowercase_		:      Dict          =       tokenizer.tokenize(a     )

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












'''simple docstring'''
UpperCamelCase__	=     (1, 153, 370, 371, 1634, 24678051, 115132219018763992565095597973971522401)
UpperCamelCase__	=     (-153, -1, 0, 1.2, 200, "A", [], {}, None)




def 						__SCREAMING_SNAKE_CASE   (					_UpperCamelCase							):


   """simple docstring"""




   if not isinstance(_UpperCamelCase  ,						_UpperCamelCase							) or n < 1:
      return False

   # Initialization of sum and number of digits.
   lowercase_		:      Optional[int]          =       0
   lowercase_		:      Any          =       0
   lowercase_		:      Optional[Any]          =       n
   # Calculation of digits of the number
   while temp > 0:
      number_of_digits += 1
      temp //= 10
   # Dividing number into separate digits and find Armstrong number
   lowercase_		:      int          =       n
   while temp > 0:
      lowercase_		:      Any          =       temp % 10
      total += rem**number_of_digits
      temp //= 10
   return n == total




def 						__SCREAMING_SNAKE_CASE   (					_UpperCamelCase							):


   """simple docstring"""




   if not isinstance(_UpperCamelCase  ,						_UpperCamelCase							) or n < 1:
      return False

   # Init a "histogram" of the digits
   lowercase_		:      Optional[Any]          =       [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
   lowercase_		:      Tuple          =       0
   lowercase_		:      Any          =       0
   lowercase_		:      Tuple          =       n
   while temp > 0:
      lowercase_      ,						lowercase_		:      Optional[Any]          =       divmod(_UpperCamelCase  ,						10							)
      digit_histogram[rem] += 1
      digit_total += 1

   for cnt, i in zip(_UpperCamelCase  ,						range(len(_UpperCamelCase							)							)							):
      total += cnt * i**digit_total

   return n == total




def 						__SCREAMING_SNAKE_CASE   (					_UpperCamelCase							):


   """simple docstring"""




   if not isinstance(_UpperCamelCase  ,						_UpperCamelCase							) or n < 1:
      return False
   lowercase_		:      List[str]          =       len(str(_UpperCamelCase							)							)  # the power that all digits will be raised to
   # check if sum of each digit multiplied expo times is equal to number
   return n == sum(int(_UpperCamelCase							) ** expo for i in str(_UpperCamelCase							)							)




def 						__SCREAMING_SNAKE_CASE   (					):


   """simple docstring"""




   lowercase_		:      Dict          =       int(input("Enter an integer to see if it is an Armstrong number: "							).strip()							)
   print(F"""{num} is {"" if armstrong_number(_UpperCamelCase							) else "not "}an Armstrong number."""							)
   print(F"""{num} is {"" if narcissistic_number(_UpperCamelCase							) else "not "}an Armstrong number."""							)
   print(F"""{num} is {"" if pluperfect_number(_UpperCamelCase							) else "not "}an Armstrong number."""							)


if __name__ == "__main__":
 import doctest

 doctest.testmod()
 main()




