summaryrefslogtreecommitdiff
path: root/pep8.py
diff options
context:
space:
mode:
authorFlorent Xicluna <florent.xicluna@gmail.com>2010-09-10 21:08:45 +0200
committerFlorent Xicluna <florent.xicluna@gmail.com>2010-09-10 21:08:45 +0200
commit95cfcb56d56b7b11c49bc736eae93cd4b8c6c40a (patch)
treef1e245c3a4478bae624789d1a610cb71eca6dfb1 /pep8.py
parent921b22e206d77eaa5426255f0afcdc31e6160ca2 (diff)
downloadpep8-95cfcb56d56b7b11c49bc736eae93cd4b8c6c40a.tar.gz
Restore compatibility with Python 2.3 and Python 3
Diffstat (limited to 'pep8.py')
-rwxr-xr-xpep8.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/pep8.py b/pep8.py
index 8f8aaef..04fb558 100755
--- a/pep8.py
+++ b/pep8.py
@@ -134,8 +134,8 @@ UNARY_OPERATORS = frozenset(['>>', '**', '*', '+', '-'])
OPERATORS = BINARY_OPERATORS | UNARY_OPERATORS
SKIP_TOKENS = frozenset([tokenize.COMMENT, tokenize.NL, tokenize.INDENT,
tokenize.DEDENT, tokenize.NEWLINE])
-E225NOT_KEYWORDS = \
- frozenset(keyword.kwlist) - frozenset(['False', 'None', 'True'])
+E225NOT_KEYWORDS = (frozenset(keyword.kwlist + ['print']) -
+ frozenset(['False', 'None', 'True']))
BENCHMARK_KEYS = ('directories', 'files', 'logical lines', 'physical lines')
options = None
@@ -441,11 +441,11 @@ def whitespace_around_operator(logical_line):
tab = whitespace == '\t'
offset = match.start(2)
if before in OPERATORS:
- return offset, ("E224 tab after operator" if tab
- else "E222 multiple spaces after operator")
+ return offset, (tab and "E224 tab after operator" or
+ "E222 multiple spaces after operator")
elif after in OPERATORS:
- return offset, ("E223 tab before operator" if tab
- else "E221 multiple spaces before operator")
+ return offset, (tab and "E223 tab before operator" or
+ "E221 multiple spaces before operator")
def missing_whitespace_around_operator(logical_line, tokens):