


import json
import os
import unittest

from transformers.models.xlm.tokenization_xlm import VOCAB_FILES_NAMES, XLMTokenizer
from transformers.testing_utils import slow

from ...test_tokenization_common import TokenizerTesterMixin


class        _a							(			UpperCamelCase__     ,	unittest.TestCase			):
							_lowercase	:			Any        = XLMTokenizer
							_lowercase	:			Optional[int]        = False

							def       lowerCamelCase_ (							self:	Tuple							)			->   List[Any]:





									"""simple docstring"""







									super().setUp()

									# Adapted from Sennrich et al. 2015 and https://github.com/rsennrich/subword-nmt
									lowercase__            =      [
									    '''l''',
									    '''o''',
									    '''w''',
									    '''e''',
									    '''r''',
									    '''s''',
									    '''t''',
									    '''i''',
									    '''d''',
									    '''n''',
									    '''w</w>''',
									    '''r</w>''',
									    '''t</w>''',
									    '''lo''',
									    '''low''',
									    '''er</w>''',
									    '''low</w>''',
									    '''lowest</w>''',
									    '''newer</w>''',
									    '''wider</w>''',
									    '''<unk>''',
									]
									lowercase__            =      dict(zip(UpperCamelCase_    ,						range(len(UpperCamelCase_							)							)							)							)
									lowercase__            =      ['''l o 123''', '''lo w 1456''', '''e r</w> 1789''', '''''']

									lowercase__            =      os.path.join(self.tmpdirname    ,						VOCAB_FILES_NAMES['''vocab_file''']							)
									lowercase__            =      os.path.join(self.tmpdirname    ,						VOCAB_FILES_NAMES['''merges_file''']							)
									with open(self.vocab_file    ,						'''w'''							) as fp:
											fp.write(json.dumps(UpperCamelCase_							)							)
									with open(self.merges_file    ,						'''w'''							) as fp:
											fp.write('''\n'''.join(UpperCamelCase_							)							)

							def       lowerCamelCase_ (							self:	List[str]    ,						UpperCamelCase_:	Tuple							)			->   List[str]:





									"""simple docstring"""







									lowercase__            =      '''lower newer'''
									lowercase__            =      '''lower newer'''
									return input_text, output_text

							def       lowerCamelCase_ (							self:	Union[str, Any]							)			->   Union[str, Any]:





									"""simple docstring"""







									lowercase__            =      XLMTokenizer(self.vocab_file    ,						self.merges_file							)

									lowercase__            =      '''lower'''
									lowercase__            =      ['''low''', '''er</w>''']
									lowercase__            =      tokenizer.tokenize(UpperCamelCase_							)
									self.assertListEqual(UpperCamelCase_    ,						UpperCamelCase_							)

									lowercase__            =      tokens + ['''<unk>''']
									lowercase__            =      [14, 15, 20]
									self.assertListEqual(tokenizer.convert_tokens_to_ids(UpperCamelCase_							)    ,						UpperCamelCase_							)


							@slow
							def       lowerCamelCase_ (							self:	Any							)			->   str:





									"""simple docstring"""







									lowercase__            =      XLMTokenizer.from_pretrained('''xlm-mlm-en-2048'''							)

									lowercase__            =      tokenizer.encode('''sequence builders'''    ,						add_special_tokens=UpperCamelCase_							)
									lowercase__            =      tokenizer.encode('''multi-sequence build'''    ,						add_special_tokens=UpperCamelCase_							)

									lowercase__            =      tokenizer.build_inputs_with_special_tokens(UpperCamelCase_							)
									lowercase__            =      tokenizer.build_inputs_with_special_tokens(UpperCamelCase_    ,						UpperCamelCase_							)

									assert encoded_sentence == [0] + text + [1]
									assert encoded_pair == [0] + text + [1] + text_a + [1]






from __future__ import annotations
def 			_a (      SCREAMING_SNAKE_CASE						,				SCREAMING_SNAKE_CASE     ):


		"""simple docstring"""




		lowercase__            =      0
		lowercase__            =      len(SCREAMING_SNAKE_CASE     ) - 1

		while i < j:
				if nums[i] + nums[j] == target:
						return [i, j]
				elif nums[i] + nums[j] < target:
						lowercase__            =      i + 1
				else:
						lowercase__            =      j - 1

		return []


if __name__ == "__main__":
			import doctest

			doctest.testmod()
			print(f"""{two_pointer([2, 7, 11, 15], 9) = }""")


