-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtasks.py
More file actions
46 lines (30 loc) · 908 Bytes
/
tasks.py
File metadata and controls
46 lines (30 loc) · 908 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
from dataclasses import dataclass
from typing import Any
from registry import Task
@dataclass
class Pulse:
strength: int
def run(self) -> None:
print(
f"Sending a subspace pulse of {self.strength} microPicards to the converter assembly."
)
@dataclass
class Recalibrate:
target: str
def run(self) -> None:
print(f"Recalibrating the {self.target}.")
@dataclass
class Reinforce:
plating_type: str
target: str
def run(self) -> None:
print(f"Reinforcing {self.plating_type} plating of {self.target}.")
class PulseFactory:
def create(self, args: dict[str, Any]) -> Task:
return Pulse(**args)
class RecalibrateFactory:
def create(self, args: dict[str, Any]) -> Task:
return Recalibrate(**args)
class ReinforceFactory:
def create(self, args: dict[str, Any]) -> Task:
return Reinforce(**args)