'''simple docstring'''


import doctest
import logging
import os
import unittest
from pathlib import Path
from typing import List, Union

import transformers
from transformers.testing_utils import require_tf, require_torch, slow


snake_case__					:      Optional[Any]				      =  logging.getLogger()






@unittest.skip('''Temporarily disable the doc tests.'''	)
@require_torch
@require_tf
@slow
class 					__SCREAMING_SNAKE_CASE						(	unittest.TestCase	):







		'''simple docstring'''






		def _UpperCamelCase					(			self				,		snake_case_				,		snake_case_ = None				,		snake_case_ = None				,		snake_case_ = None				,		snake_case_ = True				,		):




							'''simple docstring'''

							UpperCAmelCase_							:       List[str]       =				[file for file in os.listdir(lowerCamelCase_						) if os.path.isfile(os.path.join(lowerCamelCase_				,		lowerCamelCase_						)						)]

							if identifier is not None:
												UpperCAmelCase_							:       Any       =				[file for file in files if identifier in file]

							if n_identifier is not None:
												if isinstance(lowerCamelCase_				,		lowerCamelCase_						):
																	for n_ in n_identifier:
																						UpperCAmelCase_							:       Any       =				[file for file in files if n_ not in file]
												else:
																	UpperCAmelCase_							:       Any       =				[file for file in files if n_identifier not in file]

							UpperCAmelCase_							:       str       =				ignore_files or []
							ignore_files.append('__init__.py'						)
							UpperCAmelCase_							:       int       =				[file for file in files if file not in ignore_files]

							for file in files:
												# Open all files
												print('Testing'				,		lowerCamelCase_						)

												if only_modules:
																	UpperCAmelCase_							:       Tuple       =				file.split('.'						)[0]
																	try:
																						UpperCAmelCase_							:       int       =				getattr(lowerCamelCase_				,		lowerCamelCase_						)
																						UpperCAmelCase_							:       Any       =				doctest.DocTestSuite(lowerCamelCase_						)
																						UpperCAmelCase_							:       List[str]       =				unittest.TextTestRunner().run(lowerCamelCase_						)
																						self.assertIs(len(result.failures						)				,		0						)
																	except AttributeError:
																						logger.info(F'''{module_identifier} is not a module.'''						)
												else:
																	UpperCAmelCase_							:       Optional[Any]       =				doctest.testfile(str('..' / directory / file						)				,		optionflags=doctest.ELLIPSIS						)
																	self.assertIs(result.failed				,		0						)


		def _UpperCamelCase					(			self						):




							'''simple docstring'''

							UpperCAmelCase_							:       List[Any]       =				Path('src/transformers'						)
							UpperCAmelCase_							:       int       =				'modeling'
							UpperCAmelCase_							:       str       =				[
							    'modeling_ctrl.py',
							    'modeling_tf_ctrl.py',
							]
							self.analyze_directory(lowerCamelCase_				,		identifier=lowerCamelCase_				,		ignore_files=lowerCamelCase_						)


		def _UpperCamelCase					(			self						):




							'''simple docstring'''

							UpperCAmelCase_							:       Optional[int]       =				Path('src/transformers'						)
							UpperCAmelCase_							:       int       =				'tokenization'
							self.analyze_directory(lowerCamelCase_				,		identifier=lowerCamelCase_						)


		def _UpperCamelCase					(			self						):




							'''simple docstring'''

							UpperCAmelCase_							:       Tuple       =				Path('src/transformers'						)
							UpperCAmelCase_							:       Any       =				'configuration'
							self.analyze_directory(lowerCamelCase_				,		identifier=lowerCamelCase_						)


		def _UpperCamelCase					(			self						):




							'''simple docstring'''

							UpperCAmelCase_							:       List[str]       =				Path('src/transformers'						)
							UpperCAmelCase_							:       Optional[int]       =				['configuration', 'modeling', 'tokenization']
							self.analyze_directory(lowerCamelCase_				,		n_identifier=lowerCamelCase_						)






		def _UpperCamelCase					(			self						):




							'''simple docstring'''

							UpperCAmelCase_							:       Optional[int]       =				Path('docs/source'						)
							UpperCAmelCase_							:       Dict       =				['favicon.ico']
							self.analyze_directory(lowerCamelCase_				,		ignore_files=lowerCamelCase_				,		only_modules=lowerCamelCase_						)







'''simple docstring'''


def  _lowerCamelCase   (				lowerCamelCase_ :							str     ,					lowerCamelCase_ :							str = " "       ):



     """simple docstring"""





     UpperCAmelCase_							:       str       =				[]

     UpperCAmelCase_							:       List[Any]       =				0
     for index, char in enumerate(lowerCamelCase_       ):
          if char == separator:
               split_words.append(string[last_index:index]       )
               UpperCAmelCase_							:       Optional[Any]       =				index + 1
          elif index + 1 == len(lowerCamelCase_       ):
               split_words.append(string[last_index : index + 1]       )
     return split_words


if __name__ == "__main__":
 from doctest import testmod

 testmod()






