Skip to content

Commit c4460cb

Browse files
authored
Merge pull request #987 from asottile/E712_multiple_times
detect multiple E712 in a line
2 parents 76edc0a + 37e96aa commit c4460cb

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

pycodestyle.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1393,8 +1393,10 @@ def comparison_to_singleton(logical_line, noqa):
13931393
None was set to some other value. The other value might have a type
13941394
(such as a container) that could be false in a boolean context!
13951395
"""
1396-
match = not noqa and COMPARE_SINGLETON_REGEX.search(logical_line)
1397-
if match:
1396+
if noqa:
1397+
return
1398+
1399+
for match in COMPARE_SINGLETON_REGEX.finditer(logical_line):
13981400
singleton = match.group(1) or match.group(3)
13991401
same = (match.group(2) == '==')
14001402

testsuite/E71.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@
4242
#: E712
4343
if res[1] != False:
4444
pass
45+
#: E712 E712
46+
var = 1 if cond == True else -1 if cond == False else cond
4547

4648
#
4749
#: E713

0 commit comments

Comments
 (0)