Skip to content

Commit 5230110

Browse files
author
Susannah Klaneček
committed
E714: fix chained is not
Closes #767
1 parent a238201 commit 5230110

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

pycodestyle.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,8 @@ def lru_cache(maxsize=128): # noqa as it's a fake implementation.
140140
WHITESPACE_AFTER_COMMA_REGEX = re.compile(r'[,;:]\s*(?: |\t)')
141141
COMPARE_SINGLETON_REGEX = re.compile(r'(\bNone|\bFalse|\bTrue)?\s*([=!]=)'
142142
r'\s*(?(1)|(None|False|True))\b')
143-
COMPARE_NEGATIVE_REGEX = re.compile(r'\b(not)\s+[^][)(}{ ]+\s+(in|is)\s')
143+
COMPARE_NEGATIVE_REGEX = re.compile(r'\b(not)\s+[^][)(}{ ]+\s+(in|is)'
144+
r'\s+(?!not\s)')
144145
COMPARE_TYPE_REGEX = re.compile(r'(?:[=!]=|is(?:\s+not)?)\s+type(?:s.\w+Type'
145146
r'|\s*\(\s*([^)]*[^ )])\s*\))')
146147
KEYWORD_REGEX = re.compile(r'(\s*)\b(?:%s)\b(\s*)' % r'|'.join(KEYWORDS))

testsuite/E71.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,9 @@
6464
#: E714
6565
if not X.B is Y:
6666
pass
67+
#: E714
68+
if not X is Y is not Z:
69+
pass
6770

6871
#
6972
#: Okay
@@ -79,6 +82,9 @@
7982
if x is not y:
8083
pass
8184

85+
if X is not Y is not Z:
86+
pass
87+
8288
if TrueElement.get_element(True) == TrueElement.get_element(False):
8389
pass
8490

0 commit comments

Comments
 (0)