MCPcopy Index your code
hub / github.com/PaddlePaddle/PaddleOCR / ArgsParser

Class ArgsParser

tools/program.py:44–72  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

42
43
44class ArgsParser(ArgumentParser):
45 def __init__(self):
46 super(ArgsParser, self).__init__(formatter_class=RawDescriptionHelpFormatter)
47 self.add_argument("-c", "--config", help="configuration file to use")
48 self.add_argument("-o", "--opt", nargs="+", help="set configuration options")
49 self.add_argument(
50 "-p",
51 "--profiler_options",
52 type=str,
53 default=None,
54 help="The option of profiler, which should be in format "
55 '"key1=value1;key2=value2;key3=value3".',
56 )
57
58 def parse_args(self, argv=None):
59 args = super(ArgsParser, self).parse_args(argv)
60 assert args.config is not None, "Please specify --config=configure_file_path."
61 args.opt = self._parse_opt(args.opt)
62 return args
63
64 def _parse_opt(self, opts):
65 config = {}
66 if not opts:
67 return config
68 for s in opts:
69 s = s.strip()
70 k, v = s.split("=")
71 config[k] = yaml.load(v, Loader=yaml.SafeLoader)
72 return config
73
74
75def load_config(file_path):

Callers 3

mainFunction · 0.90
mainFunction · 0.90
preprocessFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…