-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
dict-iter-missing-items does not recognize tuple keys #3283
Labels
Enhancement ✨
Improvement to a component
Milestone
Comments
It makes sense, thank you for creating the issue. |
4 tasks
DanielNoord
added a commit
to DanielNoord/pylint
that referenced
this issue
Aug 31, 2021
This fixes a false positive emitted for dictionaries that contain only tuples as keys. This makes unpacking the dictionary without calling `.items()` valid. This closes pylint-dev#3283
Pierre-Sassoulas
pushed a commit
that referenced
this issue
Aug 31, 2021
This fixes a false positive emitted for dictionaries that contain only tuples as keys. This makes unpacking the dictionary without calling `.items()` valid. This closes #3283
This was referenced Feb 5, 2024
DanielNoord
added a commit
to DanielNoord/ruff
that referenced
this issue
Feb 6, 2024
See original issue at: pylint-dev/pylint#3283
dhruvmanila
added a commit
to astral-sh/ruff
that referenced
this issue
Feb 19, 2024
## Summary References #970. Implements [`dict-iter-missing-items`](https://pylint.readthedocs.io/en/latest/user_guide/messages/error/dict-iter-missing-items.html). Took the tests from "upstream" [here](https://github.com/DanielNoord/pylint/blob/main/tests/functional/d/dict_iter_missing_items.py). ~I wasn't able to implement code for one false positive, but it is pretty estoric: pylint-dev/pylint#3283. I would personally argue that adding this check as preview rule without supporting this specific use case is fine. I did add a "test" for it.~ This was implemented. ## Test Plan Followed the Contributing guide to create tests, hopefully I didn't miss any. Also ran CI on my own fork and seemed to be all okay 😄 ~Edit: the ecosystem check seems a bit all over the place? 😅~ All good. --------- Co-authored-by: Dhruv Manilawala <[email protected]> Co-authored-by: Charlie Marsh <[email protected]>
nkxxll
pushed a commit
to nkxxll/ruff
that referenced
this issue
Mar 10, 2024
## Summary References astral-sh#970. Implements [`dict-iter-missing-items`](https://pylint.readthedocs.io/en/latest/user_guide/messages/error/dict-iter-missing-items.html). Took the tests from "upstream" [here](https://github.com/DanielNoord/pylint/blob/main/tests/functional/d/dict_iter_missing_items.py). ~I wasn't able to implement code for one false positive, but it is pretty estoric: pylint-dev/pylint#3283. I would personally argue that adding this check as preview rule without supporting this specific use case is fine. I did add a "test" for it.~ This was implemented. ## Test Plan Followed the Contributing guide to create tests, hopefully I didn't miss any. Also ran CI on my own fork and seemed to be all okay 😄 ~Edit: the ecosystem check seems a bit all over the place? 😅~ All good. --------- Co-authored-by: Dhruv Manilawala <[email protected]> Co-authored-by: Charlie Marsh <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Steps to reproduce
Current behavior
Introduced with #2761
This yields now
dict-iter-missing-items
if iterate with
mydict.keys()
it yieldsconsider-iterating-dictonary
so there is no way anymore to iterate such a dict without warning or error, with one exception, using items() and casting the values to something like
_
which is ugly, or not unpacking at all in thefor
line.Expected behavior
Recognize if keys are tuples and dont throw this error
pylint --version output
pylint 2.4.4
astroid 2.3.3
Python 3.5.4 (v3.5.4:3f56838, Aug 8 2017, 02:17:05) [MSC v.1900 64 bit (AMD64)]
The text was updated successfully, but these errors were encountered: