Implement E741 (#137)

This commit is contained in:
Harutaka Kawamura 2022-09-12 01:30:28 +09:00 committed by GitHub
parent 81ae3bfc94
commit c4565fe0f5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 275 additions and 1 deletions

72
resources/test/fixtures/E741.py vendored Normal file
View file

@ -0,0 +1,72 @@
from contextlib import contextmanager
l = 0
I = 0
O = 0
l: int = 0
a, l = 0, 1
[a, l] = 0, 1
a, *l = 0, 1, 2
a = l = 0
o = 0
i = 0
for l in range(3):
pass
for a, l in zip(range(3), range(3)):
pass
def f1():
global l
l = 0
def f2():
l = 0
def f3():
nonlocal l
l = 1
f3()
return l
def f4(l, /, I):
return l, I, O
def f5(l=0, *, I=1):
return l, I
def f6(*l, **I):
return l, I
@contextmanager
def ctx1():
yield 0
with ctx1() as l:
pass
@contextmanager
def ctx2():
yield 0, 1
with ctx2() as (a, l):
pass
try:
pass
except ValueError as l:
pass

View file

@ -9,6 +9,7 @@ select = [
"E713",
"E714",
"E731",
"E741",
"E902",
"F401",
"F403",