




import unittest

from transformers import DebertaVaTokenizer, DebertaVaTokenizerFast
from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, slow

from ...test_tokenization_common import TokenizerTesterMixin


a__		     =     get_tests_dir('''fixtures/spiece.model''')


@require_sentencepiece
@require_tokenizers
class    SCREAMING_SNAKE_CASE_				(       _UpperCamelCase	,  unittest.TestCase   ):



	"""simple docstring"""


	__magic_name__   :       Optional[int]      	=		DebertaVaTokenizer
	__magic_name__   :       str      	=		DebertaVaTokenizerFast
	__magic_name__   :       Tuple      	=		True
	__magic_name__   :       Dict      	=		True






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







						"""simple docstring"""







						super().setUp()

						# We have a SentencePiece fixture for testing
						__UpperCamelCase					:	List[Any]             =      DebertaVaTokenizer(lowerCAmelCase					,     unk_token="""<unk>"""	)
						tokenizer.save_pretrained(self.tmpdirname	)






	def 					lowerCamelCase__     (					self		:						Optional[Any]					,     lowerCAmelCase		:						List[str]	)	->       Union[str, Any]:







						"""simple docstring"""







						__UpperCamelCase					:	Tuple             =      """this is a test"""
						__UpperCamelCase					:	str             =      """this is a test"""
						return input_text, output_text






	def 					lowerCamelCase__     (					self		:						str	)	->       Tuple:







						"""simple docstring"""







						__UpperCamelCase					:	int             =      """<pad>"""
						__UpperCamelCase					:	str             =      0

						self.assertEqual(self.get_tokenizer()._convert_token_to_id(lowerCAmelCase	)					,     lowerCAmelCase	)
						self.assertEqual(self.get_tokenizer()._convert_id_to_token(lowerCAmelCase	)					,     lowerCAmelCase	)






	def 					lowerCamelCase__     (					self		:						int	)	->       Dict:







						"""simple docstring"""







						__UpperCamelCase					:	int             =      list(self.get_tokenizer().get_vocab().keys()	)
						self.assertEqual(vocab_keys[0]					,     """<pad>"""	)
						self.assertEqual(vocab_keys[1]					,     """<unk>"""	)
						self.assertEqual(vocab_keys[-1]					,     """[PAD]"""	)
						self.assertEqual(len(lowerCAmelCase	)					,     30001	)






	def 					lowerCamelCase__     (					self		:						str	)	->       Any:







						"""simple docstring"""







						self.assertEqual(self.get_tokenizer().vocab_size					,     30000	)






	def 					lowerCamelCase__     (					self		:						Any	)	->       Any:







						"""simple docstring"""







						__UpperCamelCase					:	Tuple             =      """ \tHeLLo!how  \n Are yoU?  """
						__UpperCamelCase					:	Union[str, Any]             =      ["""▁hello""", """!""", """how""", """▁are""", """▁you""", """?"""]
						# fmt: on

						__UpperCamelCase					:	Optional[int]             =      DebertaVaTokenizer(lowerCAmelCase					,     do_lower_case=lowerCAmelCase	)
						__UpperCamelCase					:	Optional[Any]             =      tokenizer.convert_ids_to_tokens(tokenizer.encode(lowerCAmelCase					,     add_special_tokens=lowerCAmelCase	)	)

						self.assertListEqual(lowerCAmelCase					,     lowerCAmelCase	)

						__UpperCamelCase					:	Dict             =      DebertaVaTokenizerFast(lowerCAmelCase					,     do_lower_case=lowerCAmelCase	)
						__UpperCamelCase					:	Optional[int]             =      rust_tokenizer.convert_ids_to_tokens(rust_tokenizer.encode(lowerCAmelCase					,     add_special_tokens=lowerCAmelCase	)	)

						self.assertListEqual(lowerCAmelCase					,     lowerCAmelCase	)






	@unittest.skip("""There is an inconsistency between slow and fast tokenizer due to a bug in the fast one."""	)
	def 					lowerCamelCase__     (					self		:						Any	)	->       List[Any]:







						"""simple docstring"""







						pass






	@unittest.skip("""There is an inconsistency between slow and fast tokenizer due to a bug in the fast one."""	)
	def 					lowerCamelCase__     (					self		:						Any	)	->       List[Any]:







						"""simple docstring"""







						pass






	def 					lowerCamelCase__     (					self		:						Optional[Any]	)	->       Optional[Any]:







						"""simple docstring"""







						__UpperCamelCase					:	List[str]             =      """I was born in 92000, and this is falsé."""
						__UpperCamelCase					:	Any             =      ["""▁""", """<unk>""", """▁was""", """▁born""", """▁in""", """▁9""", """2000""", """▁""", """,""", """▁and""", """▁this""", """▁is""", """▁fal""", """s""", """<unk>""", """▁""", """.""", ]
						# fmt: on

						__UpperCamelCase					:	List[Any]             =      DebertaVaTokenizer(lowerCAmelCase					,     split_by_punct=lowerCAmelCase	)
						__UpperCamelCase					:	int             =      tokenizer.convert_ids_to_tokens(tokenizer.encode(lowerCAmelCase					,     add_special_tokens=lowerCAmelCase	)	)

						self.assertListEqual(lowerCAmelCase					,     lowerCAmelCase	)

						__UpperCamelCase					:	List[Any]             =      DebertaVaTokenizerFast(lowerCAmelCase					,     split_by_punct=lowerCAmelCase	)
						__UpperCamelCase					:	Any             =      rust_tokenizer.convert_ids_to_tokens(rust_tokenizer.encode(lowerCAmelCase					,     add_special_tokens=lowerCAmelCase	)	)

						self.assertListEqual(lowerCAmelCase					,     lowerCAmelCase	)






	def 					lowerCamelCase__     (					self		:						List[str]	)	->       List[Any]:







						"""simple docstring"""







						__UpperCamelCase					:	List[Any]             =      """I was born in 92000, and this is falsé."""
						__UpperCamelCase					:	Optional[Any]             =      ["""▁i""", """▁was""", """▁born""", """▁in""", """▁9""", """2000""", """▁""", """,""", """▁and""", """▁this""", """▁is""", """▁fal""", """s""", """<unk>""", """▁""", """.""", ]
						# fmt: on

						__UpperCamelCase					:	int             =      DebertaVaTokenizer(lowerCAmelCase					,     do_lower_case=lowerCAmelCase					,     split_by_punct=lowerCAmelCase	)
						__UpperCamelCase					:	str             =      tokenizer.convert_ids_to_tokens(tokenizer.encode(lowerCAmelCase					,     add_special_tokens=lowerCAmelCase	)	)
						self.assertListEqual(lowerCAmelCase					,     lowerCAmelCase	)

						__UpperCamelCase					:	Optional[int]             =      DebertaVaTokenizerFast(lowerCAmelCase					,     do_lower_case=lowerCAmelCase					,     split_by_punct=lowerCAmelCase	)
						__UpperCamelCase					:	Optional[int]             =      rust_tokenizer.convert_ids_to_tokens(rust_tokenizer.encode(lowerCAmelCase					,     add_special_tokens=lowerCAmelCase	)	)
						self.assertListEqual(lowerCAmelCase					,     lowerCAmelCase	)






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







						"""simple docstring"""







						__UpperCamelCase					:	int             =      """I was born in 92000, and this is falsé."""
						__UpperCamelCase					:	List[Any]             =      ["""▁i""", """▁was""", """▁born""", """▁in""", """▁9""", """2000""", """,""", """▁and""", """▁this""", """▁is""", """▁fal""", """s""", """<unk>""", """.""", ]
						# fmt: on

						__UpperCamelCase					:	Any             =      DebertaVaTokenizer(lowerCAmelCase					,     do_lower_case=lowerCAmelCase					,     split_by_punct=lowerCAmelCase	)
						__UpperCamelCase					:	Optional[Any]             =      tokenizer.convert_ids_to_tokens(tokenizer.encode(lowerCAmelCase					,     add_special_tokens=lowerCAmelCase	)	)

						self.assertListEqual(lowerCAmelCase					,     lowerCAmelCase	)

						__UpperCamelCase					:	Dict             =      DebertaVaTokenizerFast(lowerCAmelCase					,     do_lower_case=lowerCAmelCase					,     split_by_punct=lowerCAmelCase	)
						__UpperCamelCase					:	Optional[Any]             =      rust_tokenizer.convert_ids_to_tokens(rust_tokenizer.encode(lowerCAmelCase					,     add_special_tokens=lowerCAmelCase	)	)

						self.assertListEqual(lowerCAmelCase					,     lowerCAmelCase	)






	def 					lowerCamelCase__     (					self		:						List[str]	)	->       Dict:







						"""simple docstring"""







						__UpperCamelCase					:	Dict             =      """I was born in 92000, and this is falsé."""
						__UpperCamelCase					:	Dict             =      ["""▁""", """<unk>""", """▁was""", """▁born""", """▁in""", """▁9""", """2000""", """▁""", """,""", """▁and""", """▁this""", """▁is""", """▁fal""", """s""", """<unk>""", """▁""", """.""", ]
						# fmt: on

						__UpperCamelCase					:	List[Any]             =      DebertaVaTokenizer(lowerCAmelCase					,     do_lower_case=lowerCAmelCase					,     split_by_punct=lowerCAmelCase	)
						__UpperCamelCase					:	List[str]             =      tokenizer.convert_ids_to_tokens(tokenizer.encode(lowerCAmelCase					,     add_special_tokens=lowerCAmelCase	)	)

						self.assertListEqual(lowerCAmelCase					,     lowerCAmelCase	)

						__UpperCamelCase					:	Union[str, Any]             =      DebertaVaTokenizerFast(lowerCAmelCase					,     do_lower_case=lowerCAmelCase					,     split_by_punct=lowerCAmelCase	)
						__UpperCamelCase					:	int             =      rust_tokenizer.convert_ids_to_tokens(rust_tokenizer.encode(lowerCAmelCase					,     add_special_tokens=lowerCAmelCase	)	)

						self.assertListEqual(lowerCAmelCase					,     lowerCAmelCase	)






	def 					lowerCamelCase__     (					self		:						Optional[int]	)	->       int:







						"""simple docstring"""







						__UpperCamelCase					:	List[str]             =      """ \tHeLLo!how  \n Are yoU?  """
						__UpperCamelCase					:	List[str]             =      ["""▁""", """<unk>""", """e""", """<unk>""", """o""", """!""", """how""", """▁""", """<unk>""", """re""", """▁yo""", """<unk>""", """?"""]
						# fmt: on

						__UpperCamelCase					:	List[str]             =      DebertaVaTokenizer(lowerCAmelCase					,     do_lower_case=lowerCAmelCase					,     split_by_punct=lowerCAmelCase	)
						__UpperCamelCase					:	Any             =      tokenizer.convert_ids_to_tokens(tokenizer.encode(lowerCAmelCase					,     add_special_tokens=lowerCAmelCase	)	)

						self.assertListEqual(lowerCAmelCase					,     lowerCAmelCase	)

						__UpperCamelCase					:	Dict             =      DebertaVaTokenizerFast(lowerCAmelCase					,     do_lower_case=lowerCAmelCase					,     split_by_punct=lowerCAmelCase	)
						__UpperCamelCase					:	Tuple             =      rust_tokenizer.convert_ids_to_tokens(rust_tokenizer.encode(lowerCAmelCase					,     add_special_tokens=lowerCAmelCase	)	)

						self.assertListEqual(lowerCAmelCase					,     lowerCAmelCase	)






	def 					lowerCamelCase__     (					self		:						str	)	->       Dict:







						"""simple docstring"""







						__UpperCamelCase					:	Optional[int]             =      self.get_tokenizer()
						__UpperCamelCase					:	str             =      self.get_rust_tokenizer()

						__UpperCamelCase					:	Optional[int]             =      """I was born in 92000, and this is falsé."""

						__UpperCamelCase					:	Optional[Any]             =      tokenizer.convert_ids_to_tokens(tokenizer.encode(lowerCAmelCase					,     add_special_tokens=lowerCAmelCase	)	)
						__UpperCamelCase					:	str             =      rust_tokenizer.convert_ids_to_tokens(rust_tokenizer.encode(lowerCAmelCase					,     add_special_tokens=lowerCAmelCase	)	)
						self.assertListEqual(lowerCAmelCase					,     lowerCAmelCase	)

						__UpperCamelCase					:	Tuple             =      tokenizer.encode(lowerCAmelCase					,     add_special_tokens=lowerCAmelCase	)
						__UpperCamelCase					:	str             =      rust_tokenizer.encode(lowerCAmelCase					,     add_special_tokens=lowerCAmelCase	)
						self.assertListEqual(lowerCAmelCase					,     lowerCAmelCase	)

						__UpperCamelCase					:	Optional[Any]             =      self.get_rust_tokenizer()
						__UpperCamelCase					:	int             =      tokenizer.encode(lowerCAmelCase	)
						__UpperCamelCase					:	List[Any]             =      rust_tokenizer.encode(lowerCAmelCase	)
						self.assertListEqual(lowerCAmelCase					,     lowerCAmelCase	)






	def 					lowerCamelCase__     (					self		:						int	)	->       Any:







						"""simple docstring"""







						__UpperCamelCase					:	List[str]             =      """This is a test"""
						__UpperCamelCase					:	Optional[Any]             =      [13, 1, 4398, 25, 21, 1289]
						__UpperCamelCase					:	Optional[Any]             =      ["""▁""", """T""", """his""", """▁is""", """▁a""", """▁test"""]
						__UpperCamelCase					:	Optional[Any]             =      ["""▁""", """<unk>""", """his""", """▁is""", """▁a""", """▁test"""]

						__UpperCamelCase					:	Optional[int]             =      DebertaVaTokenizer(lowerCAmelCase					,     keep_accents=lowerCAmelCase	)
						__UpperCamelCase					:	Tuple             =      DebertaVaTokenizerFast(lowerCAmelCase					,     keep_accents=lowerCAmelCase	)

						__UpperCamelCase					:	str             =      tokenizer.encode(lowerCAmelCase					,     add_special_tokens=lowerCAmelCase	)
						self.assertListEqual(lowerCAmelCase					,     lowerCAmelCase	)
						__UpperCamelCase					:	Any             =      tokenizer.tokenize(lowerCAmelCase	)
						self.assertListEqual(lowerCAmelCase					,     lowerCAmelCase	)
						__UpperCamelCase					:	int             =      tokenizer.convert_ids_to_tokens(lowerCAmelCase	)
						self.assertListEqual(lowerCAmelCase					,     lowerCAmelCase	)

						__UpperCamelCase					:	Optional[Any]             =      rust_tokenizer.encode(lowerCAmelCase					,     add_special_tokens=lowerCAmelCase	)
						self.assertListEqual(lowerCAmelCase					,     lowerCAmelCase	)
						__UpperCamelCase					:	Union[str, Any]             =      rust_tokenizer.tokenize(lowerCAmelCase	)
						self.assertListEqual(lowerCAmelCase					,     lowerCAmelCase	)
						__UpperCamelCase					:	List[str]             =      rust_tokenizer.convert_ids_to_tokens(lowerCAmelCase	)
						self.assertListEqual(lowerCAmelCase					,     lowerCAmelCase	)

						# fmt: off
						__UpperCamelCase					:	Any             =      """I was born in 92000, and this is falsé."""
						__UpperCamelCase					:	Optional[int]             =      [13, 1, 23, 386, 19, 561, 3050, 15, 17, 48, 25, 8256, 18, 1, 9]
						__UpperCamelCase					:	Optional[Any]             =      ["""▁""", """I""", """▁was""", """▁born""", """▁in""", """▁9""", """2000""", """,""", """▁and""", """▁this""", """▁is""", """▁fal""", """s""", """é""", """.""", ]
						__UpperCamelCase					:	Optional[int]             =      ["""▁""", """<unk>""", """▁was""", """▁born""", """▁in""", """▁9""", """2000""", """,""", """▁and""", """▁this""", """▁is""", """▁fal""", """s""", """<unk>""", """.""", ]
						# fmt: on

						__UpperCamelCase					:	str             =      tokenizer.encode(lowerCAmelCase					,     add_special_tokens=lowerCAmelCase	)
						self.assertListEqual(lowerCAmelCase					,     lowerCAmelCase	)
						__UpperCamelCase					:	Dict             =      tokenizer.tokenize(lowerCAmelCase	)
						self.assertListEqual(lowerCAmelCase					,     lowerCAmelCase	)
						__UpperCamelCase					:	Any             =      tokenizer.convert_ids_to_tokens(lowerCAmelCase	)
						self.assertListEqual(lowerCAmelCase					,     lowerCAmelCase	)

						__UpperCamelCase					:	Union[str, Any]             =      rust_tokenizer.encode(lowerCAmelCase					,     add_special_tokens=lowerCAmelCase	)
						self.assertListEqual(lowerCAmelCase					,     lowerCAmelCase	)
						__UpperCamelCase					:	str             =      rust_tokenizer.tokenize(lowerCAmelCase	)
						self.assertListEqual(lowerCAmelCase					,     lowerCAmelCase	)
						__UpperCamelCase					:	List[Any]             =      rust_tokenizer.convert_ids_to_tokens(lowerCAmelCase	)
						self.assertListEqual(lowerCAmelCase					,     lowerCAmelCase	)






	def 					lowerCamelCase__     (					self		:						str	)	->       str:







						"""simple docstring"""







						__UpperCamelCase					:	Any             =      DebertaVaTokenizer(lowerCAmelCase	)

						__UpperCamelCase					:	Tuple             =      tokenizer.encode("""sequence builders"""	)
						__UpperCamelCase					:	List[Any]             =      tokenizer.encode("""multi-sequence build"""	)

						__UpperCamelCase					:	int             =      tokenizer.build_inputs_with_special_tokens(lowerCAmelCase	)
						__UpperCamelCase					:	Any             =      tokenizer.build_inputs_with_special_tokens(lowerCAmelCase					,     lowerCAmelCase	)

						self.assertEqual([tokenizer.cls_token_id] + text + [tokenizer.sep_token_id]					,     lowerCAmelCase	)
						self.assertEqual(
						    [tokenizer.cls_token_id] + text + [tokenizer.sep_token_id] + text_a + [tokenizer.sep_token_id]					,     lowerCAmelCase					,     )






	@slow
	def 					lowerCamelCase__     (					self		:						Optional[Any]	)	->       Optional[int]:







						"""simple docstring"""







						__UpperCamelCase					:	Optional[Any]             =      {"""input_ids""": [[1, 39867, 36, 19390, 486, 27, 35052, 81436, 18, 60685, 1225, 7, 35052, 81436, 18, 9367, 16899, 18, 15937, 53, 594, 773, 18, 16287, 30465, 36, 15937, 6, 41139, 38, 36979, 60763, 191, 6, 34132, 99, 6, 50538, 390, 43230, 6, 34132, 2779, 20850, 14, 699, 1072, 1194, 36, 382, 10901, 53, 7, 699, 1072, 2084, 36, 20422, 630, 53, 19, 105, 3049, 1896, 1053, 16899, 1506, 11, 37978, 4243, 7, 1237, 31869, 200, 16566, 654, 6, 35052, 81436, 7, 55630, 13593, 4, 2], [1, 26, 15011, 13, 667, 8, 1053, 18, 23611, 1237, 72356, 12820, 34, 104134, 1209, 35, 13313, 6627, 21, 202, 347, 7, 164, 2399, 11, 46, 4485, 4, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 5, 1232, 2864, 15785, 14951, 105, 5, 8581, 1250, 4, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]], """token_type_ids""": [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]], """attention_mask""": [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]]}  # noqa: E501
						# fmt: on

						self.tokenizer_integration_test_util(
						    expected_encoding=lowerCAmelCase					,     model_name="""microsoft/deberta-v2-xlarge"""					,     revision="""ad6e42c1532ddf3a15c39246b63f5559d558b670"""					,     )












