Issue #13: redefinition of unused modules
Issue #13: redefinition of unused modules

Do not raise warning on common idioms like

try:
    import something
except ImportError:
    import somethingelse as something

Implements a simple check whether duplicate definition
or import share a common parent AST node that
is either <_ast.If> or <_ast.TryExcept>.
In that case additional verification is performed
whether duplicate definitions/imports were written
together. In case of multiple definitions on
different flow control forks (try/except/else,
if/else) no warning is raised.

No attempt is being made to perform smarter analysis
of the case.

Should fix most obvious cases of:
https://github.com/kevinw/pyflakes/issues/13

kevinw/pyflakes