lazy import aware branch of pyflakes

Michael Hudson michael.hudson at canonical.com
Thu Feb 28 00:14:10 GMT 2008


John Arbash Meinel wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Michael Hudson wrote:
> | John Arbash Meinel wrote:
> |> -----BEGIN PGP SIGNED MESSAGE-----
> |> Hash: SHA1
> |>
> |> Michael Hudson wrote:
> |> | I got tired of cleaning up the imports of a couple of bzrlib files by
> |> | hand or by converting lazy imports to real imports, running pyflakes
> |> | and then lazifying the imports again, so I came up with a better way:
> |> | hacking pyflakes to understand lazy imports.
> |> |
> |> | The branch at:
> |> |
> |> |
> |> https://code.edge.launchpad.net/~mwhudson/pyflakes/lazy-import-support
> |> |
> |> | does three things:
> |> |
> |> | 1) Parses lazy imports so that uses of the imported names don't give
> |> |    'undefined name' warnings.
> |> | 2) Warns if a lazily imported name is used at module level.
> |> | 3) Warns for names that are imported eagerly but *not* used at module
> |> |    level and so could be lazy.
> |>
> |> Sounds nice.
> |
> | Thanks.
> |
> |> |
> |> | It produces rather a for bzrlib currently (though some of it is noise:
> |> | pyflakes complains at this sort of thing:
> |>
> |> Rather a ???
> |
> | I don't understand your comment here -- are you just saying that you
> | don't understand my comment? :)
> 
> "It produces rather a for bzrlib" is missing a noun.

Oops!  I meant, it produces rather a lot of output.  Sorry about that.

> ...
> 
> |> Also thanks for doing this. We might consider adding it to the test
> |> suite (part
> |> of our source tests), but we would need to get it clean first.
> |
> | I don't know how feasible that is -- one idea is to have a ratchet,
> | which says that each commit much not increase the number of pyflakes
> | complaints, or something.
> |
> | Cheers,
> | mwh
> |
> 
> 
> Yeah, and with most lint programs there are usually times when they are
> specifically wrong for one reason or another.

Right.

Cheers,
mwh



More information about the bazaar mailing list