| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990 | from collections.abc import Sequencefrom uuid import uuid4from pydantic import Fieldfrom core.helper import encrypterfrom .segments import (    ArrayAnySegment,    ArrayFileSegment,    ArrayNumberSegment,    ArrayObjectSegment,    ArrayStringSegment,    FileSegment,    FloatSegment,    IntegerSegment,    NoneSegment,    ObjectSegment,    Segment,    StringSegment,)from .types import SegmentTypeclass Variable(Segment):    """    A variable is a segment that has a name.    """    id: str = Field(        default=lambda _: str(uuid4()),        description="Unique identity for variable.",    )    name: str    description: str = Field(default="", description="Description of the variable.")    selector: Sequence[str] = Field(default_factory=list)class StringVariable(StringSegment, Variable):    passclass FloatVariable(FloatSegment, Variable):    passclass IntegerVariable(IntegerSegment, Variable):    passclass ObjectVariable(ObjectSegment, Variable):    passclass ArrayAnyVariable(ArrayAnySegment, Variable):    passclass ArrayStringVariable(ArrayStringSegment, Variable):    passclass ArrayNumberVariable(ArrayNumberSegment, Variable):    passclass ArrayObjectVariable(ArrayObjectSegment, Variable):    passclass SecretVariable(StringVariable):    value_type: SegmentType = SegmentType.SECRET    @property    def log(self) -> str:        return encrypter.obfuscated_token(self.value)class NoneVariable(NoneSegment, Variable):    value_type: SegmentType = SegmentType.NONE    value: None = Noneclass FileVariable(FileSegment, Variable):    passclass ArrayFileVariable(ArrayFileSegment, Variable):    pass
 |