Skip to content

TYP: follow-up to #37723 #37745

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 2 commits into from
Nov 11, 2020
Merged

Conversation

jbrockmendel
Copy link
Member

  • closes #xxxx
  • tests added / passed
  • passes black pandas
  • passes git diff upstream/master -u -- "*.py" | flake8 --diff
  • whatsnew entry

@simonjayhawkins
Copy link
Member

see https://mypy.readthedocs.io/en/stable/generics.html#declaring-decorators

we have F defined in pandas._typing for this purpose.

@jbrockmendel
Copy link
Member Author

we have F defined in pandas._typing for this purpose.

pandas/core/nanops.py:400: error: Incompatible return value type (got "Callable[..., Any]", expected "F")  [return-value]

The functions being decorated dont all have the same signature, so the decorated func has **kwargs that the targets dont have

@simonjayhawkins
Copy link
Member

need to use return cast(F, new_func)

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 @jbrockmendel merge on green

@simonjayhawkins simonjayhawkins added the Typing type annotations, mypy/pyright type checking label Nov 11, 2020
@simonjayhawkins simonjayhawkins added this to the 1.2 milestone Nov 11, 2020
@jbrockmendel jbrockmendel merged commit 50b34a4 into pandas-dev:master Nov 11, 2020
@jbrockmendel jbrockmendel deleted the followup-37723 branch November 11, 2020 17:12
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