From 407f1908e5d91374fcc14f1e103b2d21f91466ec Mon Sep 17 00:00:00 2001 From: Gregory Rome Date: Mon, 6 May 2019 15:40:02 -0500 Subject: [PATCH] Fix type annotations in pandas.core.base --- mypy.ini | 3 --- pandas/core/base.py | 10 ++++++++-- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/mypy.ini b/mypy.ini index 63ccb6eb994ba..d59d20e10d571 100644 --- a/mypy.ini +++ b/mypy.ini @@ -8,9 +8,6 @@ ignore_errors=True [mypy-pandas.core.api] ignore_errors=True -[mypy-pandas.core.base] -ignore_errors=True - [mypy-pandas.core.computation.expr] ignore_errors=True diff --git a/pandas/core/base.py b/pandas/core/base.py index 21f1f5e79fab2..232962fef7255 100644 --- a/pandas/core/base.py +++ b/pandas/core/base.py @@ -837,7 +837,10 @@ def array(self) -> ExtensionArray: [a, b, a] Categories (2, object): [a, b] """ - result = self._values + # As a mixin, we depend on the mixing class having _values. + # Special mixin syntax may be developed in the future: + # https://github.com/python/typing/issues/246 + result = self._values # type: ignore if is_datetime64_ns_dtype(result.dtype): from pandas.arrays import DatetimeArray @@ -960,7 +963,10 @@ def _ndarray_values(self) -> np.ndarray: """ if is_extension_array_dtype(self): return self.array._ndarray_values - return self.values + # As a mixin, we depend on the mixing class having values. + # Special mixin syntax may be developed in the future: + # https://github.com/python/typing/issues/246 + return self.values # type: ignore @property def empty(self):