Skip to content

TYP: some types for pandas/core/arrays/sparse/dtype.py #29899

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

Conversation

simonjayhawkins
Copy link
Member

broken off #28339

@simonjayhawkins simonjayhawkins added the Typing type annotations, mypy/pyright type checking label Nov 27, 2019
@@ -223,7 +223,7 @@ def construct_from_string(cls, string):
raise TypeError(msg)

@staticmethod
def _parse_subtype(dtype):
def _parse_subtype(dtype) -> Tuple[str, Union[str, bool]]:
Copy link
Member

Choose a reason for hiding this comment

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

not necessarily for this PR, but the Union[str, bool] is kind of weird. maybe split into separate return values with clearer types?

Copy link
Member

Choose a reason for hiding this comment

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

can dtype be typed as str?

Copy link
Member Author

Choose a reason for hiding this comment

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

maybe we could cast has_fill_value to bool before returning. cast as in the dynamic bool(...) sense not cast from typing?

@jbrockmendel
Copy link
Member

Pending typing dtype as str (or a reason why we cant/shouldnt), LGTM

@simonjayhawkins simonjayhawkins added this to the 1.0 milestone Nov 27, 2019
@WillAyd WillAyd merged commit 29fdc69 into pandas-dev:master Nov 29, 2019
@WillAyd
Copy link
Member

WillAyd commented Nov 29, 2019

Thanks !

@simonjayhawkins simonjayhawkins deleted the pandas/core/arrays/sparse/dtype.py branch December 1, 2019 13:21
proost pushed a commit to proost/pandas that referenced this pull request Dec 19, 2019
proost pushed a commit to proost/pandas that referenced this pull request Dec 19, 2019
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.

3 participants