Code Duplication    Length = 62-62 lines in 5 locations

opcua/ua/uaprotocol_auto.py 5 locations

@@ 11147-11208 (lines=62) @@
11144
    __repr__ = __str__
11145
11146
11147
class EventFilterResult(FrozenClass):
11148
    '''
11149
    :ivar SelectClauseResults:
11150
    :vartype SelectClauseResults: StatusCode
11151
    :ivar SelectClauseDiagnosticInfos:
11152
    :vartype SelectClauseDiagnosticInfos: DiagnosticInfo
11153
    :ivar WhereClauseResult:
11154
    :vartype WhereClauseResult: ContentFilterResult
11155
    '''
11156
11157
    ua_types = {
11158
        'SelectClauseResults': 'StatusCode',
11159
        'SelectClauseDiagnosticInfos': 'DiagnosticInfo',
11160
        'WhereClauseResult': 'ContentFilterResult',
11161
               }
11162
11163
    def __init__(self, binary=None):
11164
        if binary is not None:
11165
            self._binary_init(binary)
11166
            self._freeze = True
11167
            return
11168
        self.SelectClauseResults = []
11169
        self.SelectClauseDiagnosticInfos = []
11170
        self.WhereClauseResult = ContentFilterResult()
11171
        self._freeze = True
11172
11173
    def to_binary(self):
11174
        packet = []
11175
        packet.append(uabin.Primitives.Int32.pack(len(self.SelectClauseResults)))
11176
        for fieldname in self.SelectClauseResults:
11177
            packet.append(fieldname.to_binary())
11178
        packet.append(uabin.Primitives.Int32.pack(len(self.SelectClauseDiagnosticInfos)))
11179
        for fieldname in self.SelectClauseDiagnosticInfos:
11180
            packet.append(fieldname.to_binary())
11181
        packet.append(self.WhereClauseResult.to_binary())
11182
        return b''.join(packet)
11183
11184
    @staticmethod
11185
    def from_binary(data):
11186
        return EventFilterResult(data)
11187
11188
    def _binary_init(self, data):
11189
        length = uabin.Primitives.Int32.unpack(data)
11190
        array = []
11191
        if length != -1:
11192
            for _ in range(0, length):
11193
                array.append(StatusCode.from_binary(data))
11194
        self.SelectClauseResults = array
11195
        length = uabin.Primitives.Int32.unpack(data)
11196
        array = []
11197
        if length != -1:
11198
            for _ in range(0, length):
11199
                array.append(DiagnosticInfo.from_binary(data))
11200
        self.SelectClauseDiagnosticInfos = array
11201
        self.WhereClauseResult = ContentFilterResult.from_binary(data)
11202
11203
    def __str__(self):
11204
        return 'EventFilterResult(' + 'SelectClauseResults:' + str(self.SelectClauseResults) + ', ' + \
11205
               'SelectClauseDiagnosticInfos:' + str(self.SelectClauseDiagnosticInfos) + ', ' + \
11206
               'WhereClauseResult:' + str(self.WhereClauseResult) + ')'
11207
11208
    __repr__ = __str__
11209
11210
11211
class AggregateFilterResult(FrozenClass):
@@ 10337-10398 (lines=62) @@
10334
    __repr__ = __str__
10335
10336
10337
class HistoryUpdateResult(FrozenClass):
10338
    '''
10339
    :ivar StatusCode:
10340
    :vartype StatusCode: StatusCode
10341
    :ivar OperationResults:
10342
    :vartype OperationResults: StatusCode
10343
    :ivar DiagnosticInfos:
10344
    :vartype DiagnosticInfos: DiagnosticInfo
10345
    '''
10346
10347
    ua_types = {
10348
        'StatusCode': 'StatusCode',
10349
        'OperationResults': 'StatusCode',
10350
        'DiagnosticInfos': 'DiagnosticInfo',
10351
               }
10352
10353
    def __init__(self, binary=None):
10354
        if binary is not None:
10355
            self._binary_init(binary)
10356
            self._freeze = True
10357
            return
10358
        self.StatusCode = StatusCode()
10359
        self.OperationResults = []
10360
        self.DiagnosticInfos = []
10361
        self._freeze = True
10362
10363
    def to_binary(self):
10364
        packet = []
10365
        packet.append(self.StatusCode.to_binary())
10366
        packet.append(uabin.Primitives.Int32.pack(len(self.OperationResults)))
10367
        for fieldname in self.OperationResults:
10368
            packet.append(fieldname.to_binary())
10369
        packet.append(uabin.Primitives.Int32.pack(len(self.DiagnosticInfos)))
10370
        for fieldname in self.DiagnosticInfos:
10371
            packet.append(fieldname.to_binary())
10372
        return b''.join(packet)
10373
10374
    @staticmethod
10375
    def from_binary(data):
