File tree 3 files changed +9
-3
lines changed 3 files changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -11,7 +11,12 @@ def get_var_names_from_assignment(
11
11
if isinstance (assignment_node .target , ast .Name ):
12
12
return [(assignment_node .target .id , assignment_node .target )]
13
13
elif isinstance (assignment_node , ast .Assign ):
14
- names = [t for t in assignment_node .targets if isinstance (t , ast .Name )]
14
+ names = []
15
+ for target in assignment_node .targets :
16
+ if isinstance (target , ast .Name ):
17
+ names .append (target )
18
+ elif isinstance (target , ast .Tuple ):
19
+ names .extend ([dim for dim in target .dims if isinstance (dim , ast .Name )])
15
20
return [(n .id , n ) for n in names ]
16
21
return []
17
22
Original file line number Diff line number Diff line change 2
2
b = 1
3
3
c = 3
4
4
i = 4
5
+ x , y , z = 5 , 6 , 7
Original file line number Diff line number Diff line change @@ -13,9 +13,9 @@ def test_ok_good_names():
13
13
14
14
def test_ok_for_short_names_file ():
15
15
errors = run_validator_for_test_file ('short_names.py' , use_strict_mode = True )
16
- assert len (errors ) == 4
16
+ assert len (errors ) == 7
17
17
errors = run_validator_for_test_file ('short_names.py' , use_strict_mode = False )
18
- assert len (errors ) == 3
18
+ assert len (errors ) == 6
19
19
assert (
20
20
get_error_message (errors [0 ])
21
21
== "VNE001 single letter variable names like 'a' are not allowed"
You can’t perform that action at this time.
0 commit comments