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

Incorrect replace-dict-items-with-values #181

Closed
ronnodas opened this issue Jan 5, 2022 · 3 comments
Closed

Incorrect replace-dict-items-with-values #181

ronnodas opened this issue Jan 5, 2022 · 3 comments
Assignees
Labels
bug Something isn't working next release This will be fixed in next release

Comments

@ronnodas
Copy link

ronnodas commented Jan 5, 2022

Issue description or question

Incorrect suggestion of replace-dict-items-with-values when keys are tuples that are unpacked in the for statement, such as the following code:

d = {(1, 2): 3}
for (key_a, key_b), value in d.items():
    print(key_a, key_b, value)

Moving the tuple unpacking to the body of the loop removes the suggestion:

d = {(1, 2): 3}
for key, value in d.items():
    key_a, key_b = key
    print(key_a, key_b, value)

Sourcery Version

0.9.8

Code editor or IDE name and version

Pycharm v2021.3.1 (Professional Edition)

OS name and version

Fedora 35

@ruancomelli ruancomelli self-assigned this Jan 5, 2022
@ruancomelli ruancomelli added the bug Something isn't working label Jan 5, 2022
@ruancomelli
Copy link
Contributor

ruancomelli commented Jan 5, 2022

Thank you for spotting and reporting this! We'll release a fix as soon as possible.

@ruancomelli
Copy link
Contributor

Hello, @ronnodas!

We've implemented a fix for this bug. It will be available in the next beta release tomorrow (2021-01-07) and in the next release v0.10.0.
Thank you very much for this report, and please let us know if you find other issues!

@ruancomelli ruancomelli added the next release This will be fixed in next release label Jan 6, 2022
@Hellebore
Copy link
Collaborator

Fixed with 0.10.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working next release This will be fixed in next release
Projects
None yet
Development

No branches or pull requests

3 participants