Skip to content

STYLE start enabling TCH #51687

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
Mar 2, 2023
Merged

Conversation

MarcoGorelli
Copy link
Member

@MarcoGorelli MarcoGorelli commented Feb 28, 2023

This one should actually make a difference to performance, https://github.com/snok/flake8-type-checking#examples

  • closes #xxxx (Replace xxxx with the GitHub issue number)
  • Tests added and passed if fixing a bug or adding a new feature
  • All code checks passed.
  • Added type annotations to new arguments/methods/functions.
  • Added an entry in the latest doc/source/whatsnew/vX.X.X.rst file if fixing a bug or adding a new feature.

@MarcoGorelli MarcoGorelli changed the title start enabling TCH STYLE start enabling TCH Feb 28, 2023
MarcoGorelli added 2 commits February 28, 2023 10:36
@MarcoGorelli MarcoGorelli added the Code Style Code style, linting, code_checks label Feb 28, 2023
@MarcoGorelli MarcoGorelli requested a review from phofl February 28, 2023 11:05
@MarcoGorelli MarcoGorelli marked this pull request as ready for review February 28, 2023 11:05
Copy link
Member

@twoertwein twoertwein left a comment

Choose a reason for hiding this comment

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

Looks good to me but I believe we had a discussion in the past about that (I believe back then performance wasn't the goal so the outcome might be different now) @simonjayhawkins

@twoertwein
Copy link
Member

xref #47968 (moved non-pandas._typing imports into the TYPE_CHECKING block)

@twoertwein
Copy link
Member

(Unrelated: ruff implements more and more of flake8-pyi, could potentially avoid flake8-pyi in a few weeks/months)

@MarcoGorelli MarcoGorelli added this to the 2.1 milestone Mar 2, 2023
@MarcoGorelli
Copy link
Member Author

xref #47968 (moved non-pandas._typing imports into the TYPE_CHECKING block)

yeah this seems like the same thing

agree on keeping _typing excluded, but we can start enabling it in other places - merging then, thanks for your review!

@MarcoGorelli MarcoGorelli merged commit d385465 into pandas-dev:main Mar 2, 2023
@twoertwein
Copy link
Member

agree on keeping _typing excluded, but we can start enabling it in other places - merging then, thanks for your review!

Personally, I would be fine moving even pandas._typing in the TYPE_CHECKING block. It might not be strictly needed but otherwise, we would need to add too many exceptions to enable TCH.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Code Style Code style, linting, code_checks
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants