PyCQA / pycodestyle

Simple Python style checker in one Python file
https://pycodestyle.pycqa.org
Other
5.02k stars 755 forks source link

fix reporting of ambiguous identifier after parameter list #1122

Closed asottile closed 1 year ago

asottile commented 1 year ago

part of #1121

asottile commented 1 year ago

this fixed some of the regressions I found -- but not all of them (will need something a little more clever -- will follow up with that)

diff -ur out_main/numpy.log out_pr/numpy.log
--- out_main/numpy.log  2022-11-21 13:56:36.347940207 -0500
+++ out_pr/numpy.log    2022-11-21 13:58:07.683942339 -0500
@@ -7137,7 +7137,6 @@
 ./numpy/f2py/crackfortran.py:491:21: E741 ambiguous variable name 'l'
 ./numpy/f2py/crackfortran.py:501:17: E741 ambiguous variable name 'l'
 ./numpy/f2py/crackfortran.py:508:21: E741 ambiguous variable name 'l'
-./numpy/f2py/crackfortran.py:511:17: E741 ambiguous variable name 'l'
 ./numpy/f2py/crackfortran.py:514:17: E741 ambiguous variable name 'l'
 ./numpy/f2py/crackfortran.py:529:80: E501 line too long (96 > 79 characters)
 ./numpy/f2py/crackfortran.py:52:80: E501 line too long (98 > 79 characters)
@@ -7170,7 +7169,6 @@
 ./numpy/f2py/crackfortran.py:859:5: E741 ambiguous variable name 'l'
 ./numpy/f2py/crackfortran.py:865:17: E741 ambiguous variable name 'l'
 ./numpy/f2py/crackfortran.py:870:17: E741 ambiguous variable name 'l'
-./numpy/f2py/crackfortran.py:872:9: E741 ambiguous variable name 'l'
 ./numpy/f2py/crackfortran.py:877:5: E741 ambiguous variable name 'l'
 ./numpy/f2py/crackfortran.py:895:1: E302 expected 2 blank lines, found 1
 ./numpy/f2py/crackfortran.py:912:17: E741 ambiguous variable name 'l'
diff -ur out_main/pandas.log out_pr/pandas.log
--- out_main/pandas.log 2022-11-21 13:57:21.759941267 -0500
+++ out_pr/pandas.log   2022-11-21 13:58:53.579943411 -0500
@@ -11380,7 +11380,6 @@
 ./pandas/tests/io/pytables/test_round_trip.py:231:80: E501 line too long (82 > 79 characters)
 ./pandas/tests/io/pytables/test_round_trip.py:273:80: E501 line too long (84 > 79 characters)
 ./pandas/tests/io/pytables/test_round_trip.py:305:23: E741 ambiguous variable name 'l'
-./pandas/tests/io/pytables/test_round_trip.py:305:52: E741 ambiguous variable name 'l'
 ./pandas/tests/io/pytables/test_round_trip.py:305:9: E731 do not assign a lambda expression, use a def
 ./pandas/tests/io/pytables/test_round_trip.py:346:80: E501 line too long (82 > 79 characters)
 ./pandas/tests/io/pytables/test_round_trip.py:412:80: E501 line too long (85 > 79 characters)

here's an example that's still broken:

x = (
    lambda l: dict(zip(l, range(len(l)))),
)