-
Notifications
You must be signed in to change notification settings - Fork 3
/
main.py
32 lines (24 loc) · 899 Bytes
/
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
from strucscan.core.jobmanager import JobManager
import sys
import yaml
class strucscan:
def __init__(self):
cmdarg = sys.argv[:]
if len(cmdarg) == 1:
print("Please specify an input file: strucscan input.yaml")
sys.exit(0)
else:
inputfile = cmdarg[1]
input_dict = read_input(inputfile)
JobManager(input_dict)
def read_input(inputfile):
def str_presenter(dumper, data):
if len(data.splitlines()) > 1: # check for multiline string
return dumper.represent_scalar('tag:yaml.org,2002:str', data, style='|')
return dumper.represent_scalar('tag:yaml.org,2002:str', data)
yaml.add_representer(str, str_presenter)
with open(inputfile, "r") as stream:
input_dict = yaml.safe_load(stream)
return input_dict
if __name__ == "__main__":
struc = strucscan()