Team Ai
Apppublic

Underground-Digital/Workflow-Engine

sourceHugging Faceupdated 2y agoView on Hugging Face
0likes
entities.py50 linesDownload Raw Back to condition
1from collections.abc import Sequence2from typing import Literal3 4from pydantic import BaseModel, Field5 6SupportedComparisonOperator = Literal[7    # for string or array8    "contains",9    "not contains",10    "start with",11    "end with",12    "is",13    "is not",14    "empty",15    "not empty",16    "in",17    "not in",18    "all of",19    # for number20    "=",21    "≠",22    ">",23    "<",24    "≥",25    "≤",26    "null",27    "not null",28    # for file29    "exists",30    "not exists",31]32 33 34class SubCondition(BaseModel):35    key: str36    comparison_operator: SupportedComparisonOperator37    value: str | Sequence[str] | None = None38 39 40class SubVariableCondition(BaseModel):41    logical_operator: Literal["and", "or"]42    conditions: list[SubCondition] = Field(default=list)43 44 45class Condition(BaseModel):46    variable_selector: list[str]47    comparison_operator: SupportedComparisonOperator48    value: str | Sequence[str] | None = None49    sub_variable_condition: SubVariableCondition | None = None50