Repository: pandas-dev/pandas

Issue:
Fix type annotations in pandas.tseries.*
Part of #25882

pandas.tseries files currently have these errors:
```
pandas/tseries/frequencies.py:40: error: Need type annotation for '_offset_map'

pandas/tseries/holiday.py:332: error: Need type annotation for 'rules'

pandas/tseries/offsets.py:1656: error: Incompatible types in assignment (expression has type "int", base class "QuarterOffset" defined the type as "None")
pandas/tseries/offsets.py:1657: error: Incompatible types in assignment (expression has type "int", base class "QuarterOffset" defined the type as "None")
pandas/tseries/offsets.py:1666: error: Incompatible types in assignment (expression has type "int", base class "QuarterOffset" defined the type as "None")
pandas/tseries/offsets.py:1667: error: Incompatible types in assignment (expression has type "int", base class "QuarterOffset" defined the type as "None")
pandas/tseries/offsets.py:1681: error: Incompatible types in assignment (expression has type "int", base class "QuarterOffset" defined the type as "None")
pandas/tseries/offsets.py:1688: error: Incompatible types in assignment (expression has type "int", base class "QuarterOffset" defined the type as "None")
pandas/tseries/offsets.py:1689: error: Incompatible types in assignment (expression has type "int", base class "QuarterOffset" defined the type as "None")
```
I have added annotations to address these issues and removed the modules from mypy.ini. PR to follow presently.


Discussion:

Resolving patch:
diff --git a/pandas/tseries/frequencies.py b/pandas/tseries/frequencies.py
--- a/pandas/tseries/frequencies.py
+++ b/pandas/tseries/frequencies.py
@@ -1,6 +1,7 @@
 # -*- coding: utf-8 -*-
 from datetime import timedelta
 import re
+from typing import Dict
 
 import numpy as np
 from pytz import AmbiguousTimeError
@@ -37,7 +38,7 @@
 # Offset names ("time rules") and related functions
 
 #: cache of previously seen offsets
-_offset_map = {}
+_offset_map = {}  # type: Dict[str, DateOffset]
 
 
 def get_period_alias(offset_str):
diff --git a/pandas/tseries/holiday.py b/pandas/tseries/holiday.py
--- a/pandas/tseries/holiday.py
+++ b/pandas/tseries/holiday.py
@@ -1,4 +1,5 @@
 from datetime import datetime, timedelta
+from typing import List
 import warnings
 
 from dateutil.relativedelta import FR, MO, SA, SU, TH, TU, WE  # noqa
@@ -329,7 +330,7 @@ class AbstractHolidayCalendar(object):
     Abstract interface to create holidays following certain rules.
     """
     __metaclass__ = HolidayCalendarMetaClass
-    rules = []
+    rules = []  # type: List[Holiday]
     start_date = Timestamp(datetime(1970, 1, 1))
     end_date = Timestamp(datetime(2030, 12, 31))
     _cache = None
diff --git a/pandas/tseries/offsets.py b/pandas/tseries/offsets.py
--- a/pandas/tseries/offsets.py
+++ b/pandas/tseries/offsets.py
@@ -2,6 +2,7 @@
 from datetime import date, datetime, timedelta
 import functools
 import operator
+from typing import Optional
 
 from dateutil.easter import easter
 import numpy as np
@@ -1582,8 +1583,8 @@ class QuarterOffset(DateOffset):
     """
     Quarter representation - doesn't call super.
     """
-    _default_startingMonth = None
-    _from_name_startingMonth = None
+    _default_startingMonth = None  # type: Optional[int]
+    _from_name_startingMonth = None   # type: Optional[int]
     _adjust_dst = True
     _attributes = frozenset(['n', 'normalize', 'startingMonth'])
     # TODO: Consider combining QuarterOffset and YearOffset __init__ at some


Test patch: