Code Duplication    Length = 51-51 lines in 4 locations

opcua/ua/uaprotocol_auto.py 4 locations

@@ 14894-14944 (lines=51) @@
14891
    __repr__ = __str__
14892
14893
14894
class EUInformation(FrozenClass):
14895
    '''
14896
    :ivar NamespaceUri:
14897
    :vartype NamespaceUri: String
14898
    :ivar UnitId:
14899
    :vartype UnitId: Int32
14900
    :ivar DisplayName:
14901
    :vartype DisplayName: LocalizedText
14902
    :ivar Description:
14903
    :vartype Description: LocalizedText
14904
    '''
14905
14906
    ua_types = [
14907
14908
        ('NamespaceUri', 'String'),
14909
        ('UnitId', 'Int32'),
14910
        ('DisplayName', 'LocalizedText'),
14911
        ('Description', 'LocalizedText'),
14912
               ]
14913
14914
    def __init__(self):
14915
        self.NamespaceUri = None
14916
        self.UnitId = 0
14917
        self.DisplayName = LocalizedText()
14918
        self.Description = LocalizedText()
14919
        self._freeze = True
14920
14921
    def to_binary(self):
14922
        packet = []
14923
        packet.append(uabin.Primitives.String.pack(self.NamespaceUri))
14924
        packet.append(uabin.Primitives.Int32.pack(self.UnitId))
14925
        packet.append(self.DisplayName.to_binary())
14926
        packet.append(self.Description.to_binary())
14927
        return b''.join(packet)
14928
14929
    @staticmethod
14930
    def from_binary(data):
14931
        obj = EUInformation()
14932
        self.NamespaceUri = uabin.Primitives.String.unpack(data)
14933
        self.UnitId = uabin.Primitives.Int32.unpack(data)
14934
        obj.DisplayName = LocalizedText.from_binary(data)
14935
        obj.Description = LocalizedText.from_binary(data)
14936
        return obj
14937
14938
    def __str__(self):
14939
        return 'EUInformation(' + 'NamespaceUri:' + str(self.NamespaceUri) + ', ' + \
14940
               'UnitId:' + str(self.UnitId) + ', ' + \
14941
               'DisplayName:' + str(self.DisplayName) + ', ' + \
14942
               'Description:' + str(self.Description) + ')'
14943
14944
    __repr__ = __str__
14945
14946
14947
class ComplexNumberType(FrozenClass):
@@ 9356-9406 (lines=51) @@
9353
    __repr__ = __str__
9354
9355
9356
class WriteValue(FrozenClass):
9357
    '''
9358
    :ivar NodeId:
9359
    :vartype NodeId: NodeId
9360
    :ivar AttributeId:
9361
    :vartype AttributeId: UInt32
9362
    :ivar IndexRange:
9363
    :vartype IndexRange: String
9364
    :ivar Value:
9365
    :vartype Value: DataValue
9366
    '''
9367
9368
    ua_types = [
9369
9370
        ('NodeId', 'NodeId'),
9371
        ('AttributeId', 'UInt32'),
9372
        ('IndexRange', 'String'),
9373
        ('Value', 'DataValue'),
9374
               ]
9375
9376
    def __init__(self):
9377
        self.NodeId = NodeId()
9378
        self.AttributeId = 0
9379
        self.IndexRange = None
9380
        self.Value = DataValue()
9381
        self._freeze = True
9382
9383
    def to_binary(self):
9384
        packet = []
9385
        packet.append(self.NodeId.to_binary())
9386
        packet.append(uabin.Primitives.UInt32.pack(self.AttributeId))
9387
        packet.append(uabin.Primitives.String.pack(self.IndexRange))
9388
        packet.append(self.Value.to_binary())
9389
        return b''.join(packet)
9390
9391
    @staticmethod
9392
    def from_binary(data):
9393
        obj = WriteValue()
9394
        obj.NodeId = NodeId.from_binary(data)
9395
        self.AttributeId = uabin.Primitives.UInt32.unpack(data)
9396
        self.IndexRange = uabin.Primitives.String.unpack(data)
9397
        obj.Value = DataValue.from_binary(data)
9398
        return obj
9399
9400
    def __str__(self):
9401
        return 'WriteValue(' + 'NodeId:' + str(self.NodeId) + ', ' + \
9402
               'AttributeId:' + str(self.AttributeId) + ', ' + \
9403
               'IndexRange:' + str(self.IndexRange) + ', ' + \
9404
               'Value:' + str(self.Value) + ')'
9405
9406
    __repr__ = __str__
9407
9408
9409
class WriteParameters(FrozenClass):
@@ 8660-8710 (lines=51) @@
8657
    __repr__ = __str__
