






import json
import os
import unittest

from transformers import MgpstrTokenizer
from transformers.models.mgp_str.tokenization_mgp_str import VOCAB_FILES_NAMES
from transformers.testing_utils import require_tokenizers

from ...test_tokenization_common import TokenizerTesterMixin

@require_tokenizers
class 				lowerCAmelCase_	(		a_   ,		unittest.TestCase			):
				_UpperCamelCase					:       Tuple							       = MgpstrTokenizer
				_UpperCamelCase					:       Optional[Any]							       = False
				_UpperCamelCase					:       int							       = {}
				_UpperCamelCase					:       Dict							       = False


				def 						__a					(					self      ):
											super().setUp()

											# fmt: off
											_lowercase							:   Optional[Any] 							=   ['[GO]', '[s]', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']
											# fmt: on
											_lowercase							:   Any 							=   dict(zip(lowerCAmelCase_ ,						range(len(lowerCAmelCase_      )      )      )      )

											_lowercase							:   List[Any] 							=   os.path.join(self.tmpdirname ,						VOCAB_FILES_NAMES['vocab_file']      )
											with open(self.vocab_file ,						'w' ,						encoding='utf-8'      ) as fp:
																		fp.write(json.dumps(lowerCAmelCase_      ) + '\n'      )


				def 						__a					(					self ,						**_lowerCAmelCase      ):
											return MgpstrTokenizer.from_pretrained(self.tmpdirname ,						**lowerCAmelCase_      )


				def 						__a					(					self ,						_lowerCAmelCase      ):
											_lowercase							:   str 							=   'tester'
											_lowercase							:   Optional[Any] 							=   'tester'
											return input_text, output_text


				@unittest.skip('MGP-STR always lower cases letters.'      )
				def 						__a					(					self      ):
											pass


				def 						__a					(					self      ):
											_lowercase							:   Any 							=   self.get_tokenizers(do_lower_case=lowerCAmelCase_      )
											for tokenizer in tokenizers:
																		with self.subTest(F"""{tokenizer.__class__.__name__}"""      ):
																									_lowercase							:   int 							=   '[SPECIAL_TOKEN]'

																									tokenizer.add_special_tokens({'cls_token': special_token}      )
																									_lowercase							:   Any 							=   tokenizer.encode([special_token] ,						add_special_tokens=lowerCAmelCase_      )
																									self.assertEqual(len(lowerCAmelCase_      ) ,						1      )

																									_lowercase							:   Optional[Any] 							=   tokenizer.decode(lowerCAmelCase_ ,						skip_special_tokens=lowerCAmelCase_      )
																									self.assertTrue(special_token not in decoded      )


				def 						__a					(					self      ):
											_lowercase							:   int 							=   self.get_tokenizers()
											for tokenizer in tokenizers:
																		with self.subTest(F"""{tokenizer.__class__.__name__}"""      ):
																									_lowercase							,							_lowercase							:   Tuple 							=   self.get_input_output_texts(lowerCAmelCase_      )

																									_lowercase							:   int 							=   tokenizer.tokenize(lowerCAmelCase_      )
																									_lowercase							:   str 							=   tokenizer.convert_tokens_to_ids(lowerCAmelCase_      )
																									_lowercase							:   str 							=   tokenizer.encode(lowerCAmelCase_ ,						add_special_tokens=lowerCAmelCase_      )
																									self.assertListEqual(lowerCAmelCase_ ,						lowerCAmelCase_      )

																									_lowercase							:   List[str] 							=   tokenizer.convert_ids_to_tokens(lowerCAmelCase_      )
																									self.assertNotEqual(len(lowerCAmelCase_      ) ,						0      )
																									_lowercase							:   Any 							=   tokenizer.decode(lowerCAmelCase_      )
																									self.assertIsInstance(lowerCAmelCase_ ,						lowerCAmelCase_      )

																									self.assertEqual(text_a.replace(' ' ,						''      ) ,						lowerCAmelCase_      )


				@unittest.skip('MGP-STR tokenizer only handles one sequence.'      )
				def 						__a					(					self      ):
											pass


				@unittest.skip('inputs cannot be pretokenized in MgpstrTokenizer'      )
				def 						__a					(					self      ):
											pass








'''simple docstring'''





def 						UpperCAmelCase__(				_SCREAMING_SNAKE_CASE					: int,_SCREAMING_SNAKE_CASE					: int ):






			"""simple docstring"""




			return int((input_a, input_a).count(1 ) != 0 )






def 						UpperCAmelCase__(				):






			"""simple docstring"""




			assert or_gate(0,0 ) == 0
			assert or_gate(0,1 ) == 1
			assert or_gate(1,0 ) == 1
			assert or_gate(1,1 ) == 1


if __name__ == "__main__":
					print(or_gate(0, 1))
					print(or_gate(1, 0))
					print(or_gate(0, 0))
					print(or_gate(1, 1))



