forked from johnsbuck/FAA-Rules-Phase-Calculator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
executable file
·36 lines (27 loc) · 907 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
33
34
35
36
# Usage: python main.py test.json
import json
import os.path
import sys
import module
def importJSONFile(filename):
'''Imports data from file specified in commandline argument 1
Parameters:
filename - Name of JSON file to be loaded.
Returns:
Python object based on JSON file
'''
data = json.load(file(filename))
# pprint(data)
return data
def callModule(data, time):
'''Calls module file and prints the phaseClassification and ruleClassification
Parameters:
data - JSON file containing information from aircraft.
'''
importedData = importJSONFile(data)
print module.phaseClassification(importedData, time) + ";" + \
module.ruleClassification(importedData, time)
# START OF SCRIPT
if len(sys.argv) >= 3:
if os.path.isfile(sys.argv[1]) and sys.argv[1].endswith('.json'):
callModule(sys.argv[1], sys.argv[2])