import re
from pathlib import Path
from unittest import TestCase

import pytest


@pytest.mark.integration
class    SCREAMING_SNAKE_CASE_				(       _UpperCamelCase   ):



	"""simple docstring"""


	def 					lowerCamelCase__     (					self		:						Any					,     lowerCAmelCase		:						str	)	->       List[Any]:







						"""simple docstring"""







						with open(lowerCAmelCase					,     encoding="""utf-8"""	) as input_file:
											__UpperCamelCase					:	Union[str, Any]             =      re.compile(R"""(?!.*\b(?:encoding|rb|w|wb|w+|wb+|ab|ab+)\b)(?<=\s)(open)\((.*)\)"""	)
											__UpperCamelCase					:	str             =      input_file.read()
											__UpperCamelCase					:	Optional[int]             =      regexp.search(lowerCAmelCase	)

						return match






	def 					lowerCamelCase__     (					self		:						Optional[Any]					,     lowerCAmelCase		:						str	)	->       Union[str, Any]:







						"""simple docstring"""







						with open(lowerCAmelCase					,     encoding="""utf-8"""	) as input_file:
											__UpperCamelCase					:	Dict             =      re.compile(R"""#[^\r\n]*print\(|\"[^\r\n]*print\(|\"\"\".*?print\(.*?\"\"\"|(print\()"""					,     re.DOTALL	)
											__UpperCamelCase					:	str             =      input_file.read()
											# use `re.finditer` to handle the case where the ignored groups would be matched first by `re.search`
											__UpperCamelCase					:	List[Any]             =      regexp.finditer(lowerCAmelCase	)

						__UpperCamelCase					:	int             =      [match for match in matches if match is not None and match.group(1	) is not None]
						return matches[0] if matches else None






	def 					lowerCamelCase__     (					self		:						List[Any]	)	->       List[str]:







						"""simple docstring"""







						__UpperCamelCase					:	Optional[int]             =      Path("""./datasets"""	)
						__UpperCamelCase					:	Optional[int]             =      list(dataset_paths.absolute().glob("""**/*.py"""	)	)

						for dataset in dataset_files:
											if self._no_encoding_on_file_open(str(lowerCAmelCase	)	):
																raise AssertionError(F'''open(...) must use utf-8 encoding in {dataset}'''	)






	def 					lowerCamelCase__     (					self		:						Optional[Any]	)	->       Any:







						"""simple docstring"""







						__UpperCamelCase					:	Optional[int]             =      Path("""./datasets"""	)
						__UpperCamelCase					:	Optional[int]             =      list(dataset_paths.absolute().glob("""**/*.py"""	)	)

						for dataset in dataset_files:
											if self._no_print_statements(str(lowerCAmelCase	)	):
																raise AssertionError(F'''print statement found in {dataset}. Use datasets.logger/logging instead.'''	)






