Code Duplication    Length = 55-55 lines in 5 locations

opcua/ua/uaprotocol_auto.py 5 locations

@@ 9776-9830 (lines=55) @@
9773
9774
    __repr__ = __str__
9775
9776
9777
class EventFilterResult(FrozenClass):
9778
    '''
9779
    :ivar SelectClauseResults:
9780
    :vartype SelectClauseResults: StatusCode
9781
    :ivar SelectClauseDiagnosticInfos:
9782
    :vartype SelectClauseDiagnosticInfos: DiagnosticInfo
9783
    :ivar WhereClauseResult:
9784
    :vartype WhereClauseResult: ContentFilterResult
9785
    '''
9786
    def __init__(self, binary=None):
9787
        if binary is not None:
9788
            self._binary_init(binary)
9789
            self._freeze = True
9790
            return
9791
        self.SelectClauseResults = []
9792
        self.SelectClauseDiagnosticInfos = []
9793
        self.WhereClauseResult = ContentFilterResult()
9794
        self._freeze = True
9795
9796
    def to_binary(self):
9797
        packet = []
9798
        packet.append(uatype_Int32.pack(len(self.SelectClauseResults)))
9799
        for fieldname in self.SelectClauseResults:
9800
            packet.append(fieldname.to_binary())
9801
        packet.append(uatype_Int32.pack(len(self.SelectClauseDiagnosticInfos)))
9802
        for fieldname in self.SelectClauseDiagnosticInfos:
9803
            packet.append(fieldname.to_binary())
9804
        packet.append(self.WhereClauseResult.to_binary())
9805
        return b''.join(packet)
9806
9807
    @staticmethod
9808
    def from_binary(data):
9809
        return EventFilterResult(data)
9810
9811
    def _binary_init(self, data):
9812
        length = uatype_Int32.unpack(data.read(4))[0]
9813
        array = []
9814
        if length != -1:
9815
            for _ in range(0, length):
9816
                array.append(StatusCode.from_binary(data))
9817
        self.SelectClauseResults = array
9818
        length = uatype_Int32.unpack(data.read(4))[0]
9819
        array = []
9820
        if length != -1:
9821
            for _ in range(0, length):
9822
                array.append(DiagnosticInfo.from_binary(data))
9823
        self.SelectClauseDiagnosticInfos = array
9824
        self.WhereClauseResult = ContentFilterResult.from_binary(data)
9825
9826
    def __str__(self):
9827
        return 'EventFilterResult(' + 'SelectClauseResults:' + str(self.SelectClauseResults) + ', ' + \
9828
               'SelectClauseDiagnosticInfos:' + str(self.SelectClauseDiagnosticInfos) + ', ' + \
9829
               'WhereClauseResult:' + str(self.WhereClauseResult) + ')'
9830
9831
    __repr__ = __str__
9832
9833
@@ 9066-9120 (lines=55) @@
9063
9064
    __repr__ = __str__
9065
9066
9067
class HistoryUpdateResult(FrozenClass):
9068
    '''
9069
    :ivar StatusCode:
9070
    :vartype StatusCode: StatusCode
9071
    :ivar OperationResults:
9072
    :vartype OperationResults: StatusCode
9073
    :ivar DiagnosticInfos:
9074
    :vartype DiagnosticInfos: DiagnosticInfo
9075
    '''
9076
    def __init__(self, binary=None):
9077
        if binary is not None:
9078
            self._binary_init(binary)
9079
            self._freeze = True
9080
            return
9081
        self.StatusCode = StatusCode()
9082
        self.OperationResults = []
9083
        self.DiagnosticInfos = []
9084
        self._freeze = True
9085
9086
    def to_binary(self):
9087
        packet = []
9088
        packet.append(self.StatusCode.to_binary())
9089
        packet.append(uatype_Int32.pack(len(self.OperationResults)))
9090
        for fieldname in self.OperationResults:
9091
            packet.append(fieldname.to_binary())
9092
        packet.append(uatype_Int32.pack(len(self.DiagnosticInfos)))
9093
        for fieldname in self.DiagnosticInfos:
9094
            packet.append(fieldname.to_binary())
9095
        return b''.join(packet)
9096
9097
    @staticmethod
9098
    def from_binary(data):
9099
        return HistoryUpdateResult(data)
