class documentation

Base class for UaVariable containers. Also provides a Pythonic container interface.

Method __contains__ Whether a variable with given name exists in this container.
Method __getitem__ Get a UaVariable by the given name.
Method __init__ Cooperative constructor.
Method __iter__ Iterate over the contained UaVariable.
Method __len__ Return the number of contained UaVariable.
Async Method add Add the given variable to the container. Can be used to add existing variables to other containers.
Async Method read_all Read all contained variables and return a mapping from variable name to value.
Async Method reset_all Reset all contained UaVariable to their initial value.
Async Method write_all Write to all given mapping of variables name and their values.
Method _check_required_variables Check we have all required existing variables based on annotations.
Async Method _init_existing_variables Undocumented
Async Method _lifecycle_container Undocumented
def __contains__(self, key: object) -> bool:

Whether a variable with given name exists in this container.

def __getitem__(self, name: str) -> UaVariable:

Get a UaVariable by the given name.

Raises
KeyErrorIf no variable with given name exists.
def __init__(self, *, name: str, minimum_access_level: int | None = None, writable: bool = False, **kwargs):

Cooperative constructor.

Parameters
name:strThe name of the container.
minimum_access_level:int | NoneThe minimum access level of the container.
writable:boolWhether the all UaVariable of this container have external OPC UA write access.
**kwargsUndocumented
def __iter__(self) -> Iterator[UaVariable]:

Iterate over the contained UaVariable.

def __len__(self) -> int:

Return the number of contained UaVariable.

async def add(self, variable: UaVariable, *, exist_ok: bool = False, remove_existing: bool = False):

Add the given variable to the container. Can be used to add existing variables to other containers.

If the variable is not initialized yet, it will be initialized with this container as parent.

Parameters
variable:UaVariableUaVariable to add to the container.
exist_ok:boolWhether to reuse an existing OPC UA variable node if found during initialization.
remove_existing:boolWhether to remove existing OPC UA variable node if found during initialization.
async def read_all(self) -> Mapping[str, Any]:

Read all contained variables and return a mapping from variable name to value.

async def reset_all(self):

Reset all contained UaVariable to their initial value.

async def write_all(self, mapping: Mapping[str, Any]):

Write to all given mapping of variables name and their values.

Raises
KeyErrorIf no variable with given name in mapping exists.
OutOfRangeErrorif value of mapping is not within the range of the corresponding variable.
def _check_required_variables(self, annotations: dict[str, object]):

Check we have all required existing variables based on annotations.

async def _init_existing_variables(self):

Undocumented

@lifecycle
async def _lifecycle_container(self) -> AsyncGenerator[None]:

Undocumented