You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

metadata_entities.py 862B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. from collections.abc import Sequence
  2. from typing import Literal, Optional
  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. Conditon 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: Optional[Literal["and", "or"]] = "and"
  39. conditions: Optional[list[Condition]] = Field(default=None, deprecated=True)