You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is more of a question at this point: I wonder if it would be possible to do this with pyupgrade.
If it is, I'll attempt to write a patch, otherwise you can just close this !
input
assuming we run pyupgrade with the --py39 flag
importsysifsys.version_info< (3, 9):
print("this should be cleaned up")
else:
print("this is the message we should keep (dedent)")
ifsys.version_info> (3, 8):
print("this is the message we should keep (dedent)")
else:
print("this should be cleaned up")
ifsys.version_info>= (3, 8):
print("this is the message we should keep (dedent)")
else:
print("this should be cleaned up")
ifsys.version_info<= (3, 9):
print("nothing to do here")
else:
print("both branches are still valid")
output
importsysprint("this is the message we should keep (dedent)")
print("this is the message we should keep (dedent)")
print("this is the message we should keep (dedent)")
ifsys.version_info<= (3, 9):
print("nothing to do here")
else:
print("both branches are still valid")
The text was updated successfully, but these errors were encountered:
there already is some amount of this that's done for --py3-plus but it gets complicated quickly! I think it's possible so I'll leave this open but I seem to remember it being very tricky
So I've started looking into this, until I stumbled upon pyupgrade/_plugins/versioned_branches.py which looks a lot like a what I think I'm trying to write ? Why was it moved to a plugin and btw how can I use plugins in pyupgrade ? I see no mention of them in the documentation. In any case, do you confirm that it's a good place to start ? should I try to expand it or start a different plugin ?
This is more of a question at this point: I wonder if it would be possible to do this with pyupgrade.
If it is, I'll attempt to write a patch, otherwise you can just close this !
input
assuming we run pyupgrade with the
--py39
flagoutput
The text was updated successfully, but these errors were encountered: