

def 							__SCREAMING_SNAKE_CASE							(			lowerCAmelCase:					str					, lowerCAmelCase:					int	)				->    int:
				_UpperCAmelCase    :						list[list[str]]							=      [[] for _ in range(__a	)]
				_UpperCAmelCase    :						Optional[int]							=      key - 1

				if key <= 0:
								raise ValueError("Height of grid can\'t be 0 or negative"	)
				if key == 1 or len(__a	) <= key:
								return input_string

				for position, character in enumerate(__a	):
								_UpperCAmelCase    :						int							=      position % (lowest * 2)  # puts it in bounds
								_UpperCAmelCase    :						Tuple							=      min(__a					, lowest * 2 - num	)  # creates zigzag pattern
								temp_grid[num].append(__a	)
				_UpperCAmelCase    :						List[Any]							=      [''.join(__a	) for row in temp_grid]
				_UpperCAmelCase    :						Optional[int]							=      ''.join(__a	)

				return output_string

def 							__SCREAMING_SNAKE_CASE							(			lowerCAmelCase:					str					, lowerCAmelCase:					int	)				->    Union[str, Any]:
				_UpperCAmelCase    :						Optional[Any]							=      []
				_UpperCAmelCase    :						List[str]							=      key - 1

				if key <= 0:
								raise ValueError("Height of grid can\'t be 0 or negative"	)
				if key == 1:
								return input_string

				_UpperCAmelCase    :						list[list[str]]							=      [[] for _ in range(__a	)]  # generates template
				for position in range(len(__a	)	):
								_UpperCAmelCase    :						Optional[int]							=      position % (lowest * 2)  # puts it in bounds
								_UpperCAmelCase    :						List[str]							=      min(__a					, lowest * 2 - num	)  # creates zigzag pattern
								temp_grid[num].append("*"	)

				_UpperCAmelCase    :						Any							=      0
				for row in temp_grid:  # fills in the characters
								_UpperCAmelCase    :						str							=      input_string[counter : counter + len(__a	)]
								grid.append(list(__a	)	)
								counter += len(__a	)

				_UpperCAmelCase    :						int							=      ''  # reads as zigzag
				for position in range(len(__a	)	):
								_UpperCAmelCase    :						str							=      position % (lowest * 2)  # puts it in bounds
								_UpperCAmelCase    :						Union[str, Any]							=      min(__a					, lowest * 2 - num	)  # creates zigzag pattern
								output_string += grid[num][0]
								grid[num].pop(0	)
				return output_string

def 							__SCREAMING_SNAKE_CASE							(			lowerCAmelCase:					str	)				->    int:
				_UpperCAmelCase    :						Optional[int]							=      {}
				for key_guess in range(1					, len(__a	)	):  # tries every key
								_UpperCAmelCase    :						Optional[Any]							=      decrypt(__a					, __a	)
				return results


if __name__ == "__main__":
					import doctest

					doctest.testmod()





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
SCREAMING_SNAKE_CASE_            = 'src/transformers'


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

SCREAMING_SNAKE_CASE_            = 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)`
SCREAMING_SNAKE_CASE_            = re.compile(R'\[(.+?)\]\((https://huggingface\.co/.+?)\)')


SCREAMING_SNAKE_CASE_            = {
    'DecisionTransformerConfig',
    'EncoderDecoderConfig',
    'MusicgenConfig',
    'RagConfig',
    'SpeechEncoderDecoderConfig',
    'TimmBackboneConfig',
    'VisionEncoderDecoderConfig',
    'VisionTextDualEncoderConfig',
    'LlamaConfig',
}

def 							__SCREAMING_SNAKE_CASE							(			lowerCAmelCase:					Dict	)				->    Union[str, Any]:
				_UpperCAmelCase    :						List[Any]							=      None

				# source code of `config_class`
				_UpperCAmelCase    :						int							=      inspect.getsource(lowerCAmelCase	)
				_UpperCAmelCase    :						Tuple							=      _re_checkpoint.findall(lowerCAmelCase	)

				# 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("/"	):
												_UpperCAmelCase    :						Dict							=      ckpt_link[:-1]

								# verify the checkpoint name corresponds to the checkpoint link
								_UpperCAmelCase    :						Any							=      F'https://huggingface.co/{ckpt_name}'
								if ckpt_link == ckpt_link_from_name:
												_UpperCAmelCase    :						Union[str, Any]							=      ckpt_name
												break

				return checkpoint

def 							__SCREAMING_SNAKE_CASE							(			)				->    Dict:
				_UpperCAmelCase    :						Any							=      []

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

								_UpperCAmelCase    :						Tuple							=      config_class.__name__
								if checkpoint is None and name not in CONFIG_CLASSES_TO_IGNORE_FOR_DOCSTRING_CHECKPOINT_CHECK:
												configs_without_checkpoint.append(lowerCAmelCase	)

				if len(lowerCAmelCase	) > 0:
								_UpperCAmelCase    :						int							=      "\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()


