




'''simple docstring'''




import unittest

from transformers import load_tool

from .test_tools_common import ToolTesterMixin


class   __UpperCamelCase       ( unittest.TestCase			,					lowerCamelCase__				):






       def      lowercase__     (							self  ):



              """simple docstring"""







              lowerCamelCase_							=load_tool('''text-classification'''  )
              self.tool.setup()
              lowerCamelCase_							=load_tool('''text-classification''',		remote=lowerCAmelCase  )






       def      lowercase__     (							self  ):



              """simple docstring"""







              lowerCamelCase_							=self.tool('''That\'s quite cool''',		['''positive''', '''negative''']  )
              self.assertEqual(lowerCAmelCase,		'''positive'''  )






       def      lowercase__     (							self  ):



              """simple docstring"""







              lowerCamelCase_							=self.remote_tool('''That\'s quite cool''',		['''positive''', '''negative''']  )
              self.assertEqual(lowerCAmelCase,		'''positive'''  )






       def      lowercase__     (							self  ):



              """simple docstring"""







              lowerCamelCase_							=self.tool(text='''That\'s quite cool''',		labels=['''positive''', '''negative''']  )
              self.assertEqual(lowerCAmelCase,		'''positive'''  )






       def      lowercase__     (							self  ):



              """simple docstring"""







              lowerCamelCase_							=self.remote_tool(text='''That\'s quite cool''',		labels=['''positive''', '''negative''']  )
              self.assertEqual(lowerCAmelCase,		'''positive'''  )










'''simple docstring'''







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 						snake_case_							(_a	:							Tuple     ):
    return {key.lstrip('''-'''     ): value for key, value in zip(unknown_args[::2]    ,   unknown_args[1::2]     )}





def 						snake_case_							():
    UpperCAmelCase			       =		ArgumentParser(
        '''HuggingFace Datasets CLI tool'''    ,   usage='''datasets-cli <command> [<args>]'''    ,   allow_abbrev=_a     )
    UpperCAmelCase			       =		parser.add_subparsers(help='''datasets-cli command helpers'''     )
    set_verbosity_info()

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

    # Parse args
    UpperCAmelCase       ,     UpperCAmelCase			       =		parser.parse_known_args()
    if not hasattr(_a    ,   '''func'''     ):
        parser.print_help()
        exit(1     )
    UpperCAmelCase			       =		parse_unknown_args(_a     )

    # Run
    UpperCAmelCase			       =		args.func(_a    ,   **_a     )
    service.run()


if __name__ == "__main__":
   main()




