summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorent Xicluna <florent.xicluna@gmail.com>2010-09-10 20:58:59 +0200
committerFlorent Xicluna <florent.xicluna@gmail.com>2010-09-10 20:58:59 +0200
commit921b22e206d77eaa5426255f0afcdc31e6160ca2 (patch)
tree868a73cd6ffbda96e1cadf38e19b1ce69af5dd85
parent197d0f5c52088c192be35e026f370472df448f21 (diff)
downloadpep8-921b22e206d77eaa5426255f0afcdc31e6160ca2.tar.gz
Fix E225: accept ``print >>sys.stderr, "..."`` syntax.
-rw-r--r--CHANGES.txt2
-rwxr-xr-xpep8.py6
-rw-r--r--testsuite/E225i.py2
-rw-r--r--testsuite/E225not.py3
4 files changed, 9 insertions, 4 deletions
diff --git a/CHANGES.txt b/CHANGES.txt
index 2c125ab..fb14047 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -5,6 +5,8 @@ Changelog
0.5.1 (unreleased)
------------------
+* Fix E225: accept ``print >>sys.stderr, "..."`` syntax.
+
* Fix E501 for lines containing multibyte encoded characters. (Issue #7)
* Fix E221, E222, E223, E224 not detected in some cases. (Issue #16)
diff --git a/pep8.py b/pep8.py
index 177f823..8f8aaef 100755
--- a/pep8.py
+++ b/pep8.py
@@ -128,9 +128,9 @@ WHITESPACE_AROUND_NAMED_PARAMETER_REGEX = \
WHITESPACE = ' \t'
BINARY_OPERATORS = frozenset(['**=', '*=', '+=', '-=', '!=', '<>',
- '%=', '^=', '&=', '|=', '==', '/=', '//=', '>=', '<=', '>>=', '<<=',
- '%', '^', '&', '|', '=', '/', '//', '>', '<', '>>', '<<'])
-UNARY_OPERATORS = frozenset(['**', '*', '+', '-'])
+ '%=', '^=', '&=', '|=', '==', '/=', '//=', '<=', '>=', '<<=', '>>=',
+ '%', '^', '&', '|', '=', '/', '//', '<', '>', '<<'])
+UNARY_OPERATORS = frozenset(['>>', '**', '*', '+', '-'])
OPERATORS = BINARY_OPERATORS | UNARY_OPERATORS
SKIP_TOKENS = frozenset([tokenize.COMMENT, tokenize.NL, tokenize.INDENT,
tokenize.DEDENT, tokenize.NEWLINE])
diff --git a/testsuite/E225i.py b/testsuite/E225i.py
new file mode 100644
index 0000000..6f51eb9
--- /dev/null
+++ b/testsuite/E225i.py
@@ -0,0 +1,2 @@
+_1MB = 2 ** 20
+_1kB = _1MB >>10
diff --git a/testsuite/E225not.py b/testsuite/E225not.py
index 656207b..918ee8d 100644
--- a/testsuite/E225not.py
+++ b/testsuite/E225not.py
@@ -11,4 +11,5 @@ spam(-1)
lambda *args, **kw: (args, kw)
lambda a, b=h[:], c=0: (a, b, c)
if not -5 < x < +5:
- print >> sys.stderr, "x is out of range."
+ print >>sys.stderr, "x is out of range."
+print >> sys.stdout, "x is an integer."