Code Duplication    Length = 7-10 lines in 2 locations

opcua/common/subscription.py 1 location

@@ 315-324 (lines=10) @@
312
        mparams.QueueSize = queuesize
313
        mparams.DiscardOldest = True
314
        if mfilter:
315
            mparams.Filter = mfilter
316
        mir = ua.MonitoredItemCreateRequest()
317
        mir.ItemToMonitor = rv
318
        mir.MonitoringMode = ua.MonitoringMode.Reporting
319
        mir.RequestedParameters = mparams
320
        return mir
321
322
    def create_monitored_items(self, monitored_items):
323
        """
324
        low level method to have full control over subscription parameters
325
        Client handle must be unique since it will be used as key for internal registration of data
326
        """
327
        params = ua.CreateMonitoredItemsParameters()

opcua/server/event.py 1 location

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