


from __future__ import annotations

import bisect
def 			_a (      SCREAMING_SNAKE_CASE						,				SCREAMING_SNAKE_CASE						,				SCREAMING_SNAKE_CASE = 0						,				SCREAMING_SNAKE_CASE = -1     ):


		"""simple docstring"""




		if hi < 0:
				lowercase__            =      len(SCREAMING_SNAKE_CASE     )

		while lo < hi:
				lowercase__            =      lo + (hi - lo) // 2
				if sorted_collection[mid] < item:
						lowercase__            =      mid + 1
				else:
						lowercase__            =      mid

		return lo
def 			_a (      SCREAMING_SNAKE_CASE						,				SCREAMING_SNAKE_CASE						,				SCREAMING_SNAKE_CASE = 0						,				SCREAMING_SNAKE_CASE = -1     ):


		"""simple docstring"""




		if hi < 0:
				lowercase__            =      len(SCREAMING_SNAKE_CASE     )

		while lo < hi:
				lowercase__            =      lo + (hi - lo) // 2
				if sorted_collection[mid] <= item:
						lowercase__            =      mid + 1
				else:
						lowercase__            =      mid

		return lo
def 			_a (      SCREAMING_SNAKE_CASE						,				SCREAMING_SNAKE_CASE						,				SCREAMING_SNAKE_CASE = 0						,				SCREAMING_SNAKE_CASE = -1     ):


		"""simple docstring"""




		sorted_collection.insert(bisect_left(SCREAMING_SNAKE_CASE						,				SCREAMING_SNAKE_CASE						,				SCREAMING_SNAKE_CASE						,				SCREAMING_SNAKE_CASE     )						,				SCREAMING_SNAKE_CASE     )
def 			_a (      SCREAMING_SNAKE_CASE						,				SCREAMING_SNAKE_CASE						,				SCREAMING_SNAKE_CASE = 0						,				SCREAMING_SNAKE_CASE = -1     ):


		"""simple docstring"""




		sorted_collection.insert(bisect_right(SCREAMING_SNAKE_CASE						,				SCREAMING_SNAKE_CASE						,				SCREAMING_SNAKE_CASE						,				SCREAMING_SNAKE_CASE     )						,				SCREAMING_SNAKE_CASE     )
def 			_a (      SCREAMING_SNAKE_CASE						,				SCREAMING_SNAKE_CASE     ):


		"""simple docstring"""




		lowercase__            =      0
		lowercase__            =      len(SCREAMING_SNAKE_CASE     ) - 1

		while left <= right:
				lowercase__            =      left + (right - left) // 2
				lowercase__            =      sorted_collection[midpoint]
				if current_item == item:
						return midpoint
				elif item < current_item:
						lowercase__            =      midpoint - 1
				else:
						lowercase__            =      midpoint + 1
		return None
def 			_a (      SCREAMING_SNAKE_CASE						,				SCREAMING_SNAKE_CASE     ):


		"""simple docstring"""




		lowercase__            =      bisect.bisect_left(SCREAMING_SNAKE_CASE						,				SCREAMING_SNAKE_CASE     )
		if index != len(SCREAMING_SNAKE_CASE     ) and sorted_collection[index] == item:
				return index
		return None
def 			_a (      SCREAMING_SNAKE_CASE						,				SCREAMING_SNAKE_CASE						,				SCREAMING_SNAKE_CASE						,				SCREAMING_SNAKE_CASE     ):


		"""simple docstring"""




		if right < left:
				return None

		lowercase__            =      left + (right - left) // 2

		if sorted_collection[midpoint] == item:
				return midpoint
		elif sorted_collection[midpoint] > item:
				return binary_search_by_recursion(SCREAMING_SNAKE_CASE						,				SCREAMING_SNAKE_CASE						,				SCREAMING_SNAKE_CASE						,				midpoint - 1     )
		else:
				return binary_search_by_recursion(SCREAMING_SNAKE_CASE						,				SCREAMING_SNAKE_CASE						,				midpoint + 1						,				SCREAMING_SNAKE_CASE     )


if __name__ == "__main__":
			lowerCAmelCase       =							input('Enter numbers separated by comma:\n').strip()
			lowerCAmelCase       =							sorted(int(item) for item in user_input.split(','))
			lowerCAmelCase       =							int(input('Enter a single number to be found in the list:\n'))
			lowerCAmelCase       =							binary_search(collection, target)
			if result is None:
						print(f"""{target} was not found in {collection}.""")
			else:
						print(f"""{target} was found at position {result} in {collection}.""")






import inspect
import re

from transformers.utils import direct_transformers_import


# All paths are set with the intent you should run this script from the root of the repo with the command
# python utils/check_config_docstrings.py
lowerCAmelCase       =							'src/transformers'


# This is to make sure the transformers module imported is the one in the repo.
lowerCAmelCase       =							direct_transformers_import(PATH_TO_TRANSFORMERS)

lowerCAmelCase       =							transformers.models.auto.configuration_auto.CONFIG_MAPPING

# Regex pattern used to find the checkpoint mentioned in the docstring of `config_class`.
# For example, `[bert-base-uncased](https://huggingface.co/bert-base-uncased)`
lowerCAmelCase       =							re.compile(R'\[(.+?)\]\((https://huggingface\.co/.+?)\)')


lowerCAmelCase       =							{
    'DecisionTransformerConfig',
    'EncoderDecoderConfig',
    'MusicgenConfig',
    'RagConfig',
    'SpeechEncoderDecoderConfig',
    'TimmBackboneConfig',
    'VisionEncoderDecoderConfig',
    'VisionTextDualEncoderConfig',
    'LlamaConfig',
}
def 			_a (      SCREAMING_SNAKE_CASE     ):


		"""simple docstring"""




		lowercase__            =      None

		# source code of `config_class`
		lowercase__            =      inspect.getsource(SCREAMING_SNAKE_CASE     )
		lowercase__            =      _re_checkpoint.findall(SCREAMING_SNAKE_CASE     )

		# Each `checkpoint` is a tuple of a checkpoint name and a checkpoint link.
		# For example, `('bert-base-uncased', 'https://huggingface.co/bert-base-uncased')`
		for ckpt_name, ckpt_link in checkpoints:
				# allow the link to end with `/`
				if ckpt_link.endswith('''/'''     ):
						lowercase__            =      ckpt_link[:-1]

				# verify the checkpoint name corresponds to the checkpoint link
				lowercase__            =      f'https://huggingface.co/{ckpt_name}'
				if ckpt_link == ckpt_link_from_name:
						lowercase__            =      ckpt_name
						break

		return checkpoint
def 			_a (      ):


		"""simple docstring"""




		lowercase__            =      []

		for config_class in list(CONFIG_MAPPING.values()     ):
				# Skip deprecated models
				if "models.deprecated" in config_class.__module__:
						continue
				lowercase__            =      get_checkpoint_from_config_class(SCREAMING_SNAKE_CASE     )

				lowercase__            =      config_class.__name__
				if checkpoint is None and name not in CONFIG_CLASSES_TO_IGNORE_FOR_DOCSTRING_CHECKPOINT_CHECK:
						configs_without_checkpoint.append(SCREAMING_SNAKE_CASE     )

		if len(SCREAMING_SNAKE_CASE     ) > 0:
				lowercase__            =      '''\n'''.join(sorted(SCREAMING_SNAKE_CASE     )     )
				raise ValueError(f'The following configurations don\'t contain any valid checkpoint:\n{message}'     )


if __name__ == "__main__":
			check_config_docstrings_have_checkpoints()


