




'''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       lowercase_		(unittest.TestCase   ):
						lowerCAmelCase__ 			=EsmTokenizer



						def   __a				( self  :      List[Any]     ):

								"""simple docstring"""

								super().setUp()
								SCREAMING_SNAKE_CASE_							=       tempfile.mkdtemp()
								# fmt: off
								SCREAMING_SNAKE_CASE_							=       ["<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
								SCREAMING_SNAKE_CASE_							=       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   __a				( self  :      str				,       **snake_case__  :      Dict     ):

								"""simple docstring"""

								return [self.get_tokenizer(**UpperCAmelCase_     )]



						def   __a				( self  :      Dict				,       **snake_case__  :      List[Any]     ):

								"""simple docstring"""

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



						def   __a				( self  :      Any     ):

								"""simple docstring"""

								SCREAMING_SNAKE_CASE_							=       self.tokenizer_class(self.vocab_file     )

								SCREAMING_SNAKE_CASE_							=       tokenizer.tokenize('LAGVS'     )
								self.assertListEqual(UpperCAmelCase_				,       ['L', 'A', 'G', 'V', 'S']     )
								self.assertListEqual(tokenizer.convert_tokens_to_ids(UpperCAmelCase_     )				,       [4, 5, 6, 7, 8]     )



						def   __a				( self  :      Dict     ):

								"""simple docstring"""

								SCREAMING_SNAKE_CASE_							=       self.tokenizer_class(self.vocab_file     )

								SCREAMING_SNAKE_CASE_							=       'LAGVS'
								self.assertListEqual(tokenizer.encode(UpperCAmelCase_     )				,       [0, 4, 5, 6, 7, 8, 2]     )



						def   __a				( self  :      Tuple     ):

								"""simple docstring"""

								SCREAMING_SNAKE_CASE_							=       self.tokenizer_class(self.vocab_file     )

								SCREAMING_SNAKE_CASE_							=       ['LAGVS', 'WCB']
								SCREAMING_SNAKE_CASE_							=       tokenizer(UpperCAmelCase_				,       padding=UpperCAmelCase_     )['input_ids']

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



						def   __a				( self  :      Any     ):

								"""simple docstring"""

								SCREAMING_SNAKE_CASE_							=       self.tokenizer_class(self.vocab_file     )

								SCREAMING_SNAKE_CASE_							=       ['LAGVS', 'WCB']
								SCREAMING_SNAKE_CASE_							=       tokenizer(UpperCAmelCase_				,       padding=UpperCAmelCase_     )['input_ids']

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






						def   __a				( self  :      Any     ):

								"""simple docstring"""

								SCREAMING_SNAKE_CASE_							=       self.get_tokenizers(fast=UpperCAmelCase_     )
								for tokenizer in tokenizers:
										with self.subTest(f'''{tokenizer.__class__.__name__}'''     ):
												SCREAMING_SNAKE_CASE_							=       '<unk>'
												SCREAMING_SNAKE_CASE_							=       '<mask>'

												SCREAMING_SNAKE_CASE_							=       tokenizer.tokenize(UpperCAmelCase_     )
												SCREAMING_SNAKE_CASE_							=       tokenizer.tokenize(UpperCAmelCase_     )

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





from __future__ import annotations


def 				_a       (				lowerCAmelCase						,	lowerCAmelCase   )->  int:
		SCREAMING_SNAKE_CASE_			,							SCREAMING_SNAKE_CASE_							=       0, len(lowerCAmelCase   ) - 1
		while start_ind <= end_ind:
				if array[start_ind] == search_item:
						return start_ind
				elif array[end_ind] == search_item:
						return end_ind
				else:
						start_ind += 1
						end_ind -= 1
    # returns -1 if search_item is not found in array
		return -1


if __name__ == "__main__":
						print(double_linear_search(list(range(1_0_0)), 4_0))