Code Duplication    Length = 62-62 lines in 5 locations

opcua/ua/uaprotocol_auto.py 5 locations

@@ 11113-11174 (lines=62) @@
11110
    __repr__ = __str__
11111
11112
11113
class EventFilterResult(FrozenClass):
11114
    '''
11115
    :ivar SelectClauseResults:
11116
    :vartype SelectClauseResults: StatusCode
11117
    :ivar SelectClauseDiagnosticInfos:
11118
    :vartype SelectClauseDiagnosticInfos: DiagnosticInfo
11119
    :ivar WhereClauseResult:
11120
    :vartype WhereClauseResult: ContentFilterResult
11121
    '''
11122
11123
    ua_types = {
11124
        'SelectClauseResults': 'StatusCode',
11125
        'SelectClauseDiagnosticInfos': 'DiagnosticInfo',
11126
        'WhereClauseResult': 'ContentFilterResult',
11127
               }
11128
11129
    def __init__(self, binary=None):
11130
        if binary is not None:
11131
            self._binary_init(binary)
11132
            self._freeze = True
11133
            return
11134
        self.SelectClauseResults = []
11135
        self.SelectClauseDiagnosticInfos = []
11136
        self.WhereClauseResult = ContentFilterResult()
11137
        self._freeze = True
11138
11139
    def to_binary(self):
11140
        packet = []
11141
        packet.append(uabin.Primitives.Int32.pack(len(self.SelectClauseResults)))
11142
        for fieldname in self.SelectClauseResults:
11143
            packet.append(fieldname.to_binary())
11144
        packet.append(uabin.Primitives.Int32.pack(len(self.SelectClauseDiagnosticInfos)))
11145
        for fieldname in self.SelectClauseDiagnosticInfos:
11146
            packet.append(fieldname.to_binary())
11147
        packet.append(self.WhereClauseResult.to_binary())
11148
        return b''.join(packet)
11149
11150
    @staticmethod
11151
    def from_binary(data):
11152
        return EventFilterResult(data)
11153
11154
    def _binary_init(self, data):
11155
        length = uabin.Primitives.Int32.unpack(data)
11156
        array = []
11157
        if length != -1:
11158
            for _ in range(0, length):
11159
                array.append(StatusCode.from_binary(data))
11160
        self.SelectClauseResults = array
11161
        length = uabin.Primitives.Int32.unpack(data)
11162
        array = []
11163
        if length != -1:
11164
            for _ in range(0, length):
11165
                array.append(DiagnosticInfo.from_binary(data))
11166
        self.SelectClauseDiagnosticInfos = array
11167
        self.WhereClauseResult = ContentFilterResult.from_binary(data)
11168
11169
    def __str__(self):
11170
        return 'EventFilterResult(' + 'SelectClauseResults:' + str(self.SelectClauseResults) + ', ' + \
11171
               'SelectClauseDiagnosticInfos:' + str(self.SelectClauseDiagnosticInfos) + ', ' + \
11172
               'WhereClauseResult:' + str(self.WhereClauseResult) + ')'
11173
11174
    __repr__ = __str__
11175
11176
11177
class AggregateFilterResult(FrozenClass):
@@ 10303-10364 (lines=62) @@
10300
    __repr__ = __str__
10301
10302
10303
class HistoryUpdateResult(FrozenClass):
10304
    '''
10305
    :ivar StatusCode:
10306
    :vartype StatusCode: StatusCode
10307
    :ivar OperationResults:
10308
    :vartype OperationResults: StatusCode
10309
    :ivar DiagnosticInfos:
10310
    :vartype DiagnosticInfos: DiagnosticInfo
10311
    '''
10312
10313
    ua_types = {
10314
        'StatusCode': 'StatusCode',
10315
        'OperationResults': 'StatusCode',
10316
        'DiagnosticInfos': 'DiagnosticInfo',
10317
               }
10318
10319
    def __init__(self, binary=None):
10320
        if binary is not None:
10321
            self._binary_init(binary)
10322
            self._freeze = True
10323
            return
10324
        self.StatusCode = StatusCode()
10325
        self.OperationResults = []
10326
        self.DiagnosticInfos = []
10327
        self._freeze = True
10328
10329
    def to_binary(self):
10330
        packet = []
10331
        packet.append(self.StatusCode.to_binary())
10332
        packet.append(uabin.Primitives.Int32.pack(len(self.OperationResults)))
10333
        for fieldname in self.OperationResults:
10334
            packet.append(fieldname.to_binary())
10335
        packet.append(uabin.Primitives.Int32.pack(len(self.DiagnosticInfos)))
10336
        for fieldname in self.DiagnosticInfos:
10337
            packet.append(fieldname.to_binary())
10338
        return b''.join(packet)
10339
10340
    @staticmethod
10341
    def from_binary(data):
