Przeglądaj źródła

refactor: simplify Composite

Sam Jaffe 1 miesiąc temu
rodzic
commit
27494c256b
1 zmienionych plików z 5 dodań i 0 usunięć
  1. 5 0
      src/cipy/action.py

+ 5 - 0
src/cipy/action.py

@@ -20,6 +20,8 @@ class Call(Action, extra='allow'):
 
     def __init__(self, using: Action, /, **kwargs: Any) -> None:
         super().__init__(using=using, **kwargs)  # type: ignore
+        self.id = using.id
+        self.name = using.name
 
     @final
     def enabled(self, status: Status, context: Context) -> bool:
@@ -98,6 +100,9 @@ class Composite(Action):
     _counter: int = PrivateAttr(default=0)
     _results: Results = PrivateAttr(default_factory=Results)
 
+    def __init__(self, *steps: Action, **kwargs: Any) -> None:
+        super().__init__(steps=steps, **kwargs)  # type: ignore
+
     @final
     def run(self, context: Context) -> Status:
         status = Status.SUCCESS