
"""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


lowerCamelCase__           =	logging.getLogger()




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

		def 							__lowerCamelCase							(   self ,	_SCREAMING_SNAKE_CASE ,	_SCREAMING_SNAKE_CASE = None ,	_SCREAMING_SNAKE_CASE = None ,	_SCREAMING_SNAKE_CASE = None ,	_SCREAMING_SNAKE_CASE = True ,	):
			__lowerCAmelCase    :		List[str]		    =   [file for file in os.listdir(_SCREAMING_SNAKE_CASE				) if os.path.isfile(os.path.join(_SCREAMING_SNAKE_CASE ,	_SCREAMING_SNAKE_CASE				)				)]

			if identifier is not None:
				__lowerCAmelCase    :		Optional[int]		    =   [file for file in files if identifier in file]

			if n_identifier is not None:
				if isinstance(_SCREAMING_SNAKE_CASE ,	_SCREAMING_SNAKE_CASE				):
					for n_ in n_identifier:
						__lowerCAmelCase    :		List[Any]		    =   [file for file in files if n_ not in file]
				else:
					__lowerCAmelCase    :		str		    =   [file for file in files if n_identifier not in file]

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

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

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

		def 							__lowerCamelCase							(   self				):
			__lowerCAmelCase    :		List[str]		    =   Path('src/transformers'				)
			__lowerCAmelCase    :		Optional[int]		    =   'modeling'
			__lowerCAmelCase    :		Optional[int]		    =   [
			    'modeling_ctrl.py',
			    'modeling_tf_ctrl.py',
			]
			self.analyze_directory(_SCREAMING_SNAKE_CASE ,	identifier=_SCREAMING_SNAKE_CASE ,	ignore_files=_SCREAMING_SNAKE_CASE				)

		def 							__lowerCamelCase							(   self				):
			__lowerCAmelCase    :		Dict		    =   Path('src/transformers'				)
			__lowerCAmelCase    :		List[Any]		    =   'tokenization'
			self.analyze_directory(_SCREAMING_SNAKE_CASE ,	identifier=_SCREAMING_SNAKE_CASE				)

		def 							__lowerCamelCase							(   self				):
			__lowerCAmelCase    :		int		    =   Path('src/transformers'				)
			__lowerCAmelCase    :		Optional[Any]		    =   'configuration'
			self.analyze_directory(_SCREAMING_SNAKE_CASE ,	identifier=_SCREAMING_SNAKE_CASE				)

		def 							__lowerCamelCase							(   self				):
			__lowerCAmelCase    :		Union[str, Any]		    =   Path('src/transformers'				)
			__lowerCAmelCase    :		List[Any]		    =   ['configuration', 'modeling', 'tokenization']
			self.analyze_directory(_SCREAMING_SNAKE_CASE ,	n_identifier=_SCREAMING_SNAKE_CASE				)







		def 							__lowerCamelCase							(   self				):
			__lowerCAmelCase    :		List[str]		    =   Path('docs/source'				)
			__lowerCAmelCase    :		Optional[int]		    =   ['favicon.ico']
			self.analyze_directory(_SCREAMING_SNAKE_CASE ,	ignore_files=_SCREAMING_SNAKE_CASE ,	only_modules=_SCREAMING_SNAKE_CASE				)

"""simple docstring"""







from .testing import (
    are_the_same_tensors,
    execute_subprocess_async,
    require_bnb,
    require_cpu,
    require_cuda,
    require_huggingface_suite,
    require_mps,
    require_multi_gpu,
    require_multi_xpu,
    require_safetensors,
    require_single_gpu,
    require_single_xpu,
    require_torch_min_version,
    require_tpu,
    require_xpu,
    skip,
    slow,
)
from .training import RegressionDataset, RegressionModel, RegressionModelaXPU


from .scripts import test_script, test_sync, test_ops  # isort: skip