File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change 16
16
from abc import ABC , abstractmethod
17
17
from datetime import datetime
18
18
from random import sample
19
- from string import ascii_letters , digits
19
+ from string import ascii_letters
20
20
21
21
22
- class Originator () :
22
+ class Originator :
23
23
"""
24
24
EN: The Originator holds some important state that may change over time. It
25
25
also defines a method for saving the state inside a memento and another
@@ -57,7 +57,8 @@ def do_something(self) -> None:
57
57
self ._state = self ._generate_random_string (30 )
58
58
print (f"Originator: and my state has changed to: { self ._state } " )
59
59
60
- def _generate_random_string (self , length : int = 10 ) -> None :
60
+ @staticmethod
61
+ def _generate_random_string (length : int = 10 ) -> str :
61
62
return "" .join (sample (ascii_letters , length ))
62
63
63
64
def save (self ) -> Memento :
@@ -128,7 +129,7 @@ def get_date(self) -> str:
128
129
return self ._date
129
130
130
131
131
- class Caretaker () :
132
+ class Caretaker :
132
133
"""
133
134
EN: The Caretaker doesn't depend on the Concrete Memento class. Therefore,
134
135
it doesn't have access to the originator's state, stored inside the memento.
You can’t perform that action at this time.
0 commit comments