diff --git a/pycodestyle.py b/pycodestyle.py index 2e4ebed5..957836cc 100755 --- a/pycodestyle.py +++ b/pycodestyle.py @@ -122,7 +122,9 @@ LAMBDA_REGEX = re.compile(r'\blambda\b') HUNK_REGEX = re.compile(r'^@@ -\d+(?:,\d+)? \+(\d+)(?:,(\d+))? @@.*$') STARTSWITH_DEF_REGEX = re.compile(r'^(async\s+def|def)') -STARTSWITH_TOP_LEVEL_REGEX = re.compile(r'^(async\s+def|def|class|@)') +STARTSWITH_TOP_LEVEL_REGEX = re.compile( + r'^(async\s+def\s+|def\s+|class\s+|@)' +) STARTSWITH_INDENT_STATEMENT_REGEX = re.compile( r'^\s*({0})'.format('|'.join(s.replace(' ', '\s+') for s in ( 'def', 'async def', diff --git a/testsuite/E30not.py b/testsuite/E30not.py index 63ff733e..b0624761 100644 --- a/testsuite/E30not.py +++ b/testsuite/E30not.py @@ -155,3 +155,7 @@ class Bar(object): classification_errors = None #: Okay defined_properly = True +#: Okay +def foo(x): + classification = x + definitely = not classification