aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/infini/output.py
blob: 73aa521375774d263f6729737c0cc5426aa591c7 (plain) (blame)
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
from infini.typing import Literal, Dict, Any


class Output:
    type: Literal["null", "text", "workflow"]
    name: str
    status: int
    block: bool

    variables: Dict[str, Any]

    def __init__(
        self,
        type: Literal["null", "text", "workflow"],
        name: str,
        *,
        status: int = 0,
        block: bool = False,
        variables: Dict[str, Any] = {},
    ) -> None:
        self.type = type
        self.name = name
        self.status = status
        self.block = block
        self.variables = variables

    @classmethod
    def empty(cls) -> "Output":
        return cls("null", "null", status=0, block=True)

    def is_empty(self) -> bool:
        return self.type == "null"