Comments (8)
Victor, can this be closed?
from cpython.
Please keep it open. I would like to visit some options for ssl and ctypes. And check imports in tests.
from cpython.
The #noqa: F401
comment was discussed in #120421. In short, it's a standard linter command to ignore "imported but unused" warning on the current line.
from cpython.
Could you link to the standard?
from cpython.
Could you link to the standard?
I don't think that there is a written standard. It's just that multiple linters adopted the same format. Examples:
- Flake8: https://flake8.pycqa.org/en/7.0.0/user/violations.html#in-line-ignoring-errors
- Ruff: https://docs.astral.sh/ruff/linter/#error-suppression
- pycodestyle: https://pycodestyle.pycqa.org/en/latest/intro.html#error-codes
- https://stackoverflow.com/questions/45346575/what-does-noqa-mean-in-python-comments
from cpython.
None of those documents explains what F401
means (though some use it as an example).
So maybe explain it in a comment rather than use a link?
from cpython.
Flake8 checks lint rules from plugins, each with its own alphabetical prefix. The F codes are from Pyflakes:
F401:
module
imported but unused
https://flake8.pycqa.org/en/latest/user/error-codes.html#error-violation-codes
In more words in the Ruff docs:
F401 unused-import:
{name}
imported but unused; consider usingimportlib.util.find_spec
to test for availability
https://docs.astral.sh/ruff/rules/#pyflakes-f
from cpython.
Ok, I'm now done with my batch of changes to remove unused imports. I close the issue.
If someone wants to automate the detection of unused imports, I suggest to open a new issue. Right now, in total, ruff check|grep F401
returns 173 lines. I didn't add #noqa:F401
to these lines.
from cpython.
Related Issues (20)
- [spam]
- Random error of PyCapsule_New called with null pointer error when using seaborn matplotlib numpy and pandas HOT 3
- enum.Flag ignores bitwise operator methods from mixins HOT 2
- Optimize sort() and min()/max() by not calling keyfunc for size-1 inputs HOT 7
- KeyboardInterrupt during paste breaks the new REPL HOT 4
- Immutable dictionary in Python HOT 2
- 3.13 `copy.replace` isn't in `__all__` HOT 11
- Is it possible to implement TypeScript in python? HOT 1
- missing global names inside a class body (calling `exec` with a `ChainMap`) HOT 18
- Limit the reading size from pipes to their default buffer size on Unix systems HOT 2
- `SSLContext` might create infinite recursions in some use-cases HOT 1
- Weird `inspect.getsource` behavior with generators HOT 3
- ast constructors should look at `_attributes` for allowed attributes
- Clarify what is the default executor for `asyncio.run_in_executor`
- MSVC pragma to turn compiler optimization off around the _PyEval_EvalFrameDefault is no longer necessary HOT 1
- pkgutil direct use of zipimport._zip_directory_cache is no longer safe
- Suffix in pathlib is not behaving like a file extension HOT 8
- test_pyrepl: test_not_wiping_history_file() fails (randomly?) on multiple buildbots HOT 2
- Use _Py_SourceLocation in symtable
- dataclass overriding a property in the parent class is broken HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cpython.