File tree 3 files changed +29
-0
lines changed
3 files changed +29
-0
lines changed Original file line number Diff line number Diff line change @@ -331,6 +331,8 @@ This is the current list of error and warning codes:
331
331
+------------+----------------------------------------------------------------------+
332
332
| E402 | module level import not at top of file |
333
333
+------------+----------------------------------------------------------------------+
334
+ | E403 | missing whitespace after import statement |
335
+ +------------+----------------------------------------------------------------------+
334
336
+------------+----------------------------------------------------------------------+
335
337
| **E5 ** | *Line length * |
336
338
+------------+----------------------------------------------------------------------+
Original file line number Diff line number Diff line change @@ -855,6 +855,21 @@ def imports_on_separate_lines(logical_line):
855
855
yield found , "E401 multiple imports on one line"
856
856
857
857
858
+ def missing_whitespace_after_import_statement (logical_line ):
859
+ r"""Multiple imports in form from x import (a, b, c) should have space
860
+ between import statement and parenthesised name list.
861
+
862
+ Okay: from foo import (bar, baz)
863
+ E403: from foo import(bar, baz)
864
+ E403: from fake.importable.module import(bar, baz)
865
+ """
866
+ line = logical_line
867
+ if line .startswith ('from ' ):
868
+ found = line .find (' import' )
869
+ if - 1 < found and line [found + len (" import" )] == "(" :
870
+ yield found , "E403 missing whitespace after import statement"
871
+
872
+
858
873
def module_imports_on_top_of_file (
859
874
logical_line , indent_level , checker_state , noqa ):
860
875
r"""Imports are always put at the top of the file, just after any module
Original file line number Diff line number Diff line change 36
36
a = 1
37
37
38
38
import bar
39
+ #: Okay
40
+ from u import (a , b )
41
+ from v import c , d
42
+ #: E403
43
+ from w import (e , f )
44
+ #: E403
45
+ from fake .importable .module import (e , f )
46
+ #: E403
47
+ try :
48
+ from fake .importable .module import (e , f )
49
+ except ImportError :
50
+ pass
You can’t perform that action at this time.
0 commit comments