Giter VIP home page Giter VIP logo

Comments (6)

tiangolo avatar tiangolo commented on July 20, 2024 6

Just a note, as I was having a similar issue and came here before but didn't find this info.

You can exclude a single line adding a comment # noqa, like:

from .endpoints import role, token, user, utils  # noqa

I also submitted a PR adding that to the docs: #43

from autoflake.

myint avatar myint commented on July 20, 2024

I think having such an option makes sense. It might be useful to get some metrics on how common this is. That would help us get an idea on whether this new behavior should be an option or the default.

Currently, autoflake can only exclude __init__.py files via --exclude=__init__.py. But that will make autoflake completely ignore it. And --exclude is only relevant to recursive mode.

from autoflake.

NeilGirdhar avatar NeilGirdhar commented on July 20, 2024

It's pretty standard: e.g., https://github.com/numpy/numpy/blob/master/numpy/linalg/__init__.py

It's better to do it this way than to explicitly list things in the __init__.py otherwise changes to exported names have to be done in two places (__all__ in the module, and the import statement in __init__.py).

Also, I don't think it should be an option, or at least the option should default to true. Things imported by __init__.py are for the importer of that package—not for code within __init__.py.

from autoflake.

myint avatar myint commented on July 20, 2024

I agree, about the option setting. It makes sense to by default be conservative and not remove things. I'll accept a pull request to make such a change. Otherwise, I'll take a look in a few months when I'm less busy. Thanks!

from autoflake.

NeilGirdhar avatar NeilGirdhar commented on July 20, 2024

Thanks!

from autoflake.

CLiu13 avatar CLiu13 commented on July 20, 2024

Working on this issue, may I be assigned to it? Thanks!

from autoflake.

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.