-
-
Notifications
You must be signed in to change notification settings - Fork 307
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
style: Fix unused-import (F401) #4521
Conversation
… __all__ in __init__
Ignored inline where the import is justified and isn't to fix later, and ignored in a per-file exclusion where the imports seemed to be for commented-out test case lines
How does the |
It explicitly lists what is available (exposed) when using star imports with the https://docs.python.org/3/tutorial/modules.html#importing-from-a-package |
@arohanajit Just to let you know that this PR will fix all (or most known, detected through ruff's implementation) of the F401, so you don't spend time in it. It's just still waiting to be merged. |
Co-authored-by: Anna Petrasova <[email protected]>
Ruff rule: https://docs.astral.sh/ruff/rules/unused-import/
Also adjusted the flake8 config file.
These commits started from an exploratory branch last week where I was profiling temporal tests. Removing an import of SimpleModule when not needed ended up with a measurable improvement in temporal/t.rast.accumulate/testsuite/test_accumulation.py, when removing all cases except one, and benchmarking with hyperfine (10 runs) each case, on Windows and Linux. I don't have the correct output for these isolated changes, as it was combined with more changes, but if combined with using t.remove with 3 layers in the input argument instead of calling t.remove 3 times, the fastest case was 1.18x faster than base, and 1.15x faster than base (I don't remember what conditions it was, but there was one less change). But the base was already modified by a change in PLY, sot it doesn't match exactly what was on main here.
The other change to t.remove will be in another PR.