Ejemplo n.º 1
0
 def _get_val_type(self, obj, attname: str):
     for field in fields(obj):
         if field.name == attname:
             return type_string_from_type(field.type)
     raise UaError(
         f"Attribute '{attname}' defined in xml is not found in object '{obj}'"
     )
Ejemplo n.º 2
0
 async def _all_fields_to_etree(self, struct_el, val):
     for field in fields(val):
         # FIXME; what happend if we have a custom type which is not part of ObjectIds???
         if field.name == "Encoding":
             continue
         type_name = type_string_from_type(field.type)
         await self.member_to_etree(struct_el, field.name, ua.NodeId(getattr(ua.ObjectIds, type_name)), getattr(val, field.name))
Ejemplo n.º 3
0
def _get_uatype_name(cls, attname):
    for field in fields(cls):
        if field.name == attname:
            return type_string_from_type(field.type)
    raise Exception(f"Could not find attribute {attname} in obj {cls}")