forked from tcecspectator/mytcecgui
-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy path__main__.py
52 lines (41 loc) · 1.14 KB
/
__main__.py
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
41
42
43
44
45
46
47
48
49
50
51
52
# coding: utf-8
# @author octopoulo <[email protected]>
# @version 2021-01-05
"""
Main
"""
from argparse import ArgumentParser
import os
from time import time
from commoner import create_group
from download_json import download_json
from sync import add_arguments_sync, main_sync
from util import add_arguments_util, main_util
def main():
"""Main
"""
parser = ArgumentParser(description='TCEC', prog='python __main__.py')
add = create_group(parser, 'tcec')
add('--download', action='store_true', help='download JSON files')
add_arguments_util(parser)
add_arguments_sync(parser)
# configure args
args = parser.parse_args()
args_dict = vars(args)
args_set = set(item for item, value in args_dict.items() if value)
if args.download:
download_json()
# utils
if args_set & {'inspector'}:
main_util(parser)
elif args.inspector:
from inspector import Inspect
inspector = Inspect()
inspector.go()
# sync
elif args.sync:
main_sync(parser)
if __name__ == '__main__':
start = time()
main()
print(f'\nELAPSED: {time() - start:.3f} seconds')