summaryrefslogtreecommitdiffstatshomepage
path: root/src/infini/output.py
blob: 92913b1e81883612b126be12dbdf2bdb4faff34e (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
from infini.typing import Literal


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

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

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

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