-
-
Notifications
You must be signed in to change notification settings - Fork 10.8k
MNT: Enforce ruff/Pyflakes rules (F) #27309
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
base: main
Are you sure you want to change the base?
Conversation
dcc1d0d
to
e5dda5d
Compare
dfcd46a
to
bd85509
Compare
I'm getting circular imports trying to address ruff suggestions. |
c733263
to
b33b2af
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I noticed that there are a lot of F401
(unused-import) ignores. Maybe we should just disable it structurally, e.g. for all __init__.py
in the lint.extend-per-file-ignores
?
In numtype I've been using nested (hierarchical) extend = "../../../pyproject.toml"
line-length = 88
[lint]
extend-ignore = [
"D", # pydocstyle
"ERA", # eradicate
"S", # flake8-bandit
"T", # flake8-print
"PLR2004", # pylint: magic-value-comparisons
] Perhaps something like that could also help for numpy? |
The amount of per file ignores remains limited for now. I suggest we revisit hierarchical |
This comment has been minimized.
This comment has been minimized.
I'm not sure how to use mypy_primer, there weren't too many typing-related changes here. I have rebased just in case. |
This comment has been minimized.
This comment has been minimized.
https://github.com/pytorch/vision/blob/main/torchvision/utils.py#L271 🤷🏻 |
Rebased to fix conflicts. |
needs another rebase |
imported but unused
Redefinition of unused function
Undefined name in `__all__`
Co-authored-by: Joren Hammudoglu <jhammudoglu@gmail.com>
imported but unused
Rebased to fix conflicts. |
In preparation for #24994.The purpose of this PR is to show the kind of changes involved byF
rules, because ruff enablesF
rules by default.The idea is not necessarily to apply these rules. Rather I would like to start a discussion whether it we should apply or disable theseF
rules, if pycodestyle was replaced by ruff.Now that we have switched to ruff, try to enable Pyflakes
F
rules.I have left out F821. Relevant changes involve circular imports and extensive changes. This is best left to a future PR.