File tree 3 files changed +33
-0
lines changed
3 files changed +33
-0
lines changed Original file line number Diff line number Diff line change @@ -313,6 +313,8 @@ This is the current list of error and warning codes:
313
313
+------------+----------------------------------------------------------------------+
314
314
| E274 | tab before keyword |
315
315
+------------+----------------------------------------------------------------------+
316
+ | E275 | missing whitespace after keyword |
317
+ +------------+----------------------------------------------------------------------+
316
318
+------------+----------------------------------------------------------------------+
317
319
| **E3 ** | *Blank line * |
318
320
+------------+----------------------------------------------------------------------+
Original file line number Diff line number Diff line change @@ -325,6 +325,23 @@ def whitespace_around_keywords(logical_line):
325
325
yield match .start (2 ), "E271 multiple spaces after keyword"
326
326
327
327
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
+
328
345
def missing_whitespace (logical_line ):
329
346
r"""Each comma, semicolon or colon should be followed by whitespace.
330
347
Original file line number Diff line number Diff line change 28
28
a and b
29
29
#: E273 E274
30
30
this 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