Skip to content

Commit

Permalink
Minor style fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
dkess committed Feb 3, 2019
1 parent 837ea1d commit 3429154
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions ocflib/lab/hours2.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,9 @@ def _parse_regular_hours(regular):
"""
out = {}
for weekday, hours in regular.items():
try:
# First see if it's an int already
if isinstance(weekday, int):
weekday = Weekday(weekday)
except ValueError:
else:
# Convert strings ('Monday') to int (0)
weekday = getattr(Weekday, weekday)

Expand Down Expand Up @@ -108,7 +107,7 @@ def _parse_holiday(holiday):
start = end = holiday['date']
else:
raise ValueError(
'Holiday date is not a (start, end) pair or single datetime'
'Holiday date is not a [start, end] pair or single datetime'
)

return Holiday(
Expand Down Expand Up @@ -148,7 +147,7 @@ def hours_on_date(self, when=None):
If not provided, when defaults to today.
"""
if not when:
if when is None:
when = date.today()

if not isinstance(when, date):
Expand All @@ -166,7 +165,7 @@ def is_open(self, when=None):
If not provided, when defaults to now.
"""
if not when:
if when is None:
when = datetime.now()

if not isinstance(when, datetime):
Expand All @@ -184,7 +183,7 @@ def time_to_open(self, when=None):
If not provided, when defaults to now.
"""
if not when:
if when is None:
when = datetime.now()

if not isinstance(when, datetime):
Expand Down Expand Up @@ -219,7 +218,7 @@ def time_to_close(self, when=None):
If not provided, when defaults to now.
"""
if not when:
if when is None:
when = datetime.now()

if not isinstance(when, datetime):
Expand Down

0 comments on commit 3429154

Please sign in to comment.