if isinstance(x, int) or isinstance(x, float):
pass
This is one of the issues from #84 but this PR doesn't address the others.
Correctly transforms to
if isinstance(x, (int, float)):
pass
The underlying issue is https://github.com/Instagram/LibCST/issues/888 which this works around by creating a wrapper decorator that implements the (to me, and implicitly to you when you wrote this code assuming it!) desired behaviour of not running a transformation if it doesn't apply to the current version of the code after previous transformations have run.
This results in a change to example C414.txt where previously list(list(iterable)) was being incorrectly transformed to iterable when it should have been transformed to list(iterable).
Probably there were other examples of this sort of problem lurking in shed, but I haven't made any attempt to trigger them.
This pull request makes it so:
This is one of the issues from #84 but this PR doesn't address the others.
Correctly transforms to
The underlying issue is https://github.com/Instagram/LibCST/issues/888 which this works around by creating a wrapper decorator that implements the (to me, and implicitly to you when you wrote this code assuming it!) desired behaviour of not running a transformation if it doesn't apply to the current version of the code after previous transformations have run.
This results in a change to example C414.txt where previously
list(list(iterable))
was being incorrectly transformed toiterable
when it should have been transformed tolist(iterable)
.Probably there were other examples of this sort of problem lurking in shed, but I haven't made any attempt to trigger them.