autoflake
autoflake copied to clipboard
Populate __all__ to avoid unused name errors
When a module imports many names from sub-modules, and does not include any code except for those imports, the module is obviously intended to hold names.
Those names should be put into __all__.
e.g. the following causes pyflakes errors, as Foo and Bar are unused:
from a.b import Foo
from a.c import Bar
To avoid this,
from a.b import Bar
from a.c import Foo
__all__ = ('Bar', 'Foo')
This should be uncontroversial for any module named __init__, as exported names are one of the primary purposes of an __init__ , especially before PEP 420.
This seems appropriate to me.