Skip to content

Commit

Permalink
Merge pull request #931 from suzil/fix/767/chained-is-not-E714
Browse files Browse the repository at this point in the history
E714: fix chained `is not`
  • Loading branch information
sigmavirus24 committed May 8, 2020
2 parents 90026af + 39895aa commit 1aa4c0a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pycodestyle.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,8 @@ def lru_cache(maxsize=128): # noqa as it's a fake implementation.
WHITESPACE_AFTER_COMMA_REGEX = re.compile(r'[,;:]\s*(?: |\t)')
COMPARE_SINGLETON_REGEX = re.compile(r'(\bNone|\bFalse|\bTrue)?\s*([=!]=)'
r'\s*(?(1)|(None|False|True))\b')
COMPARE_NEGATIVE_REGEX = re.compile(r'\b(not)\s+[^][)(}{ ]+\s+(in|is)\s')
COMPARE_NEGATIVE_REGEX = re.compile(r'\b(?<!is\s)(not)\s+[^][)(}{ ]+\s+'
r'(in|is)\s')
COMPARE_TYPE_REGEX = re.compile(r'(?:[=!]=|is(?:\s+not)?)\s+type(?:s.\w+Type'
r'|\s*\(\s*([^)]*[^ )])\s*\))')
KEYWORD_REGEX = re.compile(r'(\s*)\b(?:%s)\b(\s*)' % r'|'.join(KEYWORDS))
Expand Down
9 changes: 9 additions & 0 deletions testsuite/E71.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,12 @@
#: E714
if not X.B is Y:
pass
#: E714
if not X is Y is not Z:
pass
#: E714
if not X is not Y:
pass

#
#: Okay
Expand All @@ -79,6 +85,9 @@
if x is not y:
pass

if X is not Y is not Z:
pass

if TrueElement.get_element(True) == TrueElement.get_element(False):
pass

Expand Down

0 comments on commit 1aa4c0a

Please sign in to comment.