Skip to content

Commit 202b8b8

Browse files
committed
linted and formatted files
1 parent 389ce71 commit 202b8b8

File tree

3 files changed

+54
-46
lines changed

3 files changed

+54
-46
lines changed

src/db.py

Lines changed: 42 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -99,29 +99,31 @@ def bulk_insert_instructors(cur: cursor, course: dict) -> list[int]:
9999
instructor_data = []
100100
instructor_names = []
101101
for instructor in course["instructors"]:
102-
instructor_data.append((
103-
instructor["name"],
102+
instructor_data.append(
104103
(
105-
instructor["rating"]["legacyId"]
106-
if instructor.get("rating", None) is not None
107-
else None
108-
),
109-
(
110-
instructor["rating"]["avgDifficulty"]
111-
if instructor.get("rating", None) is not None
112-
else None
113-
),
114-
(
115-
instructor["rating"]["avgRating"]
116-
if instructor.get("rating", None) is not None
117-
else None
118-
),
119-
(
120-
instructor["rating"]["numRatings"]
121-
if instructor.get("rating", None) is not None
122-
else None
123-
),
124-
))
104+
instructor["name"],
105+
(
106+
instructor["rating"]["legacyId"]
107+
if instructor.get("rating", None) is not None
108+
else None
109+
),
110+
(
111+
instructor["rating"]["avgDifficulty"]
112+
if instructor.get("rating", None) is not None
113+
else None
114+
),
115+
(
116+
instructor["rating"]["avgRating"]
117+
if instructor.get("rating", None) is not None
118+
else None
119+
),
120+
(
121+
instructor["rating"]["numRatings"]
122+
if instructor.get("rating", None) is not None
123+
else None
124+
),
125+
)
126+
)
125127

126128
instructor_names.append(instructor["name"])
127129

@@ -153,22 +155,24 @@ def bulk_insert_instructors(cur: cursor, course: dict) -> list[int]:
153155
def bulk_insert_courses(cur: cursor, courses_data: list[dict]):
154156
courses = []
155157
for course in courses_data:
156-
courses.append((
157-
course["crn"],
158-
course["subject_code"],
159-
course["course_number"],
160-
course["instruction_type"],
161-
course["instruction_method"],
162-
course["section"],
163-
course["enroll"],
164-
course["max_enroll"],
165-
course["course_title"],
166-
course["credits"],
167-
course["prereqs"],
168-
course["start_time"],
169-
course["end_time"],
170-
course["days"],
171-
))
158+
courses.append(
159+
(
160+
course["crn"],
161+
course["subject_code"],
162+
course["course_number"],
163+
course["instruction_type"],
164+
course["instruction_method"],
165+
course["section"],
166+
course["enroll"],
167+
course["max_enroll"],
168+
course["course_title"],
169+
course["credits"],
170+
course["prereqs"],
171+
course["start_time"],
172+
course["end_time"],
173+
course["days"],
174+
)
175+
)
172176

173177
cur.executemany(
174178
"""

src/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ def main(args: argparse.Namespace):
6666
if not os.path.exists("performance"):
6767
os.makedirs("performance")
6868
cProfile.run("main(args)", "performance/profile_output.pstat")
69-
except Exception as e:
69+
except Exception:
7070
trace = traceback.format_exc()
7171
print(trace)
7272

src/parse.py

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -96,15 +96,19 @@ def get_instructors(
9696

9797
rating_obj = ratings_cache[name]
9898

99-
instructors.append({
100-
"name": name,
101-
"rating": rating_obj,
102-
})
99+
instructors.append(
100+
{
101+
"name": name,
102+
"rating": rating_obj,
103+
}
104+
)
103105

104106
else:
105-
instructors.append({
106-
"name": name,
107-
})
107+
instructors.append(
108+
{
109+
"name": name,
110+
}
111+
)
108112

109113
return instructors
110114

0 commit comments

Comments
 (0)