Skip to content

Commit

Permalink
Don't store dates of times and times of dates
Browse files Browse the repository at this point in the history
  • Loading branch information
pR0Ps committed Dec 6, 2014
1 parent 304c1d1 commit 5163410
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,12 +242,12 @@ def all_section_data(self):
"classes": [
{
'day_of_week': 1-7, starting with monday
'start_time': datetime object
'end_time': datetime object
'start_time': datetime.time object
'end_time': datetime.time object
'location': room
'instructors': [instructor names]
'term_start': datetime object
'term_end': datetime object
'term_start': datetime.date object
'term_end': datetime.date object
}, ...
]
}, ...
Expand Down Expand Up @@ -471,12 +471,12 @@ def section_attrs_at_index(self, index):
[
{
'day_of_week': 1-7, starting with monday, None for 'TBA' and other
'start_time': datetime object
'end_time': datetime object
'start_time': datetime.time object
'end_time': datetime.time object
'location': room
'instructors': [instructor names]
'term_start': datetime object
'term_end': datetime object
'term_start': datetime.date object
'term_end': datetime.date object
},
]
"""
Expand Down Expand Up @@ -528,14 +528,14 @@ def section_attrs_at_index(self, index):

# Class start/end times
m = self.TIME_INFO.search(values[x+1])
start_time = datetime.strptime(m.group(1), "%I:%M%p") if m else None
start_time = datetime.strptime(m.group(1), "%I:%M%p").time() if m else None
m = self.TIME_INFO.search(values[x+2])
end_time = datetime.strptime(m.group(1), "%I:%M%p") if m else None
end_time = datetime.strptime(m.group(1), "%I:%M%p").time() if m else None

# Class start/end dates
m = self.DATE_INFO.search(values[x+4])
term_start = datetime.strptime(m.group(1), "%Y/%m/%d") if m else None
term_end = datetime.strptime(m.group(2), "%Y/%m/%d") if m else None
term_start = datetime.strptime(m.group(1), "%Y/%m/%d").date() if m else None
term_end = datetime.strptime(m.group(2), "%Y/%m/%d").date() if m else None

sections = []

Expand Down

0 comments on commit 5163410

Please sign in to comment.