Coder Social home page Coder Social logo

Comments (8)

terryjreedy avatar terryjreedy commented on August 17, 2024

Victor, can this be closed?

from cpython.

vstinner avatar vstinner commented on August 17, 2024

Please keep it open. I would like to visit some options for ssl and ctypes. And check imports in tests.

from cpython.

vstinner avatar vstinner commented on August 17, 2024

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.

encukou avatar encukou commented on August 17, 2024

Could you link to the standard?

from cpython.

vstinner avatar vstinner commented on August 17, 2024

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:

from cpython.

encukou avatar encukou commented on August 17, 2024

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.

hugovk avatar hugovk commented on August 17, 2024

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 using importlib.util.find_spec to test for availability

https://docs.astral.sh/ruff/rules/#pyflakes-f

from cpython.

vstinner avatar vstinner commented on August 17, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.