Skip to content

CLN, TYP use from __future__ import annotations #39036

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 1 commit into from
Jan 8, 2021

Conversation

MarcoGorelli
Copy link
Member

Seeing as pandas is Python3.7+ we can clean up some annotations. Not yet figured out how to write a good automated check for this, but here's a start

@simonjayhawkins simonjayhawkins added Clean Typing type annotations, mypy/pyright type checking labels Jan 8, 2021
@simonjayhawkins simonjayhawkins added this to the 1.3 milestone Jan 8, 2021
Copy link
Member

@simonjayhawkins simonjayhawkins left a comment

Choose a reason for hiding this comment

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

Thanks @MarcoGorelli lgtm pending green.

Not yet figured out how to write a good automated check for this

yep. last year there was alot of activity on manually migrating to f-strings, only for a tool to come along that would have did it for us.

@simonjayhawkins
Copy link
Member

see also #36091

@simonjayhawkins
Copy link
Member

@MarcoGorelli I'll merge this now as without a check it's a waste of valuable reviewer time to check that all quotes are removed from a module when the import is added.

but there we a few here that are obvious without a through check.

@@ -322,7 +324,7 @@ def should_reindex_frame_op(


def frame_arith_method_with_reindex(
left: "DataFrame", right: "DataFrame", op
left: DataFrame, right: DataFrame, op
) -> "DataFrame":
Copy link
Member

Choose a reason for hiding this comment

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

here

@@ -139,7 +141,7 @@ def melt(


@deprecate_kwarg(old_arg_name="label", new_arg_name=None)
def lreshape(data: "DataFrame", groups, dropna: bool = True, label=None) -> "DataFrame":
def lreshape(data: DataFrame, groups, dropna: bool = True, label=None) -> "DataFrame":
Copy link
Member

Choose a reason for hiding this comment

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

here

@@ -234,7 +236,7 @@ def lreshape(data: "DataFrame", groups, dropna: bool = True, label=None) -> "Dat


def wide_to_long(
df: "DataFrame", stubnames, i, j, sep: str = "", suffix: str = r"\d+"
df: DataFrame, stubnames, i, j, sep: str = "", suffix: str = r"\d+"
Copy link
Member

Choose a reason for hiding this comment

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

here

@simonjayhawkins
Copy link
Member

a separate PR dealing with return types is welcome.

@simonjayhawkins simonjayhawkins merged commit c509095 into pandas-dev:master Jan 8, 2021
@MarcoGorelli MarcoGorelli deleted the import-annotations branch January 10, 2021 13:59
luckyvs1 pushed a commit to luckyvs1/pandas that referenced this pull request Jan 20, 2021
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.

2 participants