We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e639308 commit ade29d6Copy full SHA for ade29d6
patterns/behavioral/chaining_method.py
@@ -1,22 +1,25 @@
1
+from __future__ import annotations
2
+
3
4
class Person:
- def __init__(self, name, action):
5
+ def __init__(self, name: str, action: Action) -> None:
6
self.name = name
7
self.action = action
8
- def do_action(self):
9
+ def do_action(self) -> Action:
10
print(self.name, self.action.name, end=" ")
11
return self.action
12
13
14
class Action:
- def __init__(self, name):
15
+ def __init__(self, name: str) -> None:
16
17
- def amount(self, val):
18
+ def amount(self, val: str) -> Action:
19
print(val, end=" ")
20
return self
21
- def stop(self):
22
+ def stop(self) -> None:
23
print("then stop")
24
25
0 commit comments