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
I do understand that pyupgrade is an opinionated tool. It is, however, not a perfect one. There are cases where the fix introduces a bug.
My options then are:
Not use the tool at all, even tho 99.9% of the time it works perfectly
If I'm lucky, and there is a flag to disable a fix, I can then disable it across the whole project (--keep-mock, --keep-runtime-typing, and --keep-percent-format)
This is curious, because configuration is allowed despite the opinionated nature
I can blacklist the problematic file
I would love a 4th option that allows me to disable a single line.
In my case, I have a dataclass that uses slots=True. There is a problem with super in there, as described in this SO answer so I need to explicitly call super(MyClass, self) and it works.
The problem is that pyupgrade then comes along and removes it, assuming that it is always safe to do so (this assumption is wrong, as this is Python, where things can change during runtime, not C)
All of the widely used tools, even opinionated black allow for exceptions for this reason. A simple # nopyupgrade and possibly # pyupgrade: off+# pyupgrade: on would fix this.
Thank you
The text was updated successfully, but these errors were encountered:
A continuation of a closed and locked issue, #574
I do understand that pyupgrade is an opinionated tool. It is, however, not a perfect one. There are cases where the fix introduces a bug.
My options then are:
--keep-mock
,--keep-runtime-typing
, and--keep-percent-format
)I would love a 4th option that allows me to disable a single line.
In my case, I have a dataclass that uses
slots=True
. There is a problem with super in there, as described in this SO answer so I need to explicitly callsuper(MyClass, self)
and it works.The problem is that pyupgrade then comes along and removes it, assuming that it is always safe to do so (this assumption is wrong, as this is Python, where things can change during runtime, not C)
All of the widely used tools, even opinionated black allow for exceptions for this reason. A simple
# nopyupgrade
and possibly# pyupgrade: off
+# pyupgrade: on
would fix this.Thank you
The text was updated successfully, but these errors were encountered: