Code Duplication    Length = 7-10 lines in 2 locations

opcua/common/subscription.py 1 location

@@ 315-324 (lines=10) @@
312
                data = self._monitoreditems_map[mi.RequestedParameters.ClientHandle]
313
                data.server_handle = result.MonitoredItemId
314
                mids.append(result.MonitoredItemId)
315
        return mids
316
317
    def unsubscribe(self, handle):
318
        """
319
        unsubscribe to datachange or events using the handle returned while subscribing
320
        if you delete subscription, you do not need to unsubscribe
321
        """
322
        params = ua.DeleteMonitoredItemsParameters()
323
        params.SubscriptionId = self.subscription_id
324
        params.MonitoredItemIds = [handle]
325
        results = self.server.delete_monitored_items(params)
326
        results[0].check()
327
        with self._lock:

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