Skip to content

Commit 8fe33c9

Browse files
gwromejreback
authored andcommitted
Fix type annotations in pandas.core.base (#26297)
1 parent 94c8c94 commit 8fe33c9

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

mypy.ini

-3
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,6 @@ ignore_errors=True
88
[mypy-pandas.core.api]
99
ignore_errors=True
1010

11-
[mypy-pandas.core.base]
12-
ignore_errors=True
13-
1411
[mypy-pandas.core.computation.expr]
1512
ignore_errors=True
1613

pandas/core/base.py

+8-2
Original file line numberDiff line numberDiff line change
@@ -837,7 +837,10 @@ def array(self) -> ExtensionArray:
837837
[a, b, a]
838838
Categories (2, object): [a, b]
839839
"""
840-
result = self._values
840+
# As a mixin, we depend on the mixing class having _values.
841+
# Special mixin syntax may be developed in the future:
842+
# https://github.com/python/typing/issues/246
843+
result = self._values # type: ignore
841844

842845
if is_datetime64_ns_dtype(result.dtype):
843846
from pandas.arrays import DatetimeArray
@@ -960,7 +963,10 @@ def _ndarray_values(self) -> np.ndarray:
960963
"""
961964
if is_extension_array_dtype(self):
962965
return self.array._ndarray_values
963-
return self.values
966+
# As a mixin, we depend on the mixing class having values.
967+
# Special mixin syntax may be developed in the future:
968+
# https://github.com/python/typing/issues/246
969+
return self.values # type: ignore
964970

965971
@property
966972
def empty(self):

0 commit comments

Comments
 (0)