File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -313,6 +313,8 @@ This is the current list of error and warning codes:
313313+------------+----------------------------------------------------------------------+
314314| E274 | tab before keyword |
315315+------------+----------------------------------------------------------------------+
316+ | E275 | missing whitespace after keyword |
317+ +------------+----------------------------------------------------------------------+
316318+------------+----------------------------------------------------------------------+
317319| **E3 ** | *Blank line * |
318320+------------+----------------------------------------------------------------------+
Original file line number Diff line number Diff line change @@ -325,6 +325,23 @@ def whitespace_around_keywords(logical_line):
325325 yield match .start (2 ), "E271 multiple spaces after keyword"
326326
327327
328+ def missing_whitespace_after_import_keyword (logical_line ):
329+ r"""Multiple imports in form from x import (a, b, c) should have space
330+ between import statement and parenthesised name list.
331+
332+ Okay: from foo import (bar, baz)
333+ E275: from foo import(bar, baz)
334+ E275: from importable.module import(bar, baz)
335+ """
336+ line = logical_line
337+ indicator = ' import('
338+ if line .startswith ('from ' ):
339+ found = line .find (indicator )
340+ if - 1 < found :
341+ pos = found + len (indicator ) - 1
342+ yield pos , "E275 missing whitespace after keyword"
343+
344+
328345def missing_whitespace (logical_line ):
329346 r"""Each comma, semicolon or colon should be followed by whitespace.
330347
Original file line number Diff line number Diff line change 2828a and b
2929#: E273 E274
3030this and False
31+ #: Okay
32+ from u import (a , b )
33+ from v import c , d
34+ #: E271
35+ from w import (e , f )
36+ #: E275
37+ from w import (e , f )
38+ #: E275
39+ from importable .module import (e , f )
40+ #: E275
41+ try :
42+ from importable .module import (e , f )
43+ except ImportError :
44+ pass
You can’t perform that action at this time.
0 commit comments