Closed adnathanail closed 1 year ago
Oh no! I'll have to think about the best way to resolve this.
For the moment to remove the error you can add a # sourcery skip: missing-dict-items
comment to your function (or switch off this suggestion completely with the Sourcery - turn off this refactoring
option).
I think it would make sense to not suggest missing-dict-items
if the keys of the dictionary have type tuple[A, B]
, ie tuples of length 2.
That's a good solution - unfortunately our type inference isn't yet capable of handling this. Might be a while before we can address it.
Checklist
Description
I have a dictionary with tuples as keys, and I want to destructure those keys as I loop through them, like so:
The code above causes sourcery to suggest
missing-dict-items
, because it thinks I am trying to iterate through the keys and values of a dictionary, so it wants to add.items()
So I explicitly added a call to
.keys()
, and it suggestedremove-dict-keys
!Debug Information
IDE Version:
PyCharm 2022.2 (Professional Edition)
Sourcery Version:
0.12.6
Operating system and Version:
macOS Monterey 12.2.1