Skip to content

Commit

Permalink
Merge pull request #1118 from dannysepler/E741-false-pos
Browse files Browse the repository at this point in the history
Fix false positive with E741
  • Loading branch information
asottile committed Nov 6, 2022
2 parents 2b76c4d + a131316 commit c14a263
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pycodestyle.py
Expand Up @@ -1504,6 +1504,7 @@ def ambiguous_identifier(logical_line, tokens):
Okay: lambda arg: arg * l
Okay: lambda a=l[I:5]: None
Okay: lambda x=a.I: None
Okay: if l >= 12:
E741: except AttributeError as O:
E741: with lock as l:
E741: global I
Expand Down Expand Up @@ -1542,7 +1543,7 @@ def ambiguous_identifier(logical_line, tokens):
elif text == ')':
parameter_parentheses_level -= 1
# identifiers on the lhs of an assignment operator
if token_type == tokenize.OP and '=' in text and \
if token_type == tokenize.OP and text in {'=', ':='} and \
parameter_parentheses_level == 0:
if prev_text in idents_to_avoid:
ident = prev_text
Expand Down
3 changes: 3 additions & 0 deletions testsuite/python38.py
Expand Up @@ -53,3 +53,6 @@ def f3(
#: E221:1:6 E221:1:19
if (x := 1) == (y := 2):
pass
#: E741
while l := 1:
pass

0 comments on commit c14a263

Please sign in to comment.