10376
        return HistoryUpdateResult(data)
10377
10378
    def _binary_init(self, data):
10379
        self.StatusCode = StatusCode.from_binary(data)
10380
        length = uabin.Primitives.Int32.unpack(data)
10381
        array = []
10382
        if length != -1:
10383
            for _ in range(0, length):
10384
                array.append(StatusCode.from_binary(data))
10385
        self.OperationResults = array
10386
        length = uabin.Primitives.Int32.unpack(data)
10387
        array = []
10388
        if length != -1:
10389
            for _ in range(0, length):
10390
                array.append(DiagnosticInfo.from_binary(data))
10391
        self.DiagnosticInfos = array
10392
10393
    def __str__(self):
10394
        return 'HistoryUpdateResult(' + 'StatusCode:' + str(self.StatusCode) + ', ' + \
10395
               'OperationResults:' + str(self.OperationResults) + ', ' + \
10396
               'DiagnosticInfos:' + str(self.DiagnosticInfos) + ')'
10397
10398
    __repr__ = __str__
10399
10400
10401
class HistoryUpdateParameters(FrozenClass):
@@ 8254-8315 (lines=62) @@
8251
    __repr__ = __str__
8252
8253
8254
class ParsingResult(FrozenClass):
8255
    '''
8256
    :ivar StatusCode:
8257
    :vartype StatusCode: StatusCode
8258
    :ivar DataStatusCodes:
8259
    :vartype DataStatusCodes: StatusCode
8260
    :ivar DataDiagnosticInfos:
8261
    :vartype DataDiagnosticInfos: DiagnosticInfo
8262
    '''
8263
8264
    ua_types = {
8265
        'StatusCode': 'StatusCode',
8266
        'DataStatusCodes': 'StatusCode',
8267
        'DataDiagnosticInfos': 'DiagnosticInfo',
8268
               }
8269
8270
    def __init__(self, binary=None):
8271
        if binary is not None:
8272
            self._binary_init(binary)
8273
            self._freeze = True
8274
            return
8275
        self.StatusCode = StatusCode()
8276
        self.DataStatusCodes = []
8277
        self.DataDiagnosticInfos = []
8278
        self._freeze = True
8279
8280
    def to_binary(self):
8281
        packet = []
8282
        packet.append(self.StatusCode.to_binary())
8283
        packet.append(uabin.Primitives.Int32.pack(len(self.DataStatusCodes)))
8284
        for fieldname in self.DataStatusCodes:
8285
            packet.append(fieldname.to_binary())
8286
        packet.append(uabin.Primitives.Int32.pack(len(self.DataDiagnosticInfos)))
8287
        for fieldname in self.DataDiagnosticInfos:
8288
            packet.append(fieldname.to_binary())
8289
        return b''.join(packet)
8290
8291
    @staticmethod
8292
    def from_binary(data):
8293
        return ParsingResult(data)
8294
8295
    def _binary_init(self, data):
8296
        self.StatusCode = StatusCode.from_binary(data)
8297
        length = uabin.Primitives.Int32.unpack(data)
8298
        array = []
8299
        if length != -1:
8300
            for _ in range(0, length):
8301
                array.append(StatusCode.from_binary(data))
8302
        self.DataStatusCodes = array
8303
        length = uabin.Primitives.Int32.unpack(data)
8304
        array = []
8305
        if length != -1:
8306
            for _ in range(0, length):
8307
                array.append(DiagnosticInfo.from_binary(data))
8308
        self.DataDiagnosticInfos = array
8309
8310
    def __str__(self):
8311
        return 'ParsingResult(' + 'StatusCode:' + str(self.StatusCode) + ', ' + \
8312
               'DataStatusCodes:' + str(self.DataStatusCodes) + ', ' + \
8313
               'DataDiagnosticInfos:' + str(self.DataDiagnosticInfos) + ')'
8314
8315
    __repr__ = __str__
8316
8317
8318
class QueryFirstParameters(FrozenClass):
@@ 8133-8194 (lines=62) @@
8130
    __repr__ = __str__
8131
8132
8133
class ContentFilterElementResult(FrozenClass):
8134
    '''
8135
    :ivar StatusCode:
8136
    :vartype StatusCode: StatusCode
8137
    :ivar OperandStatusCodes:
8138
    :vartype OperandStatusCodes: StatusCode
8139
    :ivar OperandDiagnosticInfos:
8140
    :vartype OperandDiagnosticInfos: DiagnosticInfo
8141
    '''
8142
8143
    ua_types = {
8144
        'StatusCode': 'StatusCode',
8145
        'OperandStatusCodes': 'StatusCode',
8146
        'OperandDiagnosticInfos': 'DiagnosticInfo',
8147
               }
8148
8149
    def __init__(self, binary=None):
8150
        if binary is not None:
