@@ -86,7 +86,7 @@ class PandasExtensionDtype(ExtensionDtype):
86
86
base : Optional [DtypeObj ] = None
87
87
isbuiltin = 0
88
88
isnative = 0
89
- _cache : Dict [str_type , PandasExtensionDtype ] = {}
89
+ _cache_dtypes : Dict [str_type , PandasExtensionDtype ] = {}
90
90
91
91
def __str__ (self ) -> str_type :
92
92
"""
@@ -110,7 +110,7 @@ def __getstate__(self) -> Dict[str_type, Any]:
110
110
@classmethod
111
111
def reset_cache (cls ) -> None :
112
112
""" clear the cache """
113
- cls ._cache = {}
113
+ cls ._cache_dtypes = {}
114
114
115
115
116
116
class CategoricalDtypeType (type ):
@@ -182,7 +182,7 @@ class CategoricalDtype(PandasExtensionDtype, ExtensionDtype):
182
182
str = "|O08"
183
183
base = np .dtype ("O" )
184
184
_metadata = ("categories" , "ordered" )
185
- _cache : Dict [str_type , PandasExtensionDtype ] = {}
185
+ _cache_dtypes : Dict [str_type , PandasExtensionDtype ] = {}
186
186
187
187
def __init__ (self , categories = None , ordered : Ordered = False ):
188
188
self ._finalize (categories , ordered , fastpath = False )
@@ -678,7 +678,7 @@ class DatetimeTZDtype(PandasExtensionDtype):
678
678
na_value = NaT
679
679
_metadata = ("unit" , "tz" )
680
680
_match = re .compile (r"(datetime64|M8)\[(?P<unit>.+), (?P<tz>.+)\]" )
681
- _cache : Dict [str_type , PandasExtensionDtype ] = {}
681
+ _cache_dtypes : Dict [str_type , PandasExtensionDtype ] = {}
682
682
683
683
def __init__ (self , unit : Union [str_type , DatetimeTZDtype ] = "ns" , tz = None ):
684
684
if isinstance (unit , DatetimeTZDtype ):
@@ -844,7 +844,7 @@ class PeriodDtype(dtypes.PeriodDtypeBase, PandasExtensionDtype):
844
844
num = 102
845
845
_metadata = ("freq" ,)
846
846
_match = re .compile (r"(P|p)eriod\[(?P<freq>.+)\]" )
847
- _cache : Dict [str_type , PandasExtensionDtype ] = {}
847
+ _cache_dtypes : Dict [str_type , PandasExtensionDtype ] = {}
848
848
849
849
def __new__ (cls , freq = None ):
850
850
"""
@@ -866,12 +866,12 @@ def __new__(cls, freq=None):
866
866
freq = cls ._parse_dtype_strict (freq )
867
867
868
868
try :
869
- return cls ._cache [freq .freqstr ]
869
+ return cls ._cache_dtypes [freq .freqstr ]
870
870
except KeyError :
871
871
dtype_code = freq ._period_dtype_code
872
872
u = dtypes .PeriodDtypeBase .__new__ (cls , dtype_code )
873
873
u ._freq = freq
874
- cls ._cache [freq .freqstr ] = u
874
+ cls ._cache_dtypes [freq .freqstr ] = u
875
875
return u
876
876
877
877
def __reduce__ (self ):
@@ -1049,7 +1049,7 @@ class IntervalDtype(PandasExtensionDtype):
1049
1049
_match = re .compile (
1050
1050
r"(I|i)nterval\[(?P<subtype>[^,]+)(, (?P<closed>(right|left|both|neither)))?\]"
1051
1051
)
1052
- _cache : Dict [str_type , PandasExtensionDtype ] = {}
1052
+ _cache_dtypes : Dict [str_type , PandasExtensionDtype ] = {}
1053
1053
1054
1054
def __new__ (cls , subtype = None , closed : Optional [str_type ] = None ):
1055
1055
from pandas .core .dtypes .common import (
@@ -1106,12 +1106,12 @@ def __new__(cls, subtype=None, closed: Optional[str_type] = None):
1106
1106
1107
1107
key = str (subtype ) + str (closed )
1108
1108
try :
1109
- return cls ._cache [key ]
1109
+ return cls ._cache_dtypes [key ]
1110
1110
except KeyError :
1111
1111
u = object .__new__ (cls )
1112
1112
u ._subtype = subtype
1113
1113
u ._closed = closed
1114
- cls ._cache [key ] = u
1114
+ cls ._cache_dtypes [key ] = u
1115
1115
return u
1116
1116
1117
1117
@property
0 commit comments