Skip to content

TYP: annotate _data #29580

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 3 commits into from
Nov 13, 2019
Merged

TYP: annotate _data #29580

merged 3 commits into from
Nov 13, 2019

Conversation

jbrockmendel
Copy link
Member

NB: this does induce a small behavior change in that Index will not have a _data attribute until __init__/__new__.

I found in #29561 that getting _data annotated is necessary before we can annotate most of core.indexes.

I'm also not sure what to do about MultiIndex, suggestions welcome.

@jorisvandenbossche jorisvandenbossche changed the title ANN: annotate _data TYP: annotate _data Nov 12, 2019
@jreback jreback added the Typing type annotations, mypy/pyright type checking label Nov 12, 2019
@jreback jreback added this to the 1.0 milestone Nov 13, 2019
@jreback
Copy link
Contributor

jreback commented Nov 13, 2019

lgtm. @simonjayhawkins @WillAyd

@@ -78,7 +78,7 @@ class DatetimeIndexOpsMixin(ExtensionOpsMixin):
common ops mixin to support a unified interface datetimelike Index
"""

_data = None
Copy link
Member

@WillAyd WillAyd Nov 13, 2019

Choose a reason for hiding this comment

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

Were these solely set to None before for annotation purposes? I think need to be careful in changing this if the intent was not solely for that purpose

Copy link
Member Author

Choose a reason for hiding this comment

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

these were here pre-annotations, so I think it was so that the attribute always exists

@@ -230,7 +230,7 @@ def _outer_indexer(self, left, right):
return libjoin.outer_join_indexer(left, right)

_typ = "index"
_data = None
_data: Union[ExtensionArray, np.ndarray]
Copy link
Member

Choose a reason for hiding this comment

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

you can now remove the assert and comment added in #29475 on L657?

Copy link
Member Author

Choose a reason for hiding this comment

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

yes, updated

Copy link
Member Author

Choose a reason for hiding this comment

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

updated+green

@jreback jreback merged commit b68899f into pandas-dev:master Nov 13, 2019
@jreback
Copy link
Contributor

jreback commented Nov 13, 2019

thanks @jbrockmendel

@jbrockmendel jbrockmendel deleted the cln-over3 branch November 13, 2019 16:49
Reksbril pushed a commit to Reksbril/pandas that referenced this pull request Nov 18, 2019
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.

5 participants