Code Duplication    Length = 29-31 lines in 6 locations

opcua/ua/uaprotocol_auto.py 6 locations

@@ 2386-2416 (lines=31) @@
2383
    def __str__(self):
2384
        return 'GetEndpointsRequest(' + 'TypeId:' + str(self.TypeId) + ', ' + \
2385
               'RequestHeader:' + str(self.RequestHeader) + ', ' + \
2386
               'Parameters:' + str(self.Parameters) + ')'
2387
2388
    __repr__ = __str__
2389
2390
2391
class GetEndpointsResponse(FrozenClass):
2392
    '''
2393
    Gets the endpoints used by the server.
2394
2395
    :ivar TypeId:
2396
    :vartype TypeId: NodeId
2397
    :ivar ResponseHeader:
2398
    :vartype ResponseHeader: ResponseHeader
2399
    :ivar Endpoints:
2400
    :vartype Endpoints: EndpointDescription
2401
    '''
2402
2403
    ua_types = (
2404
2405
        ('TypeId', 'NodeId'),
2406
        ('ResponseHeader', 'ResponseHeader'),
2407
        ('Endpoints', 'ListOfEndpointDescription'),
2408
               )
2409
2410
    def __init__(self, binary=None):
2411
        if binary is not None:
2412
            self._binary_init(binary)
2413
            self._freeze = True
2414
            return
2415
        self.TypeId = FourByteNodeId(ObjectIds.GetEndpointsResponse_Encoding_DefaultBinary)
2416
        self.ResponseHeader = ResponseHeader()
2417
        self.Endpoints = []
2418
        self._freeze = True
2419
@@ 1084-1114 (lines=31) @@
1081
1082
class TrustListDataType(FrozenClass):
1083
    '''
1084
    :ivar SpecifiedLists:
1085
    :vartype SpecifiedLists: UInt32
1086
    :ivar TrustedCertificates:
1087
    :vartype TrustedCertificates: ByteString
1088
    :ivar TrustedCrls:
1089
    :vartype TrustedCrls: ByteString
1090
    :ivar IssuerCertificates:
1091
    :vartype IssuerCertificates: ByteString
1092
    :ivar IssuerCrls:
1093
    :vartype IssuerCrls: ByteString
1094
    '''
1095
1096
    ua_types = (
1097
1098
        ('SpecifiedLists', 'UInt32'),
1099
        ('TrustedCertificates', 'ListOfByteString'),
1100
        ('TrustedCrls', 'ListOfByteString'),
1101
        ('IssuerCertificates', 'ListOfByteString'),
1102
        ('IssuerCrls', 'ListOfByteString'),
1103
               )
1104
1105
    def __init__(self, binary=None):
1106
        if binary is not None:
1107
            self._binary_init(binary)
1108
            self._freeze = True
1109
            return
1110
        self.SpecifiedLists = 0
1111
        self.TrustedCertificates = []
1112
        self.TrustedCrls = []
1113
        self.IssuerCertificates = []
1114
        self.IssuerCrls = []
1115
        self._freeze = True
1116
1117
    def to_binary(self):
@@ 13233-13261 (lines=29) @@
13230
        self.RequestedLifetimeCount = 0
13231
        self.RequestedMaxKeepAliveCount = 0
13232
        self.MaxNotificationsPerPublish = 0
13233
        self.Priority = 0
13234
        self._freeze = True
13235
13236
    def to_binary(self):
13237
        packet = []
13238
        packet.append(uabin.Primitives.UInt32.pack(self.SubscriptionId))
13239
        packet.append(uabin.Primitives.Double.pack(self.RequestedPublishingInterval))
13240
        packet.append(uabin.Primitives.UInt32.pack(self.RequestedLifetimeCount))
13241
        packet.append(uabin.Primitives.UInt32.pack(self.RequestedMaxKeepAliveCount))
13242
        packet.append(uabin.Primitives.UInt32.pack(self.MaxNotificationsPerPublish))
13243
        packet.append(uabin.Primitives.Byte.pack(self.Priority))
13244
        return b''.join(packet)
13245
13246
    @staticmethod
13247
    def from_binary(data):
13248
        return ModifySubscriptionParameters(data)
13249
13250
    def _binary_init(self, data):
13251
        self.SubscriptionId = uabin.Primitives.UInt32.unpack(data)
13252
        self.RequestedPublishingInterval = uabin.Primitives.Double.unpack(data)
13253
        self.RequestedLifetimeCount = uabin.Primitives.UInt32.unpack(data)
13254
        self.RequestedMaxKeepAliveCount = uabin.Primitives.UInt32.unpack(data)
13255
        self.MaxNotificationsPerPublish = uabin.Primitives.UInt32.unpack(data)
13256
        self.Priority = uabin.Primitives.Byte.unpack(data)
13257
13258
    def __str__(self):
13259
        return 'ModifySubscriptionParameters(' + 'SubscriptionId:' + str(self.SubscriptionId) + ', ' + \