9100
9101
    def _binary_init(self, data):
9102
        self.StatusCode = StatusCode.from_binary(data)
9103
        length = uatype_Int32.unpack(data.read(4))[0]
9104
        array = []
9105
        if length != -1:
9106
            for _ in range(0, length):
9107
                array.append(StatusCode.from_binary(data))
9108
        self.OperationResults = array
9109
        length = uatype_Int32.unpack(data.read(4))[0]
9110
        array = []
9111
        if length != -1:
9112
            for _ in range(0, length):
9113
                array.append(DiagnosticInfo.from_binary(data))
9114
        self.DiagnosticInfos = array
9115
9116
    def __str__(self):
9117
        return 'HistoryUpdateResult(' + 'StatusCode:' + str(self.StatusCode) + ', ' + \
9118
               'OperationResults:' + str(self.OperationResults) + ', ' + \
9119
               'DiagnosticInfos:' + str(self.DiagnosticInfos) + ')'
9120
9121
    __repr__ = __str__
9122
9123
@@ 7250-7304 (lines=55) @@
7247
7248
    __repr__ = __str__
7249
7250
7251
class ParsingResult(FrozenClass):
7252
    '''
7253
    :ivar StatusCode:
7254
    :vartype StatusCode: StatusCode
7255
    :ivar DataStatusCodes:
7256
    :vartype DataStatusCodes: StatusCode
7257
    :ivar DataDiagnosticInfos:
7258
    :vartype DataDiagnosticInfos: DiagnosticInfo
7259
    '''
7260
    def __init__(self, binary=None):
7261
        if binary is not None:
7262
            self._binary_init(binary)
7263
            self._freeze = True
7264
            return
7265
        self.StatusCode = StatusCode()
7266
        self.DataStatusCodes = []
7267
        self.DataDiagnosticInfos = []
7268
        self._freeze = True
7269
7270
    def to_binary(self):
7271
        packet = []
7272
        packet.append(self.StatusCode.to_binary())
7273
        packet.append(uatype_Int32.pack(len(self.DataStatusCodes)))
7274
        for fieldname in self.DataStatusCodes:
7275
            packet.append(fieldname.to_binary())
7276
        packet.append(uatype_Int32.pack(len(self.DataDiagnosticInfos)))
7277
        for fieldname in self.DataDiagnosticInfos:
7278
            packet.append(fieldname.to_binary())
7279
        return b''.join(packet)
7280
7281
    @staticmethod
7282
    def from_binary(data):
7283
        return ParsingResult(data)
7284
7285
    def _binary_init(self, data):
7286
        self.StatusCode = StatusCode.from_binary(data)
7287
        length = uatype_Int32.unpack(data.read(4))[0]
7288
        array = []
7289
        if length != -1:
7290
            for _ in range(0, length):
7291
                array.append(StatusCode.from_binary(data))
7292
        self.DataStatusCodes = array
7293
        length = uatype_Int32.unpack(data.read(4))[0]
7294
        array = []
7295
        if length != -1:
7296
            for _ in range(0, length):
7297
                array.append(DiagnosticInfo.from_binary(data))
7298
        self.DataDiagnosticInfos = array
7299
7300
    def __str__(self):
7301
        return 'ParsingResult(' + 'StatusCode:' + str(self.StatusCode) + ', ' + \
7302
               'DataStatusCodes:' + str(self.DataStatusCodes) + ', ' + \
7303
               'DataDiagnosticInfos:' + str(self.DataDiagnosticInfos) + ')'
7304
7305
    __repr__ = __str__
7306
7307
@@ 7142-7196 (lines=55) @@
7139
7140
    __repr__ = __str__
7141
7142
7143
class ContentFilterElementResult(FrozenClass):
7144
    '''
7145
    :ivar StatusCode:
7146
    :vartype StatusCode: StatusCode
7147
    :ivar OperandStatusCodes:
7148
    :vartype OperandStatusCodes: StatusCode
7149
    :ivar OperandDiagnosticInfos:
7150
    :vartype OperandDiagnosticInfos: DiagnosticInfo
7151
    '''
7152
    def __init__(self, binary=None):
7153
        if binary is not None:
7154
            self._binary_init(binary)
7155
            self._freeze = True
7156
            return
7157
        self.StatusCode = StatusCode()
