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
import json
with open('./output/students.json') as f: students = json.load(f)
Regular → Executable
+6 -3
View File
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3.11
import json
import random
from inspect import currentframe
@@ -589,7 +589,7 @@ def generateScheduleV3(
return running
if __name__ == '__main__':
def main():
print("Processing...")
sampleStudents = getSampleStudents(True)
@@ -601,4 +601,7 @@ if __name__ == '__main__':
with open("../output/timetable.json", "w") as outfile:
json.dump(timetable, outfile, indent=2)
print("Done")
print("Done")
if __name__ == '__main__':
main()
Regular → Executable
+5 -4
View File
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3.113.11
from os.path import exists as file_exists
from prettytable import PrettyTable
from typing import Tuple
@@ -53,15 +53,14 @@ def errorOutput(students) -> Tuple[PrettyTable, dict, dict]:
return t, conflicts["Critical"], conflicts["Acceptable"]
if __name__ == '__main__':
def main():
showError = False
noAnim = False
for e in sys.argv:
if e.lower().replace('_', '') == 'showerror': showError = True
if e.lower().replace('_', '') == 'noanim': noAnim = True
if len(sys.argv) in (1, 2) and sys.argv[1].lower() not in ('no_refresh', 'errors'):
if (len(sys.argv) > 1 and sys.argv[1] not in ('no_refresh', 'errors')) or len(sys.argv) == 1:
print()
st = time() # Start time
@@ -185,3 +184,5 @@ if __name__ == '__main__':
print("Invalid argument")
exit()
if __name__ == '__main__':
main()
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()