Skip to content

Commit 606178a

Browse files
makbigcWillAyd
authored andcommitted
Remove pandas.core.index.datetimelike from MyPy Blacklist (#26280)
1 parent 2da4599 commit 606178a

File tree

4 files changed

+19
-17
lines changed

4 files changed

+19
-17
lines changed

mypy.ini

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,4 @@ ignore_missing_imports=True
33
follow_imports=silent
44

55
[mypy-pandas.conftest,pandas.tests.*]
6-
ignore_errors=True
7-
8-
[mypy-pandas.core.indexes.datetimelike]
9-
ignore_errors=True
6+
ignore_errors=True

pandas/core/algorithms.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
intended for public consumption
44
"""
55
from textwrap import dedent
6+
from typing import Dict
67
from warnings import catch_warnings, simplefilter, warn
78

89
import numpy as np
@@ -27,7 +28,7 @@
2728

2829
from pandas.core import common as com
2930

30-
_shared_docs = {}
31+
_shared_docs = {} # type: Dict[str, str]
3132

3233

3334
# --------------- #

pandas/core/arrays/base.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
without warning.
77
"""
88
import operator
9-
from typing import Any, Callable, Optional, Sequence, Tuple, Union
9+
from typing import Any, Callable, Dict, Optional, Sequence, Tuple, Union
1010

1111
import numpy as np
1212

@@ -26,7 +26,7 @@
2626

2727
_not_implemented_message = "{} does not implement {}."
2828

29-
_extension_array_shared_docs = dict()
29+
_extension_array_shared_docs = dict() # type: Dict[str, str]
3030

3131

3232
class ExtensionArray:

pandas/core/indexes/datetimelike.py

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
Base and utility classes for tseries type pandas objects.
33
"""
44
import operator
5+
from typing import Set
56
import warnings
67

78
import numpy as np
@@ -62,14 +63,17 @@ class DatetimeIndexOpsMixin(ExtensionOpsMixin):
6263
# DatetimeLikeArrayMixin assumes subclasses are mutable, so these are
6364
# properties there. They can be made into cache_readonly for Index
6465
# subclasses bc they are immutable
65-
inferred_freq = cache_readonly(DatetimeLikeArrayMixin.inferred_freq.fget)
66-
_isnan = cache_readonly(DatetimeLikeArrayMixin._isnan.fget)
67-
hasnans = cache_readonly(DatetimeLikeArrayMixin._hasnans.fget)
66+
inferred_freq = cache_readonly(
67+
DatetimeLikeArrayMixin.inferred_freq.fget) # type: ignore
68+
_isnan = cache_readonly(DatetimeLikeArrayMixin._isnan.fget) # type: ignore
69+
hasnans = cache_readonly(
70+
DatetimeLikeArrayMixin._hasnans.fget) # type: ignore
6871
_hasnans = hasnans # for index / array -agnostic code
69-
_resolution = cache_readonly(DatetimeLikeArrayMixin._resolution.fget)
70-
resolution = cache_readonly(DatetimeLikeArrayMixin.resolution.fget)
72+
_resolution = cache_readonly(
73+
DatetimeLikeArrayMixin._resolution.fget) # type: ignore
74+
resolution = cache_readonly(
75+
DatetimeLikeArrayMixin.resolution.fget) # type: ignore
7176

72-
_box_values = ea_passthrough(DatetimeLikeArrayMixin._box_values)
7377
_maybe_mask_results = ea_passthrough(
7478
DatetimeLikeArrayMixin._maybe_mask_results)
7579
__iter__ = ea_passthrough(DatetimeLikeArrayMixin.__iter__)
@@ -131,11 +135,11 @@ def _ndarray_values(self):
131135
# Abstract data attributes
132136

133137
@property
134-
def values(self) -> np.ndarray:
138+
def values(self):
135139
# Note: PeriodArray overrides this to return an ndarray of objects.
136140
return self._data._data
137141

138-
@property
142+
@property # type: ignore # https://github.com/python/mypy/issues/1362
139143
@Appender(DatetimeLikeArrayMixin.asi8.__doc__)
140144
def asi8(self):
141145
return self._data.asi8
@@ -762,9 +766,9 @@ class DatetimelikeDelegateMixin(PandasDelegate):
762766
boxed in an index, after being returned from the array
763767
"""
764768
# raw_methods : dispatch methods that shouldn't be boxed in an Index
765-
_raw_methods = set()
769+
_raw_methods = set() # type: Set[str]
766770
# raw_properties : dispatch properties that shouldn't be boxed in an Index
767-
_raw_properties = set()
771+
_raw_properties = set() # type: Set[str]
768772
name = None
769773
_data = None
770774

0 commit comments

Comments
 (0)