-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun_python3_method.py
More file actions
executable file
·40 lines (36 loc) · 1.35 KB
/
run_python3_method.py
File metadata and controls
executable file
·40 lines (36 loc) · 1.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/usr/bin/env python3
import sys
# Own modules
from reverse_dict.argparser_builder import ArgParserBuilder
from reverse_dict.arguments import get_common_arguments
from reverse_dict.config import cfg
import reverse_dict.methods as methods
if __name__ == '__main__':
method_name = sys.argv[1]
method_class_name = cfg.methods[method_name]
method_class = methods.__getattribute__(method_class_name)
print("Method name: {}".format(method_name))
unknown = None
script_description = '''
%(prog)s v{}
{}
Github project @ {}
'''.format(cfg.version, method_class.__method_description__, cfg.github_url)
list_arguments = get_common_arguments()
parser_builder = ArgParserBuilder(prog=method_class.__method_name__+'.py',
script_description=script_description,
list_arguments=list_arguments)
parser = parser_builder.get_parser()
args, unknown = parser.parse_known_args()
args = args.__dict__
method = method_class(**args)
"""
print('Args: {}'.format(args))
if unknown is None:
print('Unused args: {}'.format(method.get_unused_kwargs()))
else:
print('Unknown args: {}'.format(unknown))
"""
print('Args: {}'.format(args))
print('Unknown args: {}'.format(unknown))
method.compute_avg_run_time()