Code Duplication    Length = 16-16 lines in 2 locations

opcua/common/node.py 2 locations

@@ 368-383 (lines=16) @@
365
        result = self.history_read(details)
366
        return result.HistoryData.DataValues
367
368
    def history_read(self, details):
369
        """
370
        Read raw history of a node, low-level function
371
        result code from server is checked and an exception is raised in case of error
372
        """
373
        valueid = ua.HistoryReadValueId()
374
        valueid.NodeId = self.nodeid
375
        valueid.IndexRange = ''
376
377
        params = ua.HistoryReadParameters()
378
        params.HistoryReadDetails = details
379
        params.TimestampsToReturn = ua.TimestampsToReturn.Both
380
        params.ReleaseContinuationPoints = False
381
        params.NodesToRead.append(valueid)
382
        result = self.server.history_read(params)[0]
383
        return result
384
385
    def read_event_history(self, starttime=None, endtime=None, numvalues=0, evtypes=ua.ObjectIds.BaseEventType):
386
        """
@@ 424-439 (lines=16) @@
421
            event_res.append(events.Event.from_event_fields(evfilter.SelectClauses, res.EventFields))
422
        return event_res
423
424
    def history_read_events(self, details):
425
        """
426
        Read event history of a node, low-level function
427
        result code from server is checked and an exception is raised in case of error
428
        """
429
        valueid = ua.HistoryReadValueId()
430
        valueid.NodeId = self.nodeid
431
        valueid.IndexRange = ''
432
433
        params = ua.HistoryReadParameters()
434
        params.HistoryReadDetails = details
435
        params.TimestampsToReturn = ua.TimestampsToReturn.Both
436
        params.ReleaseContinuationPoints = False
437
        params.NodesToRead.append(valueid)
438
        result = self.server.history_read(params)[0]
439
        return result
440
441
    # Hack for convenience methods
442
    # local import is ugly but necessary for python2 support