Skip to content

Types

observant.types.collection_change_type.ObservableCollectionChangeType

Bases: Enum

Type of change that occurred in a collection.

Source code in observant\types\collection_change_type.py
class ObservableCollectionChangeType(Enum):
    """Type of change that occurred in a collection."""

    ADD = auto()
    REMOVE = auto()
    CLEAR = auto()
    UPDATE = auto()  # For dictionaries, when a value is updated

observant.types.list_change.ObservableListChange dataclass

Bases: Generic[T]

Information about a change to an ObservableList.

Source code in observant\types\list_change.py
@dataclass(frozen=True)
class ObservableListChange(Generic[T]):
    """Information about a change to an ObservableList."""

    type: ObservableCollectionChangeType
    index: int | None = None  # Index where the change occurred, if applicable
    item: T | None = None  # Item that was added or removed, if applicable
    items: list[T] | None = None  # Multiple items that were added or removed, if applicable

observant.types.dict_change.ObservableDictChange dataclass

Bases: Generic[TKey, TValue]

Information about a change to an ObservableDict.

Source code in observant\types\dict_change.py
@dataclass(frozen=True)
class ObservableDictChange(Generic[TKey, TValue]):
    """Information about a change to an ObservableDict."""

    type: ObservableCollectionChangeType
    key: TKey | None = None  # Key where the change occurred, if applicable
    value: TValue | None = (
        None  # Value that was added, removed, or updated, if applicable
    )
    items: dict[TKey, TValue] | None = (
        None  # Multiple items that were added, removed, or updated, if applicable
    )

observant.types.proxy_field_key.ProxyFieldKey dataclass

Source code in observant\types\proxy_field_key.py
@dataclass(frozen=True)
class ProxyFieldKey:
    attr: str
    sync: bool

observant.types.undo_config.UndoConfig dataclass

Configuration for undo/redo behavior of an observable field.

Attributes:

Name Type Description
enabled bool

Whether undo/redo functionality is enabled for this field.

undo_max Optional[int]

Maximum number of undo steps to store. None means unlimited.

undo_debounce_ms Optional[int]

Time window in milliseconds to group changes. None means no debouncing.

Source code in observant\types\undo_config.py
@dataclass
class UndoConfig:
    """
    Configuration for undo/redo behavior of an observable field.

    Attributes:
        enabled: Whether undo/redo functionality is enabled for this field.
        undo_max: Maximum number of undo steps to store. None means unlimited.
        undo_debounce_ms: Time window in milliseconds to group changes. None means no debouncing.
    """

    enabled: bool = False
    undo_max: Optional[int] = 50
    undo_debounce_ms: Optional[int] = None