MCPcopy Create free account
hub / github.com/RefactoringGuru/design-patterns-python / restore

Method restore

src/Memento/Conceptual/main.py:73–81  ·  view source on GitHub ↗

EN: Restores the Originator's state from a memento object. RU: Восстанавливает состояние Создателя из объекта снимка.

(self, memento: Memento)

Source from the content-addressed store, hash-verified

71 return ConcreteMemento(self._state)
72
73 def restore(self, memento: Memento) -> None:
74 """
75 EN: Restores the Originator's state from a memento object.
76
77 RU: Восстанавливает состояние Создателя из объекта снимка.
78 """
79
80 self._state = memento.get_state()
81 print(f"Originator: My state has changed to: {self._state}")
82
83
84class Memento(ABC):

Callers 1

undoMethod · 0.80

Calls 1

get_stateMethod · 0.80

Tested by

no test coverage detected