continue step 4

This commit is contained in:
SowinskiBraeden committed 2022-04-21 13:58:37 -07:00
1 parent 3f9511e77a
commit 22c87ee1de
3 files changed
+24 -14

No files matched your search

+2 -2
View File
@@ -5,7 +5,7 @@ import csv
realCourses = {}
# Get all courses from real sample data
def getSampleCourses(data_dir, log=False):
def getSampleCourses(data_dir, log=False) -> dict:
with open(data_dir, newline='') as csvfile:
reader = csv.DictReader(csvfile)
for row in reader:
@@ -30,7 +30,7 @@ def getSampleCourses(data_dir, log=False):
if __name__ == '__main__':
courseSet = getSampleCourses("../sample_data/course_selection_data.csv")
courseSet: dict = getSampleCourses("../sample_data/course_selection_data.csv")
with open("../output/realCourses.json", "w") as outfile:
json.dump(courseSet, outfile, indent=2)
+5 -5
View File
@@ -6,10 +6,10 @@ import csv
import sys
from util.courses import mockCourses
mockStudents = []
mockStudents: list[dict] = []
# Generate n students for mock data
def generateMockStudents(n):
def generateMockStudents(n: int) -> list[dict]:
for _ in range(n):
newStudent = {
"name": names.get_full_name(),
@@ -36,7 +36,7 @@ def generateMockStudents(n):
# sort real sample data into usable dictionary
def getSampleStudents(data_dir, log=False):
def getSampleStudents(data_dir: str, log: bool = False) -> list[dict]:
with open(data_dir, newline='') as csvfile:
reader = csv.DictReader(csvfile)
for row in reader:
@@ -87,12 +87,12 @@ if __name__ == '__main__':
print("Missing argument")
exit()
if sys.argv[1].lower() == 'sample':
studentRequests = getSampleStudents("../sample_data/course_selection_data.csv")
studentRequests: list[dict] = getSampleStudents("../sample_data/course_selection_data.csv")
with open("../output/students.json", "w") as outfile:
json.dump(studentRequests, outfile, indent=2)
elif sys.argv[1].lower() == 'mock':
studentRequests = generateMockStudents(400)
studentRequests: list[dict] = generateMockStudents(400)
with open("../output/students.json", "w") as outfile:
json.dump(studentRequests, outfile, indent=2)