8658
8659
8660
class HistoryReadValueId(FrozenClass):
8661
    '''
8662
    :ivar NodeId:
8663
    :vartype NodeId: NodeId
8664
    :ivar IndexRange:
8665
    :vartype IndexRange: String
8666
    :ivar DataEncoding:
8667
    :vartype DataEncoding: QualifiedName
8668
    :ivar ContinuationPoint:
8669
    :vartype ContinuationPoint: ByteString
8670
    '''
8671
8672
    ua_types = [
8673
8674
        ('NodeId', 'NodeId'),
8675
        ('IndexRange', 'String'),
8676
        ('DataEncoding', 'QualifiedName'),
8677
        ('ContinuationPoint', 'ByteString'),
8678
               ]
8679
8680
    def __init__(self):
8681
        self.NodeId = NodeId()
8682
        self.IndexRange = None
8683
        self.DataEncoding = QualifiedName()
8684
        self.ContinuationPoint = None
8685
        self._freeze = True
8686
8687
    def to_binary(self):
8688
        packet = []
8689
        packet.append(self.NodeId.to_binary())
8690
        packet.append(uabin.Primitives.String.pack(self.IndexRange))
8691
        packet.append(self.DataEncoding.to_binary())
8692
        packet.append(uabin.Primitives.ByteString.pack(self.ContinuationPoint))
8693
        return b''.join(packet)
8694
8695
    @staticmethod
8696
    def from_binary(data):
8697
        obj = HistoryReadValueId()
8698
        obj.NodeId = NodeId.from_binary(data)
8699
        self.IndexRange = uabin.Primitives.String.unpack(data)
8700
        obj.DataEncoding = QualifiedName.from_binary(data)
8701
        self.ContinuationPoint = uabin.Primitives.ByteString.unpack(data)
8702
        return obj
8703
8704
    def __str__(self):
8705
        return 'HistoryReadValueId(' + 'NodeId:' + str(self.NodeId) + ', ' + \
8706
               'IndexRange:' + str(self.IndexRange) + ', ' + \
8707
               'DataEncoding:' + str(self.DataEncoding) + ', ' + \
8708
               'ContinuationPoint:' + str(self.ContinuationPoint) + ')'
8709
8710
    __repr__ = __str__
8711
8712
8713
class HistoryReadResult(FrozenClass):
@@ 8441-8491 (lines=51) @@
8438
    __repr__ = __str__
8439
8440
8441
class ReadValueId(FrozenClass):
8442
    '''
8443
    :ivar NodeId:
8444
    :vartype NodeId: NodeId
8445
    :ivar AttributeId:
8446
    :vartype AttributeId: UInt32
8447
    :ivar IndexRange:
8448
    :vartype IndexRange: String
8449
    :ivar DataEncoding:
8450
    :vartype DataEncoding: QualifiedName
8451
    '''
8452
8453
    ua_types = [
8454
8455
        ('NodeId', 'NodeId'),
8456
        ('AttributeId', 'UInt32'),
8457
        ('IndexRange', 'String'),
8458
        ('DataEncoding', 'QualifiedName'),
8459
               ]
8460
8461
    def __init__(self):
8462
        self.NodeId = NodeId()
8463
        self.AttributeId = 0
8464
        self.IndexRange = None
8465
        self.DataEncoding = QualifiedName()
8466
        self._freeze = True
8467
8468
    def to_binary(self):
8469
        packet = []
8470
        packet.append(self.NodeId.to_binary())
8471
        packet.append(uabin.Primitives.UInt32.pack(self.AttributeId))
8472
        packet.append(uabin.Primitives.String.pack(self.IndexRange))
8473
        packet.append(self.DataEncoding.to_binary())
8474
        return b''.join(packet)
8475
8476
    @staticmethod
8477
    def from_binary(data):
8478
        obj = ReadValueId()
8479
        obj.NodeId = NodeId.from_binary(data)
8480
        self.AttributeId = uabin.Primitives.UInt32.unpack(data)
8481
        self.IndexRange = uabin.Primitives.String.unpack(data)
8482
        obj.DataEncoding = QualifiedName.from_binary(data)
8483
        return obj
8484
8485
    def __str__(self):
8486
        return 'ReadValueId(' + 'NodeId:' + str(self.NodeId) + ', ' + \
8487
               'AttributeId:' + str(self.AttributeId) + ', ' + \
8488
               'IndexRange:' + str(self.IndexRange) + ', ' + \
8489
               'DataEncoding:' + str(self.DataEncoding) + ')'
8490
8491
    __repr__ = __str__
8492
8493
8494
class ReadParameters(FrozenClass):