7158
        self.OperandStatusCodes = []
7159
        self.OperandDiagnosticInfos = []
7160
        self._freeze = True
7161
7162
    def to_binary(self):
7163
        packet = []
7164
        packet.append(self.StatusCode.to_binary())
7165
        packet.append(uatype_Int32.pack(len(self.OperandStatusCodes)))
7166
        for fieldname in self.OperandStatusCodes:
7167
            packet.append(fieldname.to_binary())
7168
        packet.append(uatype_Int32.pack(len(self.OperandDiagnosticInfos)))
7169
        for fieldname in self.OperandDiagnosticInfos:
7170
            packet.append(fieldname.to_binary())
7171
        return b''.join(packet)
7172
7173
    @staticmethod
7174
    def from_binary(data):
7175
        return ContentFilterElementResult(data)
7176
7177
    def _binary_init(self, data):
7178
        self.StatusCode = StatusCode.from_binary(data)
7179
        length = uatype_Int32.unpack(data.read(4))[0]
7180
        array = []
7181
        if length != -1:
7182
            for _ in range(0, length):
7183
                array.append(StatusCode.from_binary(data))
7184
        self.OperandStatusCodes = array
7185
        length = uatype_Int32.unpack(data.read(4))[0]
7186
        array = []
7187
        if length != -1:
7188
            for _ in range(0, length):
7189
                array.append(DiagnosticInfo.from_binary(data))
7190
        self.OperandDiagnosticInfos = array
7191
7192
    def __str__(self):
7193
        return 'ContentFilterElementResult(' + 'StatusCode:' + str(self.StatusCode) + ', ' + \
7194
               'OperandStatusCodes:' + str(self.OperandStatusCodes) + ', ' + \
7195
               'OperandDiagnosticInfos:' + str(self.OperandDiagnosticInfos) + ')'
7196
7197
    __repr__ = __str__
7198
7199
@@ 3382-3436 (lines=55) @@
3379
3380
    __repr__ = __str__
3381
3382
3383
class ActivateSessionResult(FrozenClass):
3384
    '''
3385
    :ivar ServerNonce:
3386
    :vartype ServerNonce: ByteString
3387
    :ivar Results:
3388
    :vartype Results: StatusCode
3389
    :ivar DiagnosticInfos:
3390
    :vartype DiagnosticInfos: DiagnosticInfo
3391
    '''
3392
    def __init__(self, binary=None):
3393
        if binary is not None:
3394
            self._binary_init(binary)
3395
            self._freeze = True
3396
            return
3397
        self.ServerNonce = None
3398
        self.Results = []
3399
        self.DiagnosticInfos = []
3400
        self._freeze = True
3401
3402
    def to_binary(self):
3403
        packet = []
3404
        packet.append(pack_bytes(self.ServerNonce))
3405
        packet.append(uatype_Int32.pack(len(self.Results)))
3406
        for fieldname in self.Results:
3407
            packet.append(fieldname.to_binary())
3408
        packet.append(uatype_Int32.pack(len(self.DiagnosticInfos)))
3409
        for fieldname in self.DiagnosticInfos:
3410
            packet.append(fieldname.to_binary())
3411
        return b''.join(packet)
3412
3413
    @staticmethod
3414
    def from_binary(data):
3415
        return ActivateSessionResult(data)
3416
3417
    def _binary_init(self, data):
3418
        self.ServerNonce = unpack_bytes(data)
3419
        length = uatype_Int32.unpack(data.read(4))[0]
3420
        array = []
3421
        if length != -1:
3422
            for _ in range(0, length):
3423
                array.append(StatusCode.from_binary(data))
3424
        self.Results = array
3425
        length = uatype_Int32.unpack(data.read(4))[0]
3426
        array = []
3427
        if length != -1:
3428
            for _ in range(0, length):
3429
                array.append(DiagnosticInfo.from_binary(data))
3430
        self.DiagnosticInfos = array
3431
3432
    def __str__(self):
3433
        return 'ActivateSessionResult(' + 'ServerNonce:' + str(self.ServerNonce) + ', ' + \
3434
               'Results:' + str(self.Results) + ', ' + \
3435
               'DiagnosticInfos:' + str(self.DiagnosticInfos) + ')'
3436
3437
    __repr__ = __str__
3438
3439