Zac-HD / shed

`shed` canonicalises Python code. Shed your legacy, stop bikeshedding, and move on. Black++
https://pypi.org/project/shed/
GNU Affero General Public License v3.0
343 stars 23 forks source link

Bugs in `shed --refactor` #84

Closed Zac-HD closed 1 year ago

Zac-HD commented 1 year ago

Crash on refactor

These snippets are turned into invalid code by `--refactor

assert (
    "some very long                       string"
    and "another long                     string"
    == "third long                        string"
)

if isinstance(x, int) or isinstance(x, float):
    pass

Incorrect output

Incorrectly replaced with {}, because there's a single argument where the value is an empty collection literal; this should account for the presence of a keyword. (the logic is correct for list, tuple, and positional args to dict)

dict(ENV_VAR="")