Skip to content
This repository has been archived by the owner on Jan 5, 2023. It is now read-only.

Commit

Permalink
Pre-compiling lambda regexp (Jython has an issue when the re module i…
Browse files Browse the repository at this point in the history
…s imported in one thread and used in another).
  • Loading branch information
fabioz committed Feb 21, 2012
1 parent 1ba8842 commit e7c3414
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pep8.py
Expand Up @@ -128,7 +128,7 @@ def blank_lines(logical_line, blank_lines, indent_level, line_number)
EXTRANEOUS_WHITESPACE_REGEX = re.compile(r'[[({] | []}),;:]')
WHITESPACE_AROUND_NAMED_PARAMETER_REGEX = \
re.compile(r'[()]|\s=[^=]|[^=!<>]=\s')

LAMBDA_REGEX = re.compile(r'\blambda\b')

WHITESPACE = ' \t'

Expand Down Expand Up @@ -661,7 +661,7 @@ def compound_statements(logical_line):
before = line[:found]
if (before.count('{') <= before.count('}') and # {'a': 1} (dict)
before.count('[') <= before.count(']') and # [1:2] (slice)
not re.search(r'\blambda\b', before)): # lambda x: x
not LAMBDA_REGEX.search(before)): # lambda x: x
return found, "E701 multiple statements on one line (colon)"
found = line.find(';')
if -1 < found:
Expand Down

0 comments on commit e7c3414

Please sign in to comment.