10342
        return HistoryUpdateResult(data)
10343
10344
    def _binary_init(self, data):
10345
        self.StatusCode = StatusCode.from_binary(data)
10346
        length = uabin.Primitives.Int32.unpack(data)
10347
        array = []
10348
        if length != -1:
10349
            for _ in range(0, length):
10350
                array.append(StatusCode.from_binary(data))
10351
        self.OperationResults = array
10352
        length = uabin.Primitives.Int32.unpack(data)
10353
        array = []
10354
        if length != -1:
10355
            for _ in range(0, length):
10356
                array.append(DiagnosticInfo.from_binary(data))
10357
        self.DiagnosticInfos = array
10358
10359
    def __str__(self):
10360
        return 'HistoryUpdateResult(' + 'StatusCode:' + str(self.StatusCode) + ', ' + \
10361
               'OperationResults:' + str(self.OperationResults) + ', ' + \
10362
               'DiagnosticInfos:' + str(self.DiagnosticInfos) + ')'
10363
10364
    __repr__ = __str__
10365
10366
10367
class HistoryUpdateParameters(FrozenClass):
@@ 8220-8281 (lines=62) @@
8217
    __repr__ = __str__
8218
8219
8220
class ParsingResult(FrozenClass):
8221
    '''
8222
    :ivar StatusCode:
8223
    :vartype StatusCode: StatusCode
8224
    :ivar DataStatusCodes:
8225
    :vartype DataStatusCodes: StatusCode
8226
    :ivar DataDiagnosticInfos:
8227
    :vartype DataDiagnosticInfos: DiagnosticInfo
8228
    '''
8229
8230
    ua_types = {
8231
        'StatusCode': 'StatusCode',
8232
        'DataStatusCodes': 'StatusCode',
8233
        'DataDiagnosticInfos': 'DiagnosticInfo',
8234
               }
8235
8236
    def __init__(self, binary=None):
8237
        if binary is not None:
8238
            self._binary_init(binary)
8239
            self._freeze = True
8240
            return
8241
        self.StatusCode = StatusCode()
8242
        self.DataStatusCodes = []
8243
        self.DataDiagnosticInfos = []
8244
        self._freeze = True
8245
8246
    def to_binary(self):
8247
        packet = []
8248
        packet.append(self.StatusCode.to_binary())
8249
        packet.append(uabin.Primitives.Int32.pack(len(self.DataStatusCodes)))
8250
        for fieldname in self.DataStatusCodes:
8251
            packet.append(fieldname.to_binary())
8252
        packet.append(uabin.Primitives.Int32.pack(len(self.DataDiagnosticInfos)))
8253
        for fieldname in self.DataDiagnosticInfos:
8254
            packet.append(fieldname.to_binary())
8255
        return b''.join(packet)
8256
8257
    @staticmethod
8258
    def from_binary(data):
8259
        return ParsingResult(data)
8260
8261
    def _binary_init(self, data):
8262
        self.StatusCode = StatusCode.from_binary(data)
8263
        length = uabin.Primitives.Int32.unpack(data)
8264
        array = []
8265
        if length != -1:
8266
            for _ in range(0, length):
8267
                array.append(StatusCode.from_binary(data))
8268
        self.DataStatusCodes = array
8269
        length = uabin.Primitives.Int32.unpack(data)
8270
        array = []
8271
        if length != -1:
8272
            for _ in range(0, length):
8273
                array.append(DiagnosticInfo.from_binary(data))
8274
        self.DataDiagnosticInfos = array
8275
8276
    def __str__(self):
8277
        return 'ParsingResult(' + 'StatusCode:' + str(self.StatusCode) + ', ' + \
8278
               'DataStatusCodes:' + str(self.DataStatusCodes) + ', ' + \
8279
               'DataDiagnosticInfos:' + str(self.DataDiagnosticInfos) + ')'
8280
8281
    __repr__ = __str__
8282
8283
8284
class QueryFirstParameters(FrozenClass):
@@ 8099-8160 (lines=62) @@
8096
    __repr__ = __str__
8097
8098
8099
class ContentFilterElementResult(FrozenClass):
8100
    '''
8101
    :ivar StatusCode:
8102
    :vartype StatusCode: StatusCode
8103
    :ivar OperandStatusCodes:
8104
    :vartype OperandStatusCodes: StatusCode
8105
    :ivar OperandDiagnosticInfos:
8106
    :vartype OperandDiagnosticInfos: DiagnosticInfo
8107
    '''
8108
8109
    ua_types = {
8110
        'StatusCode': 'StatusCode',
8111
        'OperandStatusCodes': 'StatusCode',
8112
        'OperandDiagnosticInfos': 'DiagnosticInfo',
8113
               }
8114
8115
    def __init__(self, binary=None):
8116
        if binary is not None:
8117
            self._binary_init(binary)
8118
            self._freeze = True
8119
            return
8120
        self.StatusCode = StatusCode()
8121
        self.OperandStatusCodes = []
8122
        self.OperandDiagnosticInfos = []
8123
        self._freeze = True
8124
8125
    def to_binary(self):
8126
        packet = []
8127
        packet.append(self.StatusCode.to_binary())
8128
        packet.append(uabin.Primitives.Int32.pack(len(self.OperandStatusCodes)))
8129
        for fieldname in self.OperandStatusCodes:
8130
            packet.append(fieldname.to_binary())
8131
        packet.append(uabin.Primitives.Int32.pack(len(self.OperandDiagnosticInfos)))
8132
        for fieldname in self.OperandDiagnosticInfos:
8133
            packet.append(fieldname.to_binary())
8134
        return b''.join(packet)
8135
8136
    @staticmethod
8137
    def from_binary(data):
8138
        return ContentFilterElementResult(data)
8139
8140
    def _binary_init(self, data):
8141
        self.StatusCode = StatusCode.from_binary(data)
8142
        length = uabin.Primitives.Int32.unpack(data)
8143
        array = []
8144
        if length != -1:
8145
            for _ in range(0, length):
8146
                array.append(StatusCode.from_binary(data))
8147
        self.OperandStatusCodes = array
8148
        length = uabin.Primitives.Int32.unpack(data)
8149
        array = []
8150
        if length != -1:
8151
            for _ in range(0, length):
8152
                array.append(DiagnosticInfo.from_binary(data))
8153
        self.OperandDiagnosticInfos = array
8154
8155
    def __str__(self):
8156
        return 'ContentFilterElementResult(' + 'StatusCode:' + str(self.StatusCode) + ', ' + \
8157
               'OperandStatusCodes:' + str(self.OperandStatusCodes) + ', ' + \
8158
               'OperandDiagnosticInfos:' + str(self.OperandDiagnosticInfos) + ')'
8159
8160
    __repr__ = __str__
8161
8162
8163
class ContentFilterResult(FrozenClass):
@@ 3782-3843 (lines=62) @@
3779
    __repr__ = __str__
3780
3781
3782
class ActivateSessionResult(FrozenClass):
3783
    '''
3784
    :ivar ServerNonce:
3785
    :vartype ServerNonce: ByteString
3786
    :ivar Results:
3787
    :vartype Results: StatusCode
3788
    :ivar DiagnosticInfos:
3789
    :vartype DiagnosticInfos: DiagnosticInfo
3790
    '''
3791
3792
    ua_types = {
3793
        'ServerNonce': 'ByteString',
3794
        'Results': 'StatusCode',
3795
        'DiagnosticInfos': 'DiagnosticInfo',
3796
               }
3797
3798
    def __init__(self, binary=None):
3799
        if binary is not None:
3800
            self._binary_init(binary)
3801
            self._freeze = True
3802
            return
3803
        self.ServerNonce = None
3804
        self.Results = []
3805
        self.DiagnosticInfos = []
3806
        self._freeze = True
3807
3808
    def to_binary(self):
3809
        packet = []
3810
        packet.append(uabin.Primitives.ByteString.pack(self.ServerNonce))
3811
        packet.append(uabin.Primitives.Int32.pack(len(self.Results)))
3812
        for fieldname in self.Results:
3813
            packet.append(fieldname.to_binary())
3814
        packet.append(uabin.Primitives.Int32.pack(len(self.DiagnosticInfos)))
3815
        for fieldname in self.DiagnosticInfos:
3816
            packet.append(fieldname.to_binary())
3817
        return b''.join(packet)
3818
3819
    @staticmethod
3820
    def from_binary(data):
3821
        return ActivateSessionResult(data)
3822
3823
    def _binary_init(self, data):
3824
        self.ServerNonce = uabin.Primitives.ByteString.unpack(data)
3825
        length = uabin.Primitives.Int32.unpack(data)
3826
        array = []
3827
        if length != -1:
3828
            for _ in range(0, length):
3829
                array.append(StatusCode.from_binary(data))
3830
        self.Results = array
3831
        length = uabin.Primitives.Int32.unpack(data)
3832
        array = []
3833
        if length != -1:
3834
            for _ in range(0, length):
3835
                array.append(DiagnosticInfo.from_binary(data))
3836
        self.DiagnosticInfos = array
3837
3838
    def __str__(self):
3839
        return 'ActivateSessionResult(' + 'ServerNonce:' + str(self.ServerNonce) + ', ' + \
3840
               'Results:' + str(self.Results) + ', ' + \
3841
               'DiagnosticInfos:' + str(self.DiagnosticInfos) + ')'
3842
3843
    __repr__ = __str__
3844
3845
3846
class ActivateSessionResponse(FrozenClass):