Skip to content

Commit

Permalink
Modified patch for issue #314 so tests in E73.py pass
Browse files Browse the repository at this point in the history
  • Loading branch information
arthall committed Jun 2, 2016
1 parent 5cf3c7a commit 5949086
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions pycodestyle.py
Original file line number Diff line number Diff line change
Expand Up @@ -965,8 +965,12 @@ def compound_statements(logical_line):
if ((counts['{'] <= counts['}'] and # {'a': 1} (dict)
counts['['] <= counts[']'] and # [1:2] (slice)
counts['('] <= counts[')'])): # (annotation)
if LAMBDA_REGEX.search(line, 0, found):
yield 0, "E731 do not assign a lambda expression, use a def"
lambda_kw = LAMBDA_REGEX.search(line, 0, found)
if lambda_kw:
before = line[:lambda_kw.start()].rstrip()
if before[-1:] == '=' and isidentifier(before[:-1].strip()):
yield 0, ("E731 do not assign a lambda expression, use a "
"def")
break
if line.startswith('def '):
yield 0, "E704 multiple statements on one line (def)"
Expand Down

0 comments on commit 5949086

Please sign in to comment.