-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcreate.py
More file actions
56 lines (44 loc) · 1.28 KB
/
create.py
File metadata and controls
56 lines (44 loc) · 1.28 KB
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
53
54
55
56
"""Simple module to generate grade.csv file"""
import argparse
from src.pd import PandasProcessing
from src.bs import BeautifulSoupProcessing
def main():
"""Main driver"""
parser = argparse.ArgumentParser()
parser.add_argument(
"--input",
required = True,
help = "Input text file"
)
parser.add_argument(
"--output",
required = True,
help = "Output csv file"
)
parser.add_argument(
"--pd",
action = argparse.BooleanOptionalAction,
help = "Using pandas - input must be a text file"
)
parser.add_argument(
"--bs",
action = argparse.BooleanOptionalAction,
help = "Using BeautifulSoup - input must be a saved html file"
)
args = parser.parse_args()
if args.pd is not None:
print("Preprocessing with Pandas")
creator = PandasProcessing(
input_file = args.input,
output_file = args.output
)
creator.process_and_write()
elif args.bs is not None:
print("Preprocessing with BeautifulSoup")
creator = BeautifulSoupProcessing(
input_file = args.input,
output_file = args.output
)
creator.process_and_write()
if __name__ == "__main__":
main()