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
class Descriptor:
def __get__(self, instance, owner):
return 40
Apply the Inline Method refactoring to the method __get__.
Expected code after refactoring: the same as the original. It would be nice if Rope could emit a warning that applying the refactoring to this type of class is not allowed.
Rope produces the result below:
class Descriptor:
pass
The text was updated successfully, but these errors were encountered:
Thanks for testing and describing these corner cases.
We may be able to create a new InlineDescriptor mechanism to implement something of this nature, but I don't know if this is something that can be done in a generic way given how flexible __get__ can get.
I don't think there's much we can really do here, other than, as you say, forbidding this refactoring, which should be pretty simple, we can just check that we don't allow inlining this dunder method.
Steps to reproduce the behavior:
Apply the Inline Method refactoring to the method __get__.
Expected code after refactoring: the same as the original. It would be nice if Rope could emit a warning that applying the refactoring to this type of class is not allowed.
Rope produces the result below:
The text was updated successfully, but these errors were encountered: