Skip to content

Commit 8427cbe

Browse files
committed
Fix mypy errors
1 parent 7575597 commit 8427cbe

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

pandas/tseries/offsets.py

+9-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
from datetime import date, datetime, timedelta
1+
from datetime import date, datetime, time as dt_time, timedelta
22
import functools
33
import operator
4-
from typing import Optional
4+
from typing import List, Optional
55

66
from dateutil.easter import easter
77
import numpy as np
@@ -577,6 +577,10 @@ def onOffset(self, dt):
577577

578578

579579
class BusinessHourMixin(BusinessMixin):
580+
start: List[dt_time]
581+
end: List[dt_time]
582+
offset: timedelta
583+
n: int
580584

581585
def __init__(self, start='09:00', end='17:00', offset=timedelta(0)):
582586
# must be validated here to equality check
@@ -717,16 +721,15 @@ def _prev_opening_time(self, other: datetime) -> datetime:
717721
"""
718722
return self._next_opening_time(other, sign=-1)
719723

720-
def _get_business_hours_by_sec(self, start: datetime, end: datetime
721-
) -> int:
724+
def _get_business_hours_by_sec(self, start: dt_time, end: dt_time) -> int:
722725
"""
723726
Return business hours in a day by seconds.
724727
"""
725728
# create dummy datetime to calculate businesshours in a day
726729
dtstart = datetime(2014, 4, 1, start.hour, start.minute)
727730
day = 1 if start < end else 2
728731
until = datetime(2014, 4, day, end.hour, end.minute)
729-
return (until - dtstart).total_seconds()
732+
return int((until - dtstart).total_seconds())
730733

731734
@apply_wraps
732735
def rollback(self, dt: datetime) -> datetime:
@@ -771,6 +774,7 @@ def _get_closing_time(self, dt: datetime) -> datetime:
771774
if st.hour == dt.hour and st.minute == dt.minute:
772775
return dt + timedelta(
773776
seconds=self._get_business_hours_by_sec(st, self.end[i]))
777+
assert False
774778

775779
@apply_wraps
776780
def apply(self, other):

0 commit comments

Comments
 (0)