Skip to content
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

refactor(python): Add TYPE_CHECKING lints #7070

Merged
merged 2 commits into from Feb 21, 2023

Conversation

stinodego
Copy link
Member

@stinodego stinodego commented Feb 21, 2023

Enable the TCH lints, which detects imports that are only used during type checking, and tells you to move them into an if TYPE_CHECKING block.

This has a slight performance benefit, but is also nice for readability, to easily discern which imports are used for type hints and which are actually used in the code logic.

I also removed the _DOCUMENTING = True flags as they weren't being used - used contextlib.suppress(ImportError) instead.

@github-actions github-actions bot added chore Maintenance work that does not impact the user python Related to Python Polars labels Feb 21, 2023
@stinodego stinodego changed the title chore(python): Add TYPE_CHECKING lints refactor(python): Add TYPE_CHECKING lints Feb 21, 2023
@stinodego stinodego removed the chore Maintenance work that does not impact the user label Feb 21, 2023
@github-actions github-actions bot added the refactor Code improvements that do not change functionality label Feb 21, 2023
@ritchie46 ritchie46 merged commit ee20b36 into pola-rs:master Feb 21, 2023
josemasar pushed a commit to josemasar/polars that referenced this pull request Feb 21, 2023
@stinodego stinodego deleted the documenting-flag branch February 22, 2023 18:34
josemasar pushed a commit to josemasar/polars that referenced this pull request Feb 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
python Related to Python Polars refactor Code improvements that do not change functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants