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

Class NodeId

opcua/ua/uatypes.py:261–411  ·  view source on GitHub ↗

NodeId Object Args: identifier: The identifier might be an int, a string, bytes or a Guid namespaceidx(int): The index of the namespace nodeidtype(NodeIdType): The type of the nodeid if it cannor be guess or you want something special like twobyte nodeid or fourbyte

Source from the content-addressed store, hash-verified

259
260
261class NodeId(object):
262 """
263 NodeId Object
264
265 Args:
266 identifier: The identifier might be an int, a string, bytes or a Guid
267 namespaceidx(int): The index of the namespace
268 nodeidtype(NodeIdType): The type of the nodeid if it cannor be guess or you want something special like twobyte nodeid or fourbytenodeid
269
270
271 :ivar Identifier:
272 :vartype Identifier: NodeId
273 :ivar NamespaceIndex:
274 :vartype NamespaceIndex: Int
275 :ivar NamespaceUri:
276 :vartype NamespaceUri: String
277 :ivar ServerIndex:
278 :vartype ServerIndex: Int
279 """
280
281 def __init__(self, identifier=None, namespaceidx=0, nodeidtype=None):
282
283 self.Identifier = identifier
284 self.NamespaceIndex = namespaceidx
285 self.NodeIdType = nodeidtype
286 self.NamespaceUri = ""
287 self.ServerIndex = 0
288 self._freeze = True
289 if self.Identifier is None:
290 self.Identifier = 0
291 if namespaceidx == 0:
292 self.NodeIdType = NodeIdType.TwoByte
293 else: # TwoByte NodeId does not encode namespace.
294 self.NodeIdType = NodeIdType.Numeric
295 return
296 if self.NodeIdType is None:
297 if isinstance(self.Identifier, int):
298 self.NodeIdType = NodeIdType.Numeric
299 elif isinstance(self.Identifier, str):
300 self.NodeIdType = NodeIdType.String
301 elif isinstance(self.Identifier, bytes):
302 self.NodeIdType = NodeIdType.ByteString
303 elif isinstance(self.Identifier, uuid.UUID):
304 self.NodeIdType = NodeIdType.Guid
305 else:
306 raise UaError("NodeId: Could not guess type of NodeId, set NodeIdType")
307
308 def __eq__(self, node):
309 return isinstance(node, NodeId) and self.NamespaceIndex == node.NamespaceIndex and self.Identifier == node.Identifier
310
311 def __ne__(self, other):
312 return not self.__eq__(other)
313
314 def __hash__(self):
315 return hash((self.NamespaceIndex, self.Identifier))
316
317 def __lt__(self, other):
318 if not isinstance(other, NodeId):

Callers 15

server-example.pyFile · 0.90
_from_stringMethod · 0.85
__init__Method · 0.85
get_default_valueFunction · 0.85
__init__Method · 0.85
__init__Method · 0.85
__init__Method · 0.85
__init__Method · 0.85
__init__Method · 0.85
__init__Method · 0.85
__init__Method · 0.85
__init__Method · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected