File tree Expand file tree Collapse file tree 3 files changed +25
-2
lines changed Expand file tree Collapse file tree 3 files changed +25
-2
lines changed Original file line number Diff line number Diff line change 123123HUNK_REGEX = re .compile (r'^@@ -\d+(?:,\d+)? \+(\d+)(?:,(\d+))? @@.*$' )
124124STARTSWITH_DEF_REGEX = re .compile (r'^(async\s+def|def)' )
125125STARTSWITH_TOP_LEVEL_REGEX = re .compile (r'^(async\s+def|def|class|@)' )
126+ STARTSWITH_INDENT_STATEMENT_REGEX = re .compile (
127+ r'^\s*({0})' .format ('|' .join (s .replace (' ' , '\s+' ) for s in (
128+ 'def' , 'async def' ,
129+ 'for' , 'async for' ,
130+ 'if' , 'elif' , 'else' ,
131+ 'try' , 'except' , 'finally' ,
132+ 'with' , 'async with' ,
133+ 'class' ,
134+ 'while' ,
135+ )))
136+ )
126137
127138# Work around Python < 2.6 behaviour, which does not generate NL after
128139# a comment which is on a line by itself.
@@ -1004,7 +1015,7 @@ def compound_statements(logical_line):
10041015 break
10051016 if STARTSWITH_DEF_REGEX .match (line ):
10061017 yield 0 , "E704 multiple statements on one line (def)"
1007- else :
1018+ elif STARTSWITH_INDENT_STATEMENT_REGEX . match ( line ) :
10081019 yield found , "E701 multiple statements on one line (colon)"
10091020 prev_found = found
10101021 found = line .find (':' , found + 1 )
Original file line number Diff line number Diff line change 88 pass
99 except :
1010 print 'Whoops'
11- #: E122 E225 E251 E251 E701
11+ #: E122 E225 E251 E251
1212
1313# Do not crash if code is invalid
1414if msg :
Original file line number Diff line number Diff line change 11#!/usr/bin/env python3
2+ from typing import ClassVar , List
23
34
45# Annotated function (Issue #29)
56def foo (x : int ) -> int :
67 return x + 1
8+
9+
10+ # Annotated variables #575
11+ CONST : int = 42
12+
13+
14+ class Class :
15+ cls_var : ClassVar [str ]
16+
17+ def m (self ):
18+ xs : List [int ] = []
You can’t perform that action at this time.
0 commit comments