Skip to content

Fix type annotations in pandas.core.base #26297

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 7, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions mypy.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
10 changes: 8 additions & 2 deletions pandas/core/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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):
Expand Down