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


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


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


      def 		_UpperCAmelCase       (   self		,			a		,			a = None		,			a = None		,			a = None		,			a = True		,			)       ->					int:
             lowercase__			:		Any       =	[file for file in os.listdir(a							) if os.path.isfile(os.path.join(a		,			a							)							)]

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

             if n_identifier is not None:
                    if isinstance(a		,			a							):
                           for n_ in n_identifier:
                                  lowercase__			:		Tuple       =	[file for file in files if n_ not in file]
                    else:
                           lowercase__			:		int       =	[file for file in files if n_identifier not in file]

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

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

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


      def 		_UpperCAmelCase       (   self							)       ->					int:
             lowercase__			:		List[str]       =	Path('src/transformers'							)
             lowercase__			:		str       =	'modeling'
             lowercase__			:		int       =	[
                 'modeling_ctrl.py',
                 'modeling_tf_ctrl.py',
             ]
             self.analyze_directory(a		,			identifier=a		,			ignore_files=a							)


      def 		_UpperCAmelCase       (   self							)       ->					Dict:
             lowercase__			:		Any       =	Path('src/transformers'							)
             lowercase__			:		int       =	'tokenization'
             self.analyze_directory(a		,			identifier=a							)


      def 		_UpperCAmelCase       (   self							)       ->					str:
             lowercase__			:		Dict       =	Path('src/transformers'							)
             lowercase__			:		str       =	'configuration'
             self.analyze_directory(a		,			identifier=a							)


      def 		_UpperCAmelCase       (   self							)       ->					List[Any]:
             lowercase__			:		List[Any]       =	Path('src/transformers'							)
             lowercase__			:		Dict       =	['configuration', 'modeling', 'tokenization']
             self.analyze_directory(a		,			n_identifier=a							)


      def 		_UpperCAmelCase       (   self							)       ->					Optional[int]:
             lowercase__			:		List[str]       =	Path('docs/source'							)
             lowercase__			:		str       =	['favicon.ico']
             self.analyze_directory(a		,			ignore_files=a		,			only_modules=a							)



from argparse import ArgumentParser

from .add_new_model import AddNewModelCommand
from .add_new_model_like import AddNewModelLikeCommand
from .convert import ConvertCommand
from .download import DownloadCommand
from .env import EnvironmentCommand
from .lfs import LfsCommands
from .pt_to_tf import PTtoTFCommand
from .run import RunCommand
from .serving import ServeCommand
from .user import UserCommands






def    lowerCamelCase__				(				):




			"""simple docstring"""


			lowerCAmelCase_						=	ArgumentParser("Transformers CLI tool"    ,							usage="transformers-cli <command> [<args>]"				)
			lowerCAmelCase_						=	parser.add_subparsers(help="transformers-cli command helpers"				)

			# Register commands
			ConvertCommand.register_subcommand(__lowerCAmelCase				)
			DownloadCommand.register_subcommand(__lowerCAmelCase				)
			EnvironmentCommand.register_subcommand(__lowerCAmelCase				)
			RunCommand.register_subcommand(__lowerCAmelCase				)
			ServeCommand.register_subcommand(__lowerCAmelCase				)
			UserCommands.register_subcommand(__lowerCAmelCase				)
			AddNewModelCommand.register_subcommand(__lowerCAmelCase				)
			AddNewModelLikeCommand.register_subcommand(__lowerCAmelCase				)
			LfsCommands.register_subcommand(__lowerCAmelCase				)
			PTtoTFCommand.register_subcommand(__lowerCAmelCase				)

			# Let's go
			lowerCAmelCase_						=	parser.parse_args()

			if not hasattr(__lowerCAmelCase    ,							"func"				):
						parser.print_help()
						exit(1				)

			# Run
			lowerCAmelCase_						=	args.func(__lowerCAmelCase				)
			service.run()


if __name__ == "__main__":
			main()



