

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


_lowerCAmelCase					:			int  				=			logging.getLogger()






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





			def 		__magic_name__    (		self					,  __snake_case					,  __snake_case = None					,  __snake_case = None					,  __snake_case = None					,  __snake_case = True					,  )   -> Any:




						'''simple docstring'''
						__a        =[file for file in os.listdir(__snake_case					) if os.path.isfile(os.path.join(__snake_case					,  __snake_case					)					)]

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

						if n_identifier is not None:
									if isinstance(__snake_case					,  __snake_case					):
												for n_ in n_identifier:
															__a        =[file for file in files if n_ not in file]
									else:
												__a        =[file for file in files if n_identifier not in file]

						__a        =ignore_files or []
						ignore_files.append('__init__.py'					)
						__a        =[file for file in files if file not in ignore_files]

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

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





			def 		__magic_name__    (		self					)   -> Tuple:




						'''simple docstring'''
						__a        =Path('src/transformers'					)
						__a        ='modeling'
						__a        =[
						    'modeling_ctrl.py',
						    'modeling_tf_ctrl.py',
						]
						self.analyze_directory(__snake_case					,  identifier=__snake_case					,  ignore_files=__snake_case					)





			def 		__magic_name__    (		self					)   -> Optional[int]:




						'''simple docstring'''
						__a        =Path('src/transformers'					)
						__a        ='tokenization'
						self.analyze_directory(__snake_case					,  identifier=__snake_case					)





			def 		__magic_name__    (		self					)   -> Any:




						'''simple docstring'''
						__a        =Path('src/transformers'					)
						__a        ='configuration'
						self.analyze_directory(__snake_case					,  identifier=__snake_case					)





			def 		__magic_name__    (		self					)   -> List[str]:




						'''simple docstring'''
						__a        =Path('src/transformers'					)
						__a        =['configuration', 'modeling', 'tokenization']
						self.analyze_directory(__snake_case					,  n_identifier=__snake_case					)





			def 		__magic_name__    (		self					)   -> Optional[int]:




						'''simple docstring'''
						__a        =Path('docs/source'					)
						__a        =['favicon.ico']
						self.analyze_directory(__snake_case					,  ignore_files=__snake_case					,  only_modules=__snake_case					)












"""simple docstring"""






def      _snake_case			(				lowercase__		):
				if not isinstance(lowercase__							,    lowercase__		):
								raise ValueError('Input series is not valid, valid series - [2, 4, 6]'		)
				if len(lowercase__		) == 0:
								raise ValueError('Input list must be a non empty list'		)
				if len(lowercase__		) == 1:
								return True
				_lowerCamelCase     :			List[Any]    =    series[1] - series[0]
				for index in range(len(lowercase__		) - 1		):
								if series[index + 1] - series[index] != common_diff:
												return False
				return True







def      _snake_case			(				lowercase__		):
				if not isinstance(lowercase__							,    lowercase__		):
								raise ValueError('Input series is not valid, valid series - [2, 4, 6]'		)
				if len(lowercase__		) == 0:
								raise ValueError('Input list must be a non empty list'		)
				_lowerCamelCase     :			Optional[int]    =    0
				for val in series:
								answer += val
				return answer / len(lowercase__		)


if __name__ == "__main__":
			import doctest

			doctest.testmod()