Skip to content

Commit 6b72cea

Browse files
committed
Fix mypy errors
1 parent 7575597 commit 6b72cea

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

pandas/tseries/offsets.py

+8-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,9 @@ def onOffset(self, dt):
577577

578578

579579
class BusinessHourMixin(BusinessMixin):
580+
start: List[dt_time]
581+
end: List[dt_time]
582+
n: int
580583

581584
def __init__(self, start='09:00', end='17:00', offset=timedelta(0)):
582585
# must be validated here to equality check
@@ -717,16 +720,15 @@ def _prev_opening_time(self, other: datetime) -> datetime:
717720
"""
718721
return self._next_opening_time(other, sign=-1)
719722

720-
def _get_business_hours_by_sec(self, start: datetime, end: datetime
721-
) -> int:
723+
def _get_business_hours_by_sec(self, start: dt_time, end: dt_time) -> int:
722724
"""
723725
Return business hours in a day by seconds.
724726
"""
725727
# create dummy datetime to calculate businesshours in a day
726728
dtstart = datetime(2014, 4, 1, start.hour, start.minute)
727729
day = 1 if start < end else 2
728730
until = datetime(2014, 4, day, end.hour, end.minute)
729-
return (until - dtstart).total_seconds()
731+
return int((until - dtstart).total_seconds())
730732

731733
@apply_wraps
732734
def rollback(self, dt: datetime) -> datetime:
@@ -771,6 +773,7 @@ def _get_closing_time(self, dt: datetime) -> datetime:
771773
if st.hour == dt.hour and st.minute == dt.minute:
772774
return dt + timedelta(
773775
seconds=self._get_business_hours_by_sec(st, self.end[i]))
776+
assert False
774777

775778
@apply_wraps
776779
def apply(self, other):

0 commit comments

Comments
 (0)