



"""simple docstring"""






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


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

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


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




def 			snake_case		(		lowerCAmelCase_	)						->				Tuple:
  _snake_case   	=      None

  # source code of `config_class`
  _snake_case   	=      inspect.getsource(__A	)
  _snake_case   	=      _re_checkpoint.findall(__A	)

  # 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('''/'''	):
      _snake_case   	=      ckpt_link[:-1]

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

  return checkpoint




def 			snake_case		(		)						->				Union[str, Any]:
  _snake_case   	=      []

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

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

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


if __name__ == "__main__":
     check_config_docstrings_have_checkpoints()













def     a_   (__A				,       __A				,       __A				,       __A      )				->						int:



					"""simple docstring"""
					__a      ,			__a					:						Any      =					len(__A      ), len(grid[0]      )
					if (
					    min(__A				,       __A      ) < 0
					    or row == row_length
					    or col == col_length
					    or (row, col) in visit
					    or grid[row][col] == 1
					):
										return 0
					if row == row_length - 1 and col == col_length - 1:
										return 1

					visit.add((row, col)      )

					__a					:						Dict      =					0
					count += depth_first_search(__A				,       row + 1				,       __A				,       __A      )
					count += depth_first_search(__A				,       row - 1				,       __A				,       __A      )
					count += depth_first_search(__A				,       __A				,       col + 1				,       __A      )
					count += depth_first_search(__A				,       __A				,       col - 1				,       __A      )

					visit.remove((row, col)      )
					return count


if __name__ == "__main__":
			import doctest

			doctest.testmod()





