Skip to content

TYP: fix mypy error in pandas/core/common.py #39106

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

Closed
wants to merge 1 commit into from

Conversation

ivanovmg
Copy link
Member

@ivanovmg ivanovmg commented Jan 11, 2021

Handle ignored mypy error in pandas/core/common.py.

"""
if isinstance(values, (list, np.ndarray, ABCIndex, ABCSeries, ABCExtensionArray)):
# np.ndarray resolving as Any gives a false positive
return values # type: ignore[return-value]
return cast(Union[List, AnyArrayLike], values)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment above indicates that this ignore can be removed after we have numpy types. no need to add cast yet. While numpy types resolve to Any and np.ndarray is part of AnyArrayLike we may have false positives.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, thank you for the clarification.
So, probably this PR should be closed?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the changes to the docstring are ok, but I'll close this for now.

@simonjayhawkins simonjayhawkins added the Typing type annotations, mypy/pyright type checking label Jan 11, 2021
@simonjayhawkins simonjayhawkins added this to the 1.3 milestone Jan 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Typing type annotations, mypy/pyright type checking
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants