Skip to content

omnipy.shared.protocols.util

CLASS DESCRIPTION
IsDataPublisher
IsDataclass

IsDataPublisher

Bases: Protocol

METHOD DESCRIPTION
deepcopy
subscribe
subscribe_attr
unsubscribe_all
Source code in src/omnipy/shared/protocols/util.py
class IsDataPublisher(Protocol):
    def subscribe_attr(self, attr_name: str, callback_fun: Callable[..., None]):
        ...

    def subscribe(self, callback_fun: Callable[..., None], do_callback: bool = True) -> None:
        ...

    def unsubscribe_all(self) -> None:
        ...

    def deepcopy(self) -> Self:
        ...

deepcopy

deepcopy() -> Self
Source code in src/omnipy/shared/protocols/util.py
def deepcopy(self) -> Self:
    ...

subscribe

subscribe(callback_fun: Callable[..., None], do_callback: bool = True) -> None
Source code in src/omnipy/shared/protocols/util.py
def subscribe(self, callback_fun: Callable[..., None], do_callback: bool = True) -> None:
    ...

subscribe_attr

subscribe_attr(attr_name: str, callback_fun: Callable[..., None])
Source code in src/omnipy/shared/protocols/util.py
def subscribe_attr(self, attr_name: str, callback_fun: Callable[..., None]):
    ...

unsubscribe_all

unsubscribe_all() -> None
Source code in src/omnipy/shared/protocols/util.py
def unsubscribe_all(self) -> None:
    ...

IsDataclass

Bases: Protocol

Source code in src/omnipy/shared/protocols/util.py
class IsDataclass(Protocol):
    # as already noted in comments, checking for this attribute is currently
    # the most reliable way to ascertain that something is a dataclass
    __dataclass_fields__: ClassVar[dict[str, Any]]