Team Ai
Apppublic

Underground-Digital/Workflow-Engine

sourceHugging Faceupdated 2y agoView on Hugging Face
0likes
variables.py81 linesDownload Raw Back to variables
1from pydantic import Field2 3from core.helper import encrypter4 5from .segments import (6    ArrayAnySegment,7    ArrayNumberSegment,8    ArrayObjectSegment,9    ArrayStringSegment,10    FileSegment,11    FloatSegment,12    IntegerSegment,13    NoneSegment,14    ObjectSegment,15    Segment,16    StringSegment,17)18from .types import SegmentType19 20 21class Variable(Segment):22    """23    A variable is a segment that has a name.24    """25 26    id: str = Field(27        default="",28        description="Unique identity for variable. It's only used by environment variables now.",29    )30    name: str31    description: str = Field(default="", description="Description of the variable.")32 33 34class StringVariable(StringSegment, Variable):35    pass36 37 38class FloatVariable(FloatSegment, Variable):39    pass40 41 42class IntegerVariable(IntegerSegment, Variable):43    pass44 45 46class ObjectVariable(ObjectSegment, Variable):47    pass48 49 50class ArrayAnyVariable(ArrayAnySegment, Variable):51    pass52 53 54class ArrayStringVariable(ArrayStringSegment, Variable):55    pass56 57 58class ArrayNumberVariable(ArrayNumberSegment, Variable):59    pass60 61 62class ArrayObjectVariable(ArrayObjectSegment, Variable):63    pass64 65 66class SecretVariable(StringVariable):67    value_type: SegmentType = SegmentType.SECRET68 69    @property70    def log(self) -> str:71        return encrypter.obfuscated_token(self.value)72 73 74class NoneVariable(NoneSegment, Variable):75    value_type: SegmentType = SegmentType.NONE76    value: None = None77 78 79class FileVariable(FileSegment, Variable):80    pass81