

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    A__(unittest.TestCase    ):
						"""simple docstring"""






						_A  :							str   			=	EsmTokenizer





						def 	UpperCamelCase__			(  self  )      ->				Tuple:
									super().setUp()
									a_		:		Any				    =				tempfile.mkdtemp()
									# fmt: off
									a_		:		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
									a_		:		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 	UpperCamelCase__			(  self       ,     **_lowercase  )      ->				Union[str, Any]:
									return [self.get_tokenizer(**_lowercase  )]





						def 	UpperCamelCase__			(  self       ,     **_lowercase  )      ->				Tuple:
									return self.tokenizer_class.from_pretrained(self.tmpdirname       ,     **_lowercase  )





						def 	UpperCamelCase__			(  self  )      ->				List[Any]:
									a_		:		Tuple				    =				self.tokenizer_class(self.vocab_file  )

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





						def 	UpperCamelCase__			(  self  )      ->				Union[str, Any]:
									a_		:		Union[str, Any]				    =				self.tokenizer_class(self.vocab_file  )

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





						def 	UpperCamelCase__			(  self  )      ->				List[Any]:
									a_		:		List[str]				    =				self.tokenizer_class(self.vocab_file  )

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

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





						def 	UpperCamelCase__			(  self  )      ->				Tuple:
									a_		:		List[Any]				    =				self.tokenizer_class(self.vocab_file  )

									a_		:		Tuple				    =				["LAGVS", "WCB"]
									a_		:		str				    =				tokenizer(_lowercase       ,     padding=_lowercase  )["input_ids"]

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





						def 	UpperCamelCase__			(  self  )      ->				List[Any]:
									a_		:		Optional[int]				    =				self.get_tokenizers(fast=_lowercase  )
									for tokenizer in tokenizers:
												with self.subTest(F'''{tokenizer.__class__.__name__}'''  ):
															a_		:		int				    =				"<unk>"
															a_		:		int				    =				"<mask>"

															a_		:		Optional[int]				    =				tokenizer.tokenize(_lowercase  )
															a_		:		Dict				    =				tokenizer.tokenize(_lowercase  )

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









def 			_UpperCAmelCase							(		a__):

			'''simple docstring'''



			return 1 if input_a == 0 else 0


def 			_UpperCAmelCase							(		):

			'''simple docstring'''



			assert not_gate(0) == 1
			assert not_gate(1) == 0


if __name__ == "__main__":
	print(not_gate(0))
	print(not_gate(1))


