PyCQA / flake8-import-order

Flake8 plugin that checks import order against various Python Style Guides

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

I202 errors for multiline imports

philtay opened this issue · comments

The following snippet triggers an I202 error:

from .foo import (
    bar,
    baz,
)

from .zoo import (
    mux,
    mox,
)

I think that a blank line should be allowed when a single import spans multiple lines.

Isn't the I202 due to the newline between these two imports in this case? If so (depending on the style you are using) it is likely correct.

Yes, it's the newline between the imports. Look how ugly it is without:

from .foo import (
    bar,
    baz,
)
from .zoo import (
    mux,
    mox,
)
from .moo import (
    yux,
    yox,
)

I think that multiline imports should be allowed to be separated by a newline.

Fair enough, however all the styles in this package expect the newlines to be absent. I think your best bet is to write your own style with the newlines expected or simply ignore the I202 error.