Skip to content

Commit 6de8133

Browse files
gwromeWillAyd
authored andcommitted
GH26013 Fix type annotations in pandas/tseries/* (#26014)
1 parent d2f9228 commit 6de8133

File tree

4 files changed

+7
-13
lines changed

4 files changed

+7
-13
lines changed

mypy.ini

-9
Original file line numberDiff line numberDiff line change
@@ -170,15 +170,6 @@ ignore_errors=True
170170
[mypy-pandas.plotting._core]
171171
ignore_errors=True
172172

173-
[mypy-pandas.tseries.frequencies]
174-
ignore_errors=True
175-
176-
[mypy-pandas.tseries.holiday]
177-
ignore_errors=True
178-
179-
[mypy-pandas.tseries.offsets]
180-
ignore_errors=True
181-
182173
[mypy-pandas.util._doctools]
183174
ignore_errors=True
184175

pandas/tseries/frequencies.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# -*- coding: utf-8 -*-
22
from datetime import timedelta
33
import re
4+
from typing import Dict
45

56
import numpy as np
67
from pytz import AmbiguousTimeError
@@ -37,7 +38,7 @@
3738
# Offset names ("time rules") and related functions
3839

3940
#: cache of previously seen offsets
40-
_offset_map = {}
41+
_offset_map = {} # type: Dict[str, DateOffset]
4142

4243

4344
def get_period_alias(offset_str):

pandas/tseries/holiday.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from datetime import datetime, timedelta
2+
from typing import List
23
import warnings
34

45
from dateutil.relativedelta import FR, MO, SA, SU, TH, TU, WE # noqa
@@ -329,7 +330,7 @@ class AbstractHolidayCalendar(object):
329330
Abstract interface to create holidays following certain rules.
330331
"""
331332
__metaclass__ = HolidayCalendarMetaClass
332-
rules = []
333+
rules = [] # type: List[Holiday]
333334
start_date = Timestamp(datetime(1970, 1, 1))
334335
end_date = Timestamp(datetime(2030, 12, 31))
335336
_cache = None

pandas/tseries/offsets.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
from datetime import date, datetime, timedelta
33
import functools
44
import operator
5+
from typing import Optional
56

67
from dateutil.easter import easter
78
import numpy as np
@@ -1582,8 +1583,8 @@ class QuarterOffset(DateOffset):
15821583
"""
15831584
Quarter representation - doesn't call super.
15841585
"""
1585-
_default_startingMonth = None
1586-
_from_name_startingMonth = None
1586+
_default_startingMonth = None # type: Optional[int]
1587+
_from_name_startingMonth = None # type: Optional[int]
15871588
_adjust_dst = True
15881589
_attributes = frozenset(['n', 'normalize', 'startingMonth'])
15891590
# TODO: Consider combining QuarterOffset and YearOffset __init__ at some

0 commit comments

Comments
 (0)