Tool may change variables from type `T` to `tuple[T]`
cmyui opened this issue · 1 comments
cmyui commented
Hey, I found this while using this as a pre-commit hook (big fan of the the project & your tools btw! :)).
It seems the tool may change turn a type into a tuple[type] in a situation like this;
x = (
object # < comma is added here
), object
asottile commented
hideous code, interesting edge case
the code tries to find the first argument to figure out where the tuple parens live (since they're optional) -- but in this case mixes up the (non-existent) outer parens with continuation parens
interestingly enough, the code gets this right in python<3.8 (where the ast offsets of tuples "improved" but also got worse for some cases like this one