Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix ambiguous identifiers in lambda bodies inside braces #1123

Merged
merged 1 commit into from Nov 21, 2022

Conversation

asottile
Copy link
Member

No description provided.

@asottile
Copy link
Member Author

alright this fixes the rest of the issues:

--- out_main/pandas.log	2022-11-21 14:14:13.115964883 -0500
+++ out_pr/pandas.log	2022-11-21 14:15:44.959967027 -0500
@@ -6752,11 +6752,6 @@
 ./pandas/tests/frame/indexing/test_delitem.py:53:80: E501 line too long (81 > 79 characters)
 ./pandas/tests/frame/indexing/test_getitem.py:107:80: E501 line too long (81 > 79 characters)
 ./pandas/tests/frame/indexing/test_getitem.py:118:20: E741 ambiguous variable name 'l'
-./pandas/tests/frame/indexing/test_getitem.py:118:32: E741 ambiguous variable name 'l'
-./pandas/tests/frame/indexing/test_getitem.py:118:45: E741 ambiguous variable name 'l'
-./pandas/tests/frame/indexing/test_getitem.py:119:20: E741 ambiguous variable name 'l'
-./pandas/tests/frame/indexing/test_getitem.py:119:32: E741 ambiguous variable name 'l'
-./pandas/tests/frame/indexing/test_getitem.py:119:45: E741 ambiguous variable name 'l'
 ./pandas/tests/frame/indexing/test_getitem.py:145:80: E501 line too long (82 > 79 characters)
 ./pandas/tests/frame/indexing/test_getitem.py:181:80: E501 line too long (80 > 79 characters)
 ./pandas/tests/frame/indexing/test_getitem.py:204:80: E501 line too long (86 > 79 characters)

@asottile
Copy link
Member Author

hmmm although actually that points out another problem, which is there's multiple lambdas it doesn't handle it correctly

@asottile
Copy link
Member Author

ok now it's good

diff -ur out_main/pandas.log out_pr/pandas.log
--- out_main/pandas.log	2022-11-21 14:14:13.115964883 -0500
+++ out_pr/pandas.log	2022-11-21 14:22:10.443976028 -0500
@@ -6752,11 +6752,7 @@
 ./pandas/tests/frame/indexing/test_delitem.py:53:80: E501 line too long (81 > 79 characters)
 ./pandas/tests/frame/indexing/test_getitem.py:107:80: E501 line too long (81 > 79 characters)
 ./pandas/tests/frame/indexing/test_getitem.py:118:20: E741 ambiguous variable name 'l'
-./pandas/tests/frame/indexing/test_getitem.py:118:32: E741 ambiguous variable name 'l'
-./pandas/tests/frame/indexing/test_getitem.py:118:45: E741 ambiguous variable name 'l'
 ./pandas/tests/frame/indexing/test_getitem.py:119:20: E741 ambiguous variable name 'l'
-./pandas/tests/frame/indexing/test_getitem.py:119:32: E741 ambiguous variable name 'l'
-./pandas/tests/frame/indexing/test_getitem.py:119:45: E741 ambiguous variable name 'l'
 ./pandas/tests/frame/indexing/test_getitem.py:145:80: E501 line too long (82 > 79 characters)
 ./pandas/tests/frame/indexing/test_getitem.py:181:80: E501 line too long (80 > 79 characters)
 ./pandas/tests/frame/indexing/test_getitem.py:204:80: E501 line too long (86 > 79 characters)

@asottile asottile merged commit b388782 into main Nov 21, 2022
@asottile asottile deleted the fix-E741-again branch November 21, 2022 19:22
miketheman added a commit to miketheman/warehouse that referenced this pull request Feb 23, 2023
Variable detection in Lambda was fixed in 2.10.0, and now raises
(based on the built-in rules) E741 errors, a rule that's been in place
since 2016, but a recent bugfix correctly identifies it in `lambda`
calls.

Refs: https://github.com/PyCQA/pycodestyle/blame/b22b672a1a53f1ef35c4f4689c674d66a24138ed/pycodestyle.py#L1478
Refs: PyCQA/pycodestyle#1123

Signed-off-by: Mike Fiedler <miketheman@gmail.com>
ewdurbin pushed a commit to pypi/warehouse that referenced this pull request Feb 24, 2023
* chore(deps): mass update

We're stuck waiting on a dependabot-core release that includes a fix to
the version of pip-tools that is used, so perform a manual upgrade.

Picks up botocore/boto3 deps that have been excluded from dependabot, so
that's nice.

Signed-off-by: Mike Fiedler <miketheman@gmail.com>

* lint: rename ambiguous variables

Variable detection in Lambda was fixed in 2.10.0, and now raises
(based on the built-in rules) E741 errors, a rule that's been in place
since 2016, but a recent bugfix correctly identifies it in `lambda`
calls.

Refs: https://github.com/PyCQA/pycodestyle/blame/b22b672a1a53f1ef35c4f4689c674d66a24138ed/pycodestyle.py#L1478
Refs: PyCQA/pycodestyle#1123

Signed-off-by: Mike Fiedler <miketheman@gmail.com>

* lint: reflow multiline text

Picked up by the latest flake8.

Signed-off-by: Mike Fiedler <miketheman@gmail.com>

* lint: remove type hint from decorator

The decorator wraps a pydantic frozen dataclass, which has had some
issues with type hints and the proxy nature from pydantic, so remove
the type hint for now.

Left a verbose comment in place for the future.

Signed-off-by: Mike Fiedler <miketheman@gmail.com>

---------

Signed-off-by: Mike Fiedler <miketheman@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant