Annotations¶
The dbus_fast.annotations module contains DBusSignature that
can be used with typing.Annotated to provide D-Bus signature annotations
in a manner that is compatible with type hints. This applies to methods decorated
with dbus_property,
dbus_method or dbus_signal.
The module also includes some type aliases for common D-Bus types. You can construct your own annotated types like this:
from typing import Annotated
MyDBusStruct = Annotated[tuple[int, str], DBusSignature("(is)")]
Or you can use Annotated[...] directly without creating an alias.
Added in version v4.0.0: Prior to this version, annotations had to be specified as D-Bus signature strings.
- dbus_fast.annotations.DBusBool¶
D-Bus BOOLEAN type (“b”).
alias of
Annotated[bool,DBusSignature(signature=b)]
- dbus_fast.annotations.DBusByte¶
D-Bus BYTE type (“y”).
alias of
Annotated[int,DBusSignature(signature=y)]
- dbus_fast.annotations.DBusBytes¶
D-Bus ARRAY of BYTE type (“ay”).
alias of
Annotated[bytes,DBusSignature(signature=ay)]
- dbus_fast.annotations.DBusDict¶
D-Bus ARRAY of DICT_ENTRY type with STRING keys and VARIANT values (“a{sv}”).
alias of
Annotated[dict[str,Variant],DBusSignature(signature=a{sv})]
- dbus_fast.annotations.DBusDouble¶
D-Bus DOUBLE type (“d”).
alias of
Annotated[float,DBusSignature(signature=d)]
- dbus_fast.annotations.DBusInt16¶
D-Bus INT16 type (“n”).
alias of
Annotated[int,DBusSignature(signature=n)]
- dbus_fast.annotations.DBusInt32¶
D-Bus INT32 type (“i”).
alias of
Annotated[int,DBusSignature(signature=i)]
- dbus_fast.annotations.DBusInt64¶
D-Bus INT64 type (“x”).
alias of
Annotated[int,DBusSignature(signature=x)]
- dbus_fast.annotations.DBusObjectPath¶
D-Bus OBJECT_PATH type (“o”).
alias of
Annotated[str,DBusSignature(signature=o)]
- class dbus_fast.annotations.DBusSignature(signature: str)¶
A D-Bus signature annotation.
This class is used to create D-Bus type annotations. For example:
from typing import Annotated from dbus_fast.annotations import DBusSignature MyDBusStruct = Annotated[tuple[int, str], DBusSignature("(is)")]
- signature: str¶
- dbus_fast.annotations.DBusSignatureType¶
D-Bus SIGNATURE type (“g”).
Note
This one doesn’t follow the established naming convention since “DBusSignature” is used for the annotation itself.
alias of
Annotated[str,DBusSignature(signature=g)]
- dbus_fast.annotations.DBusStr¶
D-Bus STRING type (“s”).
alias of
Annotated[str,DBusSignature(signature=s)]
- dbus_fast.annotations.DBusUInt16¶
D-Bus UINT16 type (“q”).
alias of
Annotated[int,DBusSignature(signature=q)]
- dbus_fast.annotations.DBusUInt32¶
D-Bus UINT32 type (“u”).
alias of
Annotated[int,DBusSignature(signature=u)]
- dbus_fast.annotations.DBusUInt64¶
D-Bus UINT64 type (“t”).
alias of
Annotated[int,DBusSignature(signature=t)]
- dbus_fast.annotations.DBusUnixFd¶
D-Bus UNIX_FD type (“h”).
alias of
Annotated[int,DBusSignature(signature=h)]
- dbus_fast.annotations.DBusVariant¶
D-Bus VARIANT type (“v”).
alias of
Annotated[Variant,DBusSignature(signature=v)]