


from argparse import ArgumentParser

from datasets.commands.convert import ConvertCommand
from datasets.commands.dummy_data import DummyDataCommand
from datasets.commands.env import EnvironmentCommand
from datasets.commands.run_beam import RunBeamCommand
from datasets.commands.test import TestCommand
from datasets.utils.logging import set_verbosity_info





def 	_lowerCAmelCase       (    _lowerCAmelCase )						->	List[Any]:


						'''simple docstring'''






						return {key.lstrip("-" ): value for key, value in zip(unknown_args[::2]      ,	unknown_args[1::2] )}





def 	_lowerCAmelCase       (    )						->	List[Any]:


						'''simple docstring'''






						__snake_case				=		ArgumentParser(
						    "HuggingFace Datasets CLI tool"      ,	usage="datasets-cli <command> [<args>]"      ,	allow_abbrev=_lowerCAmelCase )
						__snake_case				=		parser.add_subparsers(help="datasets-cli command helpers" )
						set_verbosity_info()

						# Register commands
						ConvertCommand.register_subcommand(_lowerCAmelCase )
						EnvironmentCommand.register_subcommand(_lowerCAmelCase )
						TestCommand.register_subcommand(_lowerCAmelCase )
						RunBeamCommand.register_subcommand(_lowerCAmelCase )
						DummyDataCommand.register_subcommand(_lowerCAmelCase )

						# Parse args
						__snake_case		,					__snake_case				=		parser.parse_known_args()
						if not hasattr(_lowerCAmelCase      ,	"func" ):
												parser.print_help()
												exit(1 )
						__snake_case				=		parse_unknown_args(_lowerCAmelCase )

						# Run
						__snake_case				=		args.func(_lowerCAmelCase      ,	**_lowerCAmelCase )
						service.run()


if __name__ == "__main__":
	main()









def 	_lowerCAmelCase       (    _lowerCAmelCase )						->	int:


						'''simple docstring'''






						__snake_case				=		abs(_lowerCAmelCase )
						__snake_case				=		0
						while n > 0:
												res += n % 10
												n //= 10
						return res





def 	_lowerCAmelCase       (    _lowerCAmelCase )						->	int:


						'''simple docstring'''






						__snake_case				=		abs(_lowerCAmelCase )
						return n if n < 10 else n % 10 + sum_of_digits(n // 10 )





def 	_lowerCAmelCase       (    _lowerCAmelCase )						->	int:


						'''simple docstring'''






						return sum(int(_lowerCAmelCase ) for c in str(abs(_lowerCAmelCase ) ) )





def 	_lowerCAmelCase       (    )						->	None:


						'''simple docstring'''






						from collections.abc import Callable
						from timeit import timeit

						def benchmark_a_function(_lowerCAmelCase      ,	_lowerCAmelCase ) -> None:
												__snake_case				=		F'''{func.__name__}({value})'''
												__snake_case				=		timeit(F'''__main__.{call}'''      ,	setup="import __main__" )
												print(F'''{call:56} = {func(_lowerCAmelCase )} -- {timing:.4f} seconds''' )

						for value in (26_2144, 1125_8999_0684_2624, 126_7650_6002_2822_9401_4967_0320_5376):
												for func in (sum_of_digits, sum_of_digits_recursion, sum_of_digits_compact):
																		benchmark_a_function(_lowerCAmelCase      ,	_lowerCAmelCase )
												print()


if __name__ == "__main__":
	import doctest

	doctest.testmod()
	benchmark()