13260
               'RequestedPublishingInterval:' + str(self.RequestedPublishingInterval) + ', ' + \
13261
               'RequestedLifetimeCount:' + str(self.RequestedLifetimeCount) + ', ' + \
13262
               'RequestedMaxKeepAliveCount:' + str(self.RequestedMaxKeepAliveCount) + ', ' + \
13263
               'MaxNotificationsPerPublish:' + str(self.MaxNotificationsPerPublish) + ', ' + \
13264
               'Priority:' + str(self.Priority) + ')'
@@ 11125-11153 (lines=29) @@
11122
    ua_types = (
11123
11124
        ('MethodsToCall', 'ListOfCallMethodRequest'),
11125
               )
11126
11127
    def __init__(self, binary=None):
11128
        if binary is not None:
11129
            self._binary_init(binary)
11130
            self._freeze = True
11131
            return
11132
        self.MethodsToCall = []
11133
        self._freeze = True
11134
11135
    def to_binary(self):
11136
        packet = []
11137
        packet.append(uabin.Primitives.Int32.pack(len(self.MethodsToCall)))
11138
        for fieldname in self.MethodsToCall:
11139
            packet.append(fieldname.to_binary())
11140
        return b''.join(packet)
11141
11142
    @staticmethod
11143
    def from_binary(data):
11144
        return CallParameters(data)
11145
11146
    def _binary_init(self, data):
11147
        length = uabin.Primitives.Int32.unpack(data)
11148
        array = []
11149
        if length != -1:
11150
            for _ in range(0, length):
11151
                array.append(CallMethodRequest.from_binary(data))
11152
        self.MethodsToCall = array
11153
11154
    def __str__(self):
11155
        return 'CallParameters(' + 'MethodsToCall:' + str(self.MethodsToCall) + ')'
11156
@@ 10873-10901 (lines=29) @@
10870
        ('Parameters', 'HistoryUpdateParameters'),
10871
               )
10872
10873
    def __init__(self, binary=None):
10874
        if binary is not None:
10875
            self._binary_init(binary)
10876
            self._freeze = True
10877
            return
10878
        self.TypeId = FourByteNodeId(ObjectIds.HistoryUpdateRequest_Encoding_DefaultBinary)
10879
        self.RequestHeader = RequestHeader()
10880
        self.Parameters = HistoryUpdateParameters()
10881
        self._freeze = True
10882
10883
    def to_binary(self):
10884
        packet = []
10885
        packet.append(self.TypeId.to_binary())
10886
        packet.append(self.RequestHeader.to_binary())
10887
        packet.append(self.Parameters.to_binary())
10888
        return b''.join(packet)
10889
10890
    @staticmethod
10891
    def from_binary(data):
10892
        return HistoryUpdateRequest(data)
10893
10894
    def _binary_init(self, data):
10895
        self.TypeId = NodeId.from_binary(data)
10896
        self.RequestHeader = RequestHeader.from_binary(data)
10897
        self.Parameters = HistoryUpdateParameters.from_binary(data)
10898
10899
    def __str__(self):
10900
        return 'HistoryUpdateRequest(' + 'TypeId:' + str(self.TypeId) + ', ' + \
10901
               'RequestHeader:' + str(self.RequestHeader) + ', ' + \
10902
               'Parameters:' + str(self.Parameters) + ')'
10903
10904
    __repr__ = __str__
@@ 9118-9146 (lines=29) @@
9115
        if binary is not None:
9116
            self._binary_init(binary)
9117
            self._freeze = True
9118
            return
9119
        self.TypeId = FourByteNodeId(ObjectIds.QueryNextResponse_Encoding_DefaultBinary)
9120
        self.ResponseHeader = ResponseHeader()
9121
        self.Parameters = QueryNextResult()
9122
        self._freeze = True
9123
9124
    def to_binary(self):
9125
        packet = []
9126
        packet.append(self.TypeId.to_binary())
9127
        packet.append(self.ResponseHeader.to_binary())
9128
        packet.append(self.Parameters.to_binary())
9129
        return b''.join(packet)
9130
9131
    @staticmethod
9132
    def from_binary(data):
9133
        return QueryNextResponse(data)
9134
9135
    def _binary_init(self, data):
9136
        self.TypeId = NodeId.from_binary(data)
9137
        self.ResponseHeader = ResponseHeader.from_binary(data)
9138
        self.Parameters = QueryNextResult.from_binary(data)
9139
9140
    def __str__(self):
9141
        return 'QueryNextResponse(' + 'TypeId:' + str(self.TypeId) + ', ' + \
9142
               'ResponseHeader:' + str(self.ResponseHeader) + ', ' + \
9143
               'Parameters:' + str(self.Parameters) + ')'
9144
9145
    __repr__ = __str__
9146
9147
9148
class ReadValueId(FrozenClass):
9149
    '''