Skip to content

Commit 6dae7ca

Browse files
committed
Changed typing of _cache variables
1 parent 845808b commit 6dae7ca

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

pandas/core/dtypes/dtypes.py

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -108,12 +108,10 @@ class PandasExtensionDtype(_DtypeOpsMixin):
108108
"""
109109
type = None # type: Any
110110
kind = None # type: Any
111-
"""
112-
The Any type annotations above are here only because mypy seems to have a
113-
problem dealing with with multiple inheritance from PandasExtensionDtype
114-
and ExtensionDtype's @properties in the subclasses below. Those subclasses
115-
are explicitly typed, as appropriate.
116-
"""
111+
# The Any type annotations above are here only because mypy seems to have a
112+
# problem dealing with with multiple inheritance from PandasExtensionDtype
113+
# and ExtensionDtype's @properties in the subclasses below. The kind and
114+
# type variables in those subclasses are explicitly typed below.
117115
subdtype = None
118116
str = None # type: Optional[builtins.str]
119117
num = 100
@@ -122,7 +120,7 @@ class PandasExtensionDtype(_DtypeOpsMixin):
122120
base = None
123121
isbuiltin = 0
124122
isnative = 0
125-
_cache = {} # type: Dict[builtins.str, object]
123+
_cache = {} # type: Dict[builtins.str, 'PandasExtensionDtype']
126124

127125
def __unicode__(self):
128126
return self.name
@@ -230,7 +228,7 @@ class CategoricalDtype(PandasExtensionDtype, ExtensionDtype):
230228
str = '|O08'
231229
base = np.dtype('O')
232230
_metadata = ('categories', 'ordered')
233-
_cache = {} # type: Dict[builtins.str, object]
231+
_cache = {} # type: Dict[builtins.str, PandasExtensionDtype]
234232

235233
def __init__(self, categories=None, ordered=None):
236234
self._finalize(categories, ordered, fastpath=False)
@@ -600,7 +598,7 @@ class DatetimeTZDtype(PandasExtensionDtype, ExtensionDtype):
600598
na_value = NaT
601599
_metadata = ('unit', 'tz')
602600
_match = re.compile(r"(datetime64|M8)\[(?P<unit>.+), (?P<tz>.+)\]")
603-
_cache = {} # type: Dict[builtins.str, object]
601+
_cache = {} # type: Dict[builtins.str, PandasExtensionDtype]
604602

605603
def __init__(self, unit="ns", tz=None):
606604
"""
@@ -751,7 +749,7 @@ class PeriodDtype(ExtensionDtype, PandasExtensionDtype):
751749
num = 102
752750
_metadata = ('freq',)
753751
_match = re.compile(r"(P|p)eriod\[(?P<freq>.+)\]")
754-
_cache = {} # type: Dict[builtins.str, object]
752+
_cache = {} # type: Dict[builtins.str, PandasExtensionDtype]
755753

756754
def __new__(cls, freq=None):
757755
"""
@@ -874,7 +872,7 @@ class IntervalDtype(PandasExtensionDtype, ExtensionDtype):
874872
num = 103
875873
_metadata = ('subtype',)
876874
_match = re.compile(r"(I|i)nterval\[(?P<subtype>.+)\]")
877-
_cache = {} # type: Dict[builtins.str, object]
875+
_cache = {} # type: Dict[builtins.str, PandasExtensionDtype]
878876

879877
def __new__(cls, subtype=None):
880878
"""

0 commit comments

Comments
 (0)