-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathfile_init.py
More file actions
35 lines (26 loc) · 873 Bytes
/
file_init.py
File metadata and controls
35 lines (26 loc) · 873 Bytes
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
# This file is meant take in a csv and parse it into a string
import hash_generator
def run(argv, func):
address = argv # set address to be the first parameter
# should not execute if file address is not a valid one
valid = False
try:
csv = open(address, 'r')
valid = True
except IOError:
print("File does not exist; ")
valid = False
if not valid or not address.endswith(".csv"):
print("Invalid file")
exit(1)
str_csv = ""
for line in csv:
str_csv += line
# check which operation was selected
# if func == '1':
return hash_generator.run(str_csv, func)
# elif func == '2':
# print("Not yet") # will later return the result from linear regression
# else:
# print("Invalid argument, expected 1(Pairing) or 2(Expected Outcome)")
# exit(1)