您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

metadata_entities.py 847B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. from collections.abc import Sequence
  2. from typing import Literal
  3. from pydantic import BaseModel, Field
  4. SupportedComparisonOperator = Literal[
  5. # for string or array
  6. "contains",
  7. "not contains",
  8. "start with",
  9. "end with",
  10. "is",
  11. "is not",
  12. "empty",
  13. "not empty",
  14. "in",
  15. "not in",
  16. # for number
  17. "=",
  18. "≠",
  19. ">",
  20. "<",
  21. "≥",
  22. "≤",
  23. # for time
  24. "before",
  25. "after",
  26. ]
  27. class Condition(BaseModel):
  28. """
  29. Condition detail
  30. """
  31. name: str
  32. comparison_operator: SupportedComparisonOperator
  33. value: str | Sequence[str] | None | int | float = None
  34. class MetadataCondition(BaseModel):
  35. """
  36. Metadata Condition.
  37. """
  38. logical_operator: Literal["and", "or"] | None = "and"
  39. conditions: list[Condition] | None = Field(default=None, deprecated=True)