Code Duplication    Length = 7-10 lines in 2 locations

opcua/common/event.py 2 locations

@@ 120-129 (lines=10) @@
117
118
    print node
119
120
    while True:
121
        properties.extend(curr_node.get_properties())
122
123
        if curr_node.nodeid.Identifier == ua.ObjectIds.BaseEventType:
124
            break
125
126
        parents = curr_node.get_referenced_nodes(refs=ua.ObjectIds.HasSubtype, direction=ua.BrowseDirection.Inverse, includesubtypes=False)
127
        if len(parents) != 1: # Something went wrong
128
            return None
129
        curr_node = parents[0]
130
131
    return properties
132
@@ 101-107 (lines=7) @@
98
                self.EventType = node.nodeid
99
                curr_node = node
100
101
                while curr_node.nodeid.Identifier != parent_identifier:
102
                    for prop in curr_node.get_properties():
103
                        setattr(self, prop.get_browse_name().Name, prop.get_value())
104
                    parents = curr_node.get_referenced_nodes(refs=ua.ObjectIds.HasSubtype, direction=ua.BrowseDirection.Inverse, includesubtypes=False)
105
                    if len(parents) != 1: # Something went wrong
106
                        return None
107
                    curr_node = parents[0]
108
109
                self._freeze = True
110