Re: pyflakes and star imports

Jean-Paul Calderone <[email protected]> Fri, 11 Jul 2008 07:27:51 -0400
Newsgroups gmane.comp.python.quotient.dev
Message-ID <20080711112751.4714.1283843994.divmod.quotient.19330@ohm>
On Thu, 10 Jul 2008 23:34:39 +0200, Manlio Perillo <[email protected]> wrote:
>Hi.
>
>I'm starting to use pyflakes, with satisfaction, thanks for this tool!
>
>However some times I use star imports, but of course making sure that the 
>imported module defines the special __all__ name.
>
>Unfortunately pyflakes simply bail out when it sees a star import.
>Is it possible to make it look at the __all__ name in the imported module?
>

It's impossible to reliably determine the value of __all__ without executing
the code in the module.  It's possible to guess and probably be right most of
the time by looking at the AST very carefully.  If you want, you could submit
a patch for this.  Or you could break yourself of the bad habit of using import
*. :)

Jean-Paul