Skip to content

CLN: internals.blocks cleanup, typing #27941

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 9 commits into from
Aug 26, 2019
Merged

Conversation

jbrockmendel
Copy link
Member

No description provided.

@jreback jreback added the Clean label Aug 16, 2019
@jreback jreback added this to the 1.0 milestone Aug 16, 2019
Copy link
Member

@WillAyd WillAyd left a comment

Choose a reason for hiding this comment

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

looks pretty good some minor annotation comments

@@ -669,7 +669,7 @@ def convert(

return self.copy() if copy else self

def _can_hold_element(self, element):
def _can_hold_element(self, element) -> bool:
Copy link
Member

Choose a reason for hiding this comment

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

element here should be Any right? If so I think OK to type as an explicit indication

Copy link
Member

Choose a reason for hiding this comment

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

Note this comment is applicable in a lot of the signatures here

Copy link
Member Author

Choose a reason for hiding this comment

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

will do

@@ -1288,7 +1276,7 @@ def take_nd(self, indexer, axis, new_mgr_locs=None, fill_tuple=None):
else:
return self.make_block_same_class(new_values, new_mgr_locs)

def diff(self, n, axis=1):
def diff(self, n: int, axis: int = 1):
Copy link
Member

Choose a reason for hiding this comment

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

I think can type the return as -> "Block" here

Copy link
Member

Choose a reason for hiding this comment

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

Think this would still be nice as a follow up or another commit

Copy link
Member Author

Choose a reason for hiding this comment

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

is using a string here the best practice?

Good to have you back

Copy link
Member

Choose a reason for hiding this comment

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

Thanks! And yea you would want to use a string literal when the return type for a function is a type of the class itself

Mypy and related documentation will refer to this as a forward reference

Copy link
Member Author

Choose a reason for hiding this comment

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

added

@WillAyd WillAyd added the Typing type annotations, mypy/pyright type checking label Aug 23, 2019
Copy link
Member

@WillAyd WillAyd left a comment

Choose a reason for hiding this comment

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

lgtm one comment

@WillAyd WillAyd merged commit 49d2019 into pandas-dev:master Aug 26, 2019
@WillAyd
Copy link
Member

WillAyd commented Aug 26, 2019

Thanks @jbrockmendel

@jbrockmendel jbrockmendel deleted the coerce11 branch August 27, 2019 00:18
@pandas-dev pandas-dev deleted a comment Aug 27, 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
Clean Typing type annotations, mypy/pyright type checking
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants