10000 TYP: Fix typehints for ExtensionDtype by ozars · Pull Request #41097 · pandas-dev/pandas · GitHub
[go: up one dir, main page]

Skip to content

TYP: Fix typehints for ExtensionDtype #41097

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 2 commits into from
Apr 26, 2021
Merged
Changes from 1 commit
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
Prev Previous commit
Revert minor changes causing mypy issues
  • Loading branch information
ozars committed Apr 22, 2021
commit ac2e3e6570d19c31041b75244f6b3a9853d15f9e
9 changes: 4 additions & 5 deletions pandas/core/dtypes/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ def construct_array_type(cls) -> type_t[ExtensionArray]:
raise NotImplementedError

@classmethod
def construct_from_string(cls, string: str) -> ExtensionDtype:
def construct_from_string(cls, string: str):
r"""
Construct this type from a string.

Expand Down Expand Up @@ -424,7 +424,7 @@ def register(self, dtype: type[ExtensionDtype]) -> None:

self.dtypes.append(dtype)

def find(self, dtype: type[E] | E | str) -> type[E] | E | ExtensionDtype | None:
def find(self, dtype: type[ExtensionDtype] | str) -> type[ExtensionDtype] | None:
"""
Parameters
----------
Expand All @@ -435,9 +435,8 @@ def find(self, dtype: type[E] | E | str) -> type[E] | E | ExtensionDtype | None:
return the first matching dtype, otherwise return None
"""
if not isinstance(dtype, str):
if isinstance(dtype, type):
dtype_type = dtype
else:
dtype_type = dtype
if not isinstance(dtype, type):
dtype_type = type(dtype)
if issubclass(dtype_type, ExtensionDtype):
return dtype
Expand Down
0