more linux compatible good practice stuff?

This commit is contained in:
SowinskiBraeden committed 2022-10-26 10:15:42 -07:00
1 parent 337dbac2db
commit bf09b095f3
7 files changed
+34 -23

No files matched your search

Regular → Executable
+1 -1
View File
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3.11
# Define global debug function
debug = lambda data : print(f'>> Debug: {data}') if type(data) == str else print('>> Debug: ', data)
Regular → Executable
+11 -8
View File
@@ -1,12 +1,6 @@
#!/usr/bin/env python
#!/usr/bin/env python3.11
import json
# Get students
try:
with open("../output/students.json", 'r') as studentFile: students = json.load(studentFile)
except FileNotFoundError:
with open("./output/students.json", 'r') as studentFile: students = json.load(studentFile)
flex = ("XAT--12A-S", "XAT--12B-S")
most_frequent = lambda l : max(set(l), key = l.count)
@@ -23,7 +17,13 @@ def getEstimatedGrade(pupil: dict) -> int:
return None if len(grades) == 0 else most_frequent(grades) # Final estimate of grade
if __name__ == '__main__':
def main():
# Get students
try:
with open("../output/students.json", 'r') as studentFile: students = json.load(studentFile)
except FileNotFoundError:
with open("./output/students.json", 'r') as studentFile: students = json.load(studentFile)
# Define students grade level
for student in students:
student["gradelevel"] = getEstimatedGrade(student)
@@ -33,3 +33,6 @@ if __name__ == '__main__':
except FileNotFoundError:
with open('./output/students/json', 'w') as studnetFile:
json.dump(students, studentFile, indent=2)
if __name__ == '__main__':
main()
Regular → Executable
+5 -3
View File
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3.11
import json
import csv
@@ -28,9 +28,11 @@ def getSampleCourses(data_dir, log=False) -> dict:
return realCourses
if __name__ == '__main__':
def main():
courseSet: dict = getSampleCourses("../sample_data/course_selection_data.csv")
with open("../output/courses.json", "w") as outfile:
json.dump(courseSet, outfile, indent=2)
if __name__ == '__main__':
main()
Regular → Executable
+5 -3
View File
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3.11
import json
import csv
from util.estimateGrade import getEstimatedGrade
@@ -63,11 +63,13 @@ def getSampleStudents(data_dir: str, log: bool = False) -> list[dict]:
return mockStudents
if __name__ == '__main__':
def main():
studentRequests: list[dict] = getSampleStudents("../sample_data/course_selection_data.csv")
with open("../output/students.json", "w") as outfile:
json.dump(studentRequests, outfile, indent=2)
print("done")
if __name__ == '__main__':
main()