ruff
37301375 - Make `SIM118` fix as safe when the expression is a known dictionary (#8525)

Commit
2 years ago
Make `SIM118` fix as safe when the expression is a known dictionary (#8525) ## Summary Given `key in obj.keys()`, `obj` _could_ be a dictionary, or it could be another type that defines a `.keys()` method. In the latter case, removing the `.keys()` attribute could lead to a runtime error. Previously, we marked all `SIM118` fixes as unsafe for this reason; however, in preview, we now mark them as safe if we can infer that the expression is a dictionary. ## Test Plan Added a preview fixture.
Author
Parents
Loading