rope
rope copied to clipboard
Rename Method allows changing datamodels function names.
Rename Method allows changing datamodels function names.
Steps to reproduce the behavior:
- Code before refactoring:
class Singleton:
_instancia = None
def __new__(cls):
if cls._instancia is None:
cls._instancia = super().__new__(cls)
return cls._instancia
a = Singleton()
b = Singleton()
print(a is b)
-
Apply the rename method to
Singleton.__new__ -
Code after refactoring:
class Singleton:
_instancia = None
def get_instance(cls):
if cls._instancia is None:
cls._instancia = super().__new__(cls)
return cls._instancia
a = Singleton()
b = Singleton()
print(a is b)