8151
            self._binary_init(binary)
8152
            self._freeze = True
8153
            return
8154
        self.StatusCode = StatusCode()
8155
        self.OperandStatusCodes = []
8156
        self.OperandDiagnosticInfos = []
8157
        self._freeze = True
8158
8159
    def to_binary(self):
8160
        packet = []
8161
        packet.append(self.StatusCode.to_binary())
8162
        packet.append(uabin.Primitives.Int32.pack(len(self.OperandStatusCodes)))
8163
        for fieldname in self.OperandStatusCodes:
8164
            packet.append(fieldname.to_binary())
8165
        packet.append(uabin.Primitives.Int32.pack(len(self.OperandDiagnosticInfos)))
8166
        for fieldname in self.OperandDiagnosticInfos:
8167
            packet.append(fieldname.to_binary())
8168
        return b''.join(packet)
8169
8170
    @staticmethod
8171
    def from_binary(data):
8172
        return ContentFilterElementResult(data)
8173
8174
    def _binary_init(self, data):
8175
        self.StatusCode = StatusCode.from_binary(data)
8176
        length = uabin.Primitives.Int32.unpack(data)
8177
        array = []
8178
        if length != -1:
8179
            for _ in range(0, length):
8180
                array.append(StatusCode.from_binary(data))
8181
        self.OperandStatusCodes = array
8182
        length = uabin.Primitives.Int32.unpack(data)
8183
        array = []
8184
        if length != -1:
8185
            for _ in range(0, length):
8186
                array.append(DiagnosticInfo.from_binary(data))
8187
        self.OperandDiagnosticInfos = array
8188
8189
    def __str__(self):
8190
        return 'ContentFilterElementResult(' + 'StatusCode:' + str(self.StatusCode) + ', ' + \
8191
               'OperandStatusCodes:' + str(self.OperandStatusCodes) + ', ' + \
8192
               'OperandDiagnosticInfos:' + str(self.OperandDiagnosticInfos) + ')'
8193
8194
    __repr__ = __str__
8195
8196
8197
class ContentFilterResult(FrozenClass):
@@ 3780-3841 (lines=62) @@
3777
    __repr__ = __str__
3778
3779
3780
class ActivateSessionResult(FrozenClass):
3781
    '''
3782
    :ivar ServerNonce:
3783
    :vartype ServerNonce: ByteString
3784
    :ivar Results:
3785
    :vartype Results: StatusCode
3786
    :ivar DiagnosticInfos:
3787
    :vartype DiagnosticInfos: DiagnosticInfo
3788
    '''
3789
3790
    ua_types = {
3791
        'ServerNonce': 'ByteString',
3792
        'Results': 'StatusCode',
3793
        'DiagnosticInfos': 'DiagnosticInfo',
3794
               }
3795
3796
    def __init__(self, binary=None):
3797
        if binary is not None:
3798
            self._binary_init(binary)
3799
            self._freeze = True
3800
            return
3801
        self.ServerNonce = None
3802
        self.Results = []
3803
        self.DiagnosticInfos = []
3804
        self._freeze = True
3805
3806
    def to_binary(self):
3807
        packet = []
3808
        packet.append(uabin.Primitives.ByteString.pack(self.ServerNonce))
3809
        packet.append(uabin.Primitives.Int32.pack(len(self.Results)))
3810
        for fieldname in self.Results:
3811
            packet.append(fieldname.to_binary())
3812
        packet.append(uabin.Primitives.Int32.pack(len(self.DiagnosticInfos)))
3813
        for fieldname in self.DiagnosticInfos:
3814
            packet.append(fieldname.to_binary())
3815
        return b''.join(packet)
3816
3817
    @staticmethod
3818
    def from_binary(data):
3819
        return ActivateSessionResult(data)
3820
3821
    def _binary_init(self, data):
3822
        self.ServerNonce = uabin.Primitives.ByteString.unpack(data)
3823
        length = uabin.Primitives.Int32.unpack(data)
3824
        array = []
3825
        if length != -1:
3826
            for _ in range(0, length):
3827
                array.append(StatusCode.from_binary(data))
3828
        self.Results = array
3829
        length = uabin.Primitives.Int32.unpack(data)
3830
        array = []
3831
        if length != -1:
3832
            for _ in range(0, length):
3833
                array.append(DiagnosticInfo.from_binary(data))
3834
        self.DiagnosticInfos = array
3835
3836
    def __str__(self):
3837
        return 'ActivateSessionResult(' + 'ServerNonce:' + str(self.ServerNonce) + ', ' + \
3838
               'Results:' + str(self.Results) + ', ' + \
3839
               'DiagnosticInfos:' + str(self.DiagnosticInfos) + ')'
3840
3841
    __repr__ = __str__
3842
3843
3844
class ActivateSessionResponse(FrozenClass):