Skip to content

Commit d620364

Browse files
committed
Be more explicit about documenting exceptions
1 parent 7696721 commit d620364

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

scrapers/fireroad.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,11 @@ def parse_timeslot(day, slot, pm):
3636
3737
Returns:
3838
* list[int]: The parsed day and timeslot
39+
40+
Raises AssertionError if pm and slot disagree on whether the slot is in the
41+
evening, or if the start slot is later than the end slot.
42+
43+
Raises KeyError if no matching timeslot could be found.
3944
"""
4045
assert pm == slot.endswith(" PM")
4146
slot = slot.rstrip(" PM")
@@ -68,6 +73,8 @@ def parse_section(section):
6873
6974
Returns:
7075
* list[Union[list[str], str]]: The parsed section.
76+
77+
Raises AssertionError or KeyError if parse_timeslot does.
7178
"""
7279
place, *infos = section.split("/")
7380
slots = []
@@ -91,6 +98,8 @@ def parse_schedule(course):
9198
9299
Returns:
93100
* dict[str, union[list, bool]: The parsed schedule
101+
102+
Raises AssertionError or KeyError if parse_section does.
94103
"""
95104
schedule = course["schedule"]
96105
section_tba = False

scrapers/utils.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,8 @@ def find_timeslot(day, slot, pm):
9999
100100
Returns:
101101
* int: A numeric code for the timeslot
102+
103+
Raises KeyError if no matching timeslot could be found.
102104
"""
103105
if pm:
104106
return DAYS[day] + EVE_TIMES[slot]

0 commit comments

Comments
 (0)