heros.capabilities¶
Classes¶
An attribute capability describes a single variable of the remote object. |
|
An event capability describes the ability of a remote object to notify upon a certain event. |
|
Functions¶
|
Transforms annotation given as types to strings. |
Module Contents¶
- heros.capabilities.type_to_str(annotation) str¶
Transforms annotation given as types to strings.
- Parameters:
annotation – The typing annotation.
- Returns:
Annotation as string.
- class heros.capabilities.Parameter¶
- name: str¶
- type: str¶
- default: str¶
- kind: inspect._ParameterKind¶
- static from_signature_parameter(p: inspect.Parameter)¶
- has_default()¶
- to_dict()¶
- static from_dict(d: dict, proto_version: float = __proto_version__)¶
- class heros.capabilities.Capability¶
- name: str¶
- flavor: ClassVar[str] = 'undefined'¶
- to_dict()¶
- static from_dict(d: dict, proto_version: float = __proto_version__)¶
- class heros.capabilities.AttributeCapability¶
Bases:
CapabilityAn attribute capability describes a single variable of the remote object. It is exposed under the name of the capability.
- Parameters:
name – name of the capability
type – data type. E.g. “str”, “int”, “float”, “list”, …
access – Read and/or write access. “r” for read, “w” for write, and “rw” for both
- flavor: ClassVar[str] = 'attribute'¶
- type: str¶
- access: str = 'rw'¶
- to_dict() dict¶
- static from_dict(d: dict, proto_version: float = __proto_version__) AttributeCapability¶
- class heros.capabilities.EventCapability¶
Bases:
CapabilityAn event capability describes the ability of a remote object to notify upon a certain event.
- flavor: ClassVar[str] = 'event'¶
- static from_dict(d: dict, proto_version: float = __proto_version__) EventCapability¶
- class heros.capabilities.MethodCapability¶
Bases:
Capability- flavor: ClassVar[str] = 'method'¶
- return_type: str = 'None'¶
- static from_method(m: Callable, name: str | None = None) MethodCapability¶
- to_signature() inspect.Signature¶
- to_dict() dict¶
- static from_dict(d: dict, proto_version: float = __proto_version__) MethodCapability¶
Generate a method capabilities object from a defining dictionary.
Args: definition of the capability according to the standard
- call_dict(*args, **kwargs) dict¶
This returns a dict that assigns the given parameter to the parameters of ourself. It takes care that positional and keyword arguments are handled correctly
Note
This function is deprecated and will be removed together with the transport protocol version 0.1
- Parameters:
*args – positional arguments
**kwargs – keyword arguments
- Returns:
dict with parameter assignments
- Return type:
dict