Code Duplication    Length = 24-28 lines in 2 locations

opcua/ua/uaprotocol_auto.py 2 locations

@@ 11677-11704 (lines=28) @@
11674
    ua_types = [
11675
        ('SubscriptionId', 'UInt32'),
11676
        ('RevisedPublishingInterval', 'Double'),
11677
        ('RevisedLifetimeCount', 'UInt32'),
11678
        ('RevisedMaxKeepAliveCount', 'UInt32'),
11679
               ]
11680
11681
    def __init__(self):
11682
        self.SubscriptionId = 0
11683
        self.RevisedPublishingInterval = 0
11684
        self.RevisedLifetimeCount = 0
11685
        self.RevisedMaxKeepAliveCount = 0
11686
        self._freeze = True
11687
11688
    def to_binary(self):
11689
        packet = []
11690
        packet.append(uabin.Primitives.UInt32.pack(self.SubscriptionId))
11691
        packet.append(uabin.Primitives.Double.pack(self.RevisedPublishingInterval))
11692
        packet.append(uabin.Primitives.UInt32.pack(self.RevisedLifetimeCount))
11693
        packet.append(uabin.Primitives.UInt32.pack(self.RevisedMaxKeepAliveCount))
11694
        return b''.join(packet)
11695
11696
    @staticmethod
11697
    def from_binary(data):
11698
        obj = CreateSubscriptionResult()
11699
        self.SubscriptionId = uabin.Primitives.UInt32.unpack(data)
11700
        self.RevisedPublishingInterval = uabin.Primitives.Double.unpack(data)
11701
        self.RevisedLifetimeCount = uabin.Primitives.UInt32.unpack(data)
11702
        self.RevisedMaxKeepAliveCount = uabin.Primitives.UInt32.unpack(data)
11703
        return obj
11704
11705
    def __str__(self):
11706
        return 'CreateSubscriptionResult(' + 'SubscriptionId:' + str(self.SubscriptionId) + ', ' + \
11707
               'RevisedPublishingInterval:' + str(self.RevisedPublishingInterval) + ', ' + \
@@ 8183-8206 (lines=24) @@
8180
    def from_binary(data):
8181
        obj = ReadValueId()
8182
        obj.NodeId = NodeId.from_binary(data)
8183
        self.AttributeId = uabin.Primitives.UInt32.unpack(data)
8184
        self.IndexRange = uabin.Primitives.String.unpack(data)
8185
        obj.DataEncoding = QualifiedName.from_binary(data)
8186
        return obj
8187
8188
    def __str__(self):
8189
        return 'ReadValueId(' + 'NodeId:' + str(self.NodeId) + ', ' + \
8190
               'AttributeId:' + str(self.AttributeId) + ', ' + \
8191
               'IndexRange:' + str(self.IndexRange) + ', ' + \
8192
               'DataEncoding:' + str(self.DataEncoding) + ')'
8193
8194
    __repr__ = __str__
8195
8196
8197
class ReadParameters(FrozenClass):
8198
    '''
8199
    :ivar MaxAge:
8200
    :vartype MaxAge: Double
8201
    :ivar TimestampsToReturn:
8202
    :vartype TimestampsToReturn: TimestampsToReturn
8203
    :ivar NodesToRead:
8204
    :vartype NodesToRead: ReadValueId
8205
    '''
8206
8207
    ua_types = [
8208
        ('MaxAge', 'Double'),
8209
        ('TimestampsToReturn', 'TimestampsToReturn'),