PyCQA / flake8-import-order

Flake8 plugin that checks import order against various Python Style Guides
GNU Lesser General Public License v3.0
278 stars 72 forks source link

Possible bug in smarkets style checking #91

Closed marpetr closed 8 years ago

marpetr commented 8 years ago

I have a file with the following group of imports:

import datetime
import dateutil.parser
import logging

datetime
dateutil.parser
logging

Import order looks right, but flake8 complains about it:

$ flake8 foo.py
foo.py:3:1: I100 Import statements are in the wrong order.import logging should be before import dateutil.parser

Rearranging imports in the following order satisfies flake8:

import datetime
import logging
import dateutil.parser

Is this intended by design? I couldn't find the precise definition of smarkets import style, hence can't tell where is the problem.

sigmavirus24 commented 8 years ago

Most import orderings want stdlib imports grouped before non-stdlib imports. So datetime and logging would come prior to dateutil as that's a third-party. smarkets is defined in Configuration with an example.

marpetr commented 8 years ago

My apologies. That is perfectly correct behavior.