Code Duplication    Length = 7-10 lines in 2 locations

opcua/common/subscription.py 1 location

@@ 315-324 (lines=10) @@
312
    properties = []
313
    curr_node = node
314
315
    while True:
316
        properties.extend(curr_node.get_properties())
317
318
        if curr_node.nodeid.Identifier == ua.ObjectIds.BaseEventType:
319
            break
320
321
        parents = curr_node.get_referenced_nodes(refs=ua.ObjectIds.HasSubtype, direction=ua.BrowseDirection.Inverse, includesubtypes=False)
322
        if len(parents) != 1: # Something went wrong
323
            return None
324
        curr_node = parents[0]
325
326
    return properties
327

opcua/server/event.py 1 location

@@ 111-117 (lines=7) @@
108
                self.EventType = node.nodeid
109
                curr_node = node
110
111
                while curr_node.nodeid.Identifier != parent_identifier:
112
                    for prop in curr_node.get_properties():
113
                        setattr(self, prop.get_browse_name().Name, prop.get_value())
114
                    parents = curr_node.get_referenced_nodes(refs=ua.ObjectIds.HasSubtype, direction=ua.BrowseDirection.Inverse, includesubtypes=False)
115
                    if len(parents) != 1: # Something went wrong
116
                        return None
117
                    curr_node = parents[0]
118
119
                self._freeze = True
120