MCPcopy Create free account
hub / github.com/FreeOpcUa/python-opcua / wrapper

Function wrapper

opcua/common/methods.py:62–80  ·  view source on GitHub ↗
(parent, *args)

Source from the content-addressed store, hash-verified

60 arguments and output to and from variants
61 """
62 def wrapper(parent, *args):
63 if isinstance(parent, ua.NodeId):
64 result = func(parent, *[arg.Value for arg in args])
65 else:
66 self = parent
67 parent = args[0]
68 args = args[1:]
69 result = func(self, parent, *[arg.Value for arg in args])
70 if result is None:
71 return []
72 elif isinstance(result, ua.CallMethodResult):
73 result.OutputArguments = to_variant(*result.OutputArguments)
74 return result
75 elif isinstance(result, ua.StatusCode):
76 return result
77 elif isinstance(result, tuple):
78 return to_variant(*result)
79 else:
80 return to_variant(result)
81 return wrapper
82
83

Callers

nothing calls this directly

Calls 2

to_variantFunction · 0.85
funcFunction · 0.50

Tested by

no test coverage detected