Beispiel #1
0
def parse_arguments(argv):
    parser = argparse.ArgumentParser("deepspeech server")
    parser.add_argument(
        '--config', required=True,
        help="Path of the server configuration file")

    return argv.pipe(
        ops.skip(1),
        argparse.parse(parser),
    )
Beispiel #2
0
def parse_arguments(args, prog=None):
    parser = argparse.ArgumentParser(prog=prog)
    parser.add_argument(
        '--config', required=True,
        help="Path of the configuration file")

    return args.pipe(
        ops.skip(1),
        argparse.parse(parser),
    )
Beispiel #3
0
    def test_parse_bad_arg(self):
        parser = argparse.ArgumentParser("test_parse")
        parser.add_argument("--foo")

        actual_result = None

        def on_error(error):
            nonlocal actual_result
            actual_result = error

        args = rx.from_(["--bar", "barz"])
        args.pipe(argparse.parse(parser)).subscribe(on_error=on_error)
        self.assertIn("unrecognized arguments", actual_result)
Beispiel #4
0
    def test_parse(self):
        parser = argparse.ArgumentParser("test_parse")
        parser.add_argument("--foo")

        expected_result = [argparse.Argument(key="foo", value="fooz")]

        actual_result = None

        def set_result(i):
            nonlocal actual_result
            actual_result = i

        args = rx.from_(["--foo", "fooz"])
        args.pipe(argparse.parse(parser), ops.to_list()).subscribe(set_result)
        self.assertEqual(expected_result, actual_result)
Beispiel #5
0
def create_arg_parser():
    parser = argparse.ArgumentParser("audio encode server")
    parser.add_argument('--config',
                        required=True,
                        help="Path of the server configuration file")
    return parser
Beispiel #6
0
 def test_creation(self):
     parser = argparse.ArgumentParser("test_parse")
     parse = argparse.parse(parser)
     self.assertIsNotNone(parse)