



'''simple docstring'''






import importlib
import inspect
import os
import re


# 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
UpperCamelCase__:     str										=    "src/transformers"


# This is to make sure the transformers module imported is the one in the repo.
UpperCamelCase__:     str										=    importlib.util.spec_from_file_location(
    "transformers",
    os.path.join(PATH_TO_TRANSFORMERS, "__init__.py"),
    submodule_search_locations=[PATH_TO_TRANSFORMERS],
)
UpperCamelCase__:     Any										=    spec.loader.load_module()

UpperCamelCase__:     List[Any]										=    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)`
UpperCamelCase__:     List[str]										=    re.compile("\[(.+?)\]\((https://huggingface\.co/.+?)\)")


UpperCamelCase__:     int										=    {
    "CLIPConfigMixin",
    "DecisionTransformerConfigMixin",
    "EncoderDecoderConfigMixin",
    "RagConfigMixin",
    "SpeechEncoderDecoderConfigMixin",
    "VisionEncoderDecoderConfigMixin",
    "VisionTextDualEncoderConfigMixin",
}


def 				snake_case_  (      )   ->     int:
							UpperCAmelCase				: Optional[int]											=	[]

							for config_class in list(CONFIG_MAPPING.values()						):
														UpperCAmelCase				: int											=	False

														# source code of `config_class`
														UpperCAmelCase				: Union[str, Any]											=	inspect.getsource(lowerCAmelCase__						)
														UpperCAmelCase				: List[Any]											=	_re_checkpoint.findall(lowerCAmelCase__						)

														for checkpoint in checkpoints:
																					# Each `checkpoint` is a tuple of a checkpoint name and a checkpoint link.
																					# For example, `('bert-base-uncased', 'https://huggingface.co/bert-base-uncased')`
																					UpperCAmelCase				: Tuple											=	checkpoint

																					# verify the checkpoint name corresponds to the checkpoint link
																					UpperCAmelCase				: List[str]											=	f"""https://huggingface.co/{ckpt_name}"""
																					if ckpt_link == ckpt_link_from_name:
																												UpperCAmelCase				: Optional[int]											=	True
																												break

														UpperCAmelCase				: Tuple											=	config_class.__name__
														if not checkpoint_found and name not in CONFIG_CLASSES_TO_IGNORE_FOR_DOCSTRING_CHECKPOINT_CHECK:
																					configs_without_checkpoint.append(lowerCAmelCase__						)

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


if __name__ == "__main__":
						check_config_docstrings_have_checkpoints()










'''simple docstring'''






import numpy as np

UpperCamelCase__:     Any										=    [
    ["a", "b", "c", "d", "e"],
    ["f", "g", "h", "i", "k"],
    ["l", "m", "n", "o", "p"],
    ["q", "r", "s", "t", "u"],
    ["v", "w", "x", "y", "z"],
]

class        SCREAMING_SNAKE_CASE:







	"""simple docstring"""






	def __init__(		self    :  Any	)    ->	None:
								UpperCAmelCase				: Optional[int]											=	np.array(__snake_case	)







	def   A			(		self    :  str	,    __snake_case    :  str	)    ->	np.ndarray:
								UpperCAmelCase							,	UpperCAmelCase				: Dict											=	np.where(letter == self.SQUARE	)
								UpperCAmelCase				: Dict											=	np.concatenate([indexa + 1, indexa + 1]	)
								return indexes







	def   A			(		self    :  Union[str, Any]	,    __snake_case    :  int	,    __snake_case    :  int	)    ->	str:
								UpperCAmelCase				: int											=	self.SQUARE[indexa - 1, indexa - 1]
								return letter







	def   A			(		self    :  List[Any]	,    __snake_case    :  str	)    ->	str:
								UpperCAmelCase				: Any											=	message.lower()
								UpperCAmelCase				: List[Any]											=	message.replace(''' '''	,    ''''''	)
								UpperCAmelCase				: List[Any]											=	message.replace('''j'''	,    '''i'''	)

								UpperCAmelCase				: Tuple											=	np.empty((2, len(__snake_case	))	)
								for letter_index in range(len(__snake_case	)	):
															UpperCAmelCase				: str											=	self.letter_to_numbers(message[letter_index]	)

															UpperCAmelCase				: Any											=	numbers[0]
															UpperCAmelCase				: Optional[Any]											=	numbers[1]

								UpperCAmelCase				: List[str]											=	first_step.reshape(2 * len(__snake_case	)	)
								UpperCAmelCase				: Union[str, Any]											=	''''''
								for numbers_index in range(len(__snake_case	)	):
															UpperCAmelCase				: Dict											=	int(second_step[numbers_index * 2]	)
															UpperCAmelCase				: Union[str, Any]											=	int(second_step[(numbers_index * 2) + 1]	)
															UpperCAmelCase				: Dict											=	self.numbers_to_letter(__snake_case	,    __snake_case	)
															UpperCAmelCase				: int											=	encoded_message + letter

								return encoded_message







	def   A			(		self    :  Optional[Any]	,    __snake_case    :  str	)    ->	str:
								UpperCAmelCase				: str											=	message.lower()
								message.replace(''' '''	,    ''''''	)
								UpperCAmelCase				: Optional[int]											=	np.empty(2 * len(__snake_case	)	)
								for letter_index in range(len(__snake_case	)	):
															UpperCAmelCase				: int											=	self.letter_to_numbers(message[letter_index]	)
															UpperCAmelCase				: Optional[Any]											=	numbers[0]
															UpperCAmelCase				: List[Any]											=	numbers[1]

								UpperCAmelCase				: Tuple											=	first_step.reshape((2, len(__snake_case	))	)
								UpperCAmelCase				: str											=	''''''
								for numbers_index in range(len(__snake_case	)	):
															UpperCAmelCase				: Tuple											=	int(second_step[0, numbers_index]	)
															UpperCAmelCase				: List[str]											=	int(second_step[1, numbers_index]	)
															UpperCAmelCase				: Union[str, Any]											=	self.numbers_to_letter(__snake_case	,    __snake_case	)
															UpperCAmelCase				: Union[str, Any]											=	decoded_message + letter

								return decoded_message





