-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathapi.py
44 lines (33 loc) · 840 Bytes
/
api.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
from __future__ import print_function
from hTrust import hTrust
from sTrust import sTrust
#from MATRI import model as Matri
#from aeTrust import aeTrust
from mTrust import model as mTrust
import sys
usage = """
USAGE: python api.py <ALGORITHM_NAME>
Type of algorithm type can be:
- sTrust
- hTrust
"""
def show_usage():
print(usage)
sys.exit(1)
if __name__ == "__main__":
if len(sys.argv) != 2:
show_usage()
algo = sys.argv[1].lower()
if algo == "htrust":
hTrust.init_main()
elif algo == "strust":
sTrust.init_main()
elif algo == "matri":
Matri.init_main()
elif algo == 'aetrust':
aeTrust.main()
elif algo == 'mtrust':
mTrust.main()
else:
print("ERROR: invalid algorithm specified")
show_usage()