Code Duplication    Length = 49-49 lines in 8 locations

opcua/ua/uaprotocol_auto.py 8 locations

@@ 12336-12384 (lines=49) @@
12333
    __repr__ = __str__
12334
12335
12336
class TransferSubscriptionsResult(FrozenClass):
12337
    '''
12338
    :ivar Results:
12339
    :vartype Results: TransferResult
12340
    :ivar DiagnosticInfos:
12341
    :vartype DiagnosticInfos: DiagnosticInfo
12342
    '''
12343
    def __init__(self, binary=None):
12344
        if binary is not None:
12345
            self._binary_init(binary)
12346
            self._freeze = True
12347
            return
12348
        self.Results = []
12349
        self.DiagnosticInfos = []
12350
        self._freeze = True
12351
12352
    def to_binary(self):
12353
        packet = []
12354
        packet.append(uatype_Int32.pack(len(self.Results)))
12355
        for fieldname in self.Results:
12356
            packet.append(fieldname.to_binary())
12357
        packet.append(uatype_Int32.pack(len(self.DiagnosticInfos)))
12358
        for fieldname in self.DiagnosticInfos:
12359
            packet.append(fieldname.to_binary())
12360
        return b''.join(packet)
12361
12362
    @staticmethod
12363
    def from_binary(data):
12364
        return TransferSubscriptionsResult(data)
12365
12366
    def _binary_init(self, data):
12367
        length = uatype_Int32.unpack(data.read(4))[0]
12368
        array = []
12369
        if length != -1:
12370
            for _ in range(0, length):
12371
                array.append(TransferResult.from_binary(data))
12372
        self.Results = array
12373
        length = uatype_Int32.unpack(data.read(4))[0]
12374
        array = []
12375
        if length != -1:
12376
            for _ in range(0, length):
12377
                array.append(DiagnosticInfo.from_binary(data))
12378
        self.DiagnosticInfos = array
12379
12380
    def __str__(self):
12381
        return 'TransferSubscriptionsResult(' + 'Results:' + str(self.Results) + ', ' + \
12382
               'DiagnosticInfos:' + str(self.DiagnosticInfos) + ')'
12383
12384
    __repr__ = __str__
12385
12386
12387
class TransferSubscriptionsResponse(FrozenClass):
@@ 11609-11657 (lines=49) @@
11606
    __repr__ = __str__
11607
11608
11609
class DataChangeNotification(FrozenClass):
11610
    '''
11611
    :ivar MonitoredItems:
11612
    :vartype MonitoredItems: MonitoredItemNotification
11613
    :ivar DiagnosticInfos:
11614
    :vartype DiagnosticInfos: DiagnosticInfo
11615
    '''
11616
    def __init__(self, binary=None):
11617
        if binary is not None:
11618
            self._binary_init(binary)
11619
            self._freeze = True
11620
            return
11621
        self.MonitoredItems = []
11622
        self.DiagnosticInfos = []
11623
        self._freeze = True
11624
11625
    def to_binary(self):
11626
        packet = []
11627
        packet.append(uatype_Int32.pack(len(self.MonitoredItems)))
11628
        for fieldname in self.MonitoredItems:
11629
            packet.append(fieldname.to_binary())
11630
        packet.append(uatype_Int32.pack(len(self.DiagnosticInfos)))
11631
        for fieldname in self.DiagnosticInfos:
11632
            packet.append(fieldname.to_binary())
11633
        return b''.join(packet)
11634
11635
    @staticmethod
11636
    def from_binary(data):
11637
        return DataChangeNotification(data)
11638
11639
    def _binary_init(self, data):
11640
        length = uatype_Int32.unpack(data.read(4))[0]
11641
        array = []
11642
        if length != -1:
11643
            for _ in range(0, length):
11644
                array.append(MonitoredItemNotification.from_binary(data))
11645
        self.MonitoredItems = array
11646
        length = uatype_Int32.unpack(data.read(4))[0]
11647
        array = []
11648
        if length != -1:
11649
            for _ in range(0, length):
11650
                array.append(DiagnosticInfo.from_binary(data))
11651
        self.DiagnosticInfos = array
11652
11653
    def __str__(self):
11654
        return 'DataChangeNotification(' + 'MonitoredItems:' + str(self.MonitoredItems) + ', ' + \
11655
               'DiagnosticInfos:' + str(self.DiagnosticInfos) + ')'
11656
11657
    __repr__ = __str__
11658
11659
11660
class MonitoredItemNotification(FrozenClass):
@@ 11438-11486 (lines=49) @@
11435
    __repr__ = __str__
11436
11437
11438
class SetPublishingModeResult(FrozenClass):
11439
    '''
11440
    :ivar Results:
11441
    :vartype Results: StatusCode
11442
    :ivar DiagnosticInfos:
11443
    :vartype DiagnosticInfos: DiagnosticInfo
11444
    '''
11445
    def __init__(self, binary=None):
11446
        if binary is not None:
11447
            self._binary_init(binary)
11448
            self._freeze = True
11449
            return
11450
        self.Results = []
11451
        self.DiagnosticInfos = []
11452
        self._freeze = True
11453
11454
    def to_binary(self):
11455
        packet = []
11456
        packet.append(uatype_Int32.pack(len(self.Results)))
11457
        for fieldname in self.Results:
11458
            packet.append(fieldname.to_binary())
11459
        packet.append(uatype_Int32.pack(len(self.DiagnosticInfos)))
11460
        for fieldname in self.DiagnosticInfos:
11461
            packet.append(fieldname.to_binary())
11462
        return b''.join(packet)
11463
11464
    @staticmethod
11465
    def from_binary(data):
11466
        return SetPublishingModeResult(data)
11467
11468
    def _binary_init(self, data):
11469
        length = uatype_Int32.unpack(data.read(4))[0]
11470
        array = []
11471
        if length != -1:
11472
            for _ in range(0, length):
11473
                array.append(StatusCode.from_binary(data))
11474
        self.Results = array
11475
        length = uatype_Int32.unpack(data.read(4))[0]
11476
        array = []
11477
        if length != -1:
11478
            for _ in range(0, length):
11479
                array.append(DiagnosticInfo.from_binary(data))
11480
        self.DiagnosticInfos = array
11481
11482
    def __str__(self):
11483
        return 'SetPublishingModeResult(' + 'Results:' + str(self.Results) + ', ' + \
11484
               'DiagnosticInfos:' + str(self.DiagnosticInfos) + ')'
11485
11486
    __repr__ = __str__
11487
11488
11489
class SetPublishingModeResponse(FrozenClass):
@@ 10515-10563 (lines=49) @@
10512
    __repr__ = __str__
10513
10514
10515
class SetMonitoringModeResult(FrozenClass):
10516
    '''
10517
    :ivar Results:
10518
    :vartype Results: StatusCode
10519
    :ivar DiagnosticInfos:
10520
    :vartype DiagnosticInfos: DiagnosticInfo
10521
    '''
10522
    def __init__(self, binary=None):
10523
        if binary is not None:
10524
            self._binary_init(binary)
10525
            self._freeze = True
10526
            return
10527
        self.Results = []
10528
        self.DiagnosticInfos = []
10529
        self._freeze = True
10530
10531
    def to_binary(self):
10532
        packet = []
10533
        packet.append(uatype_Int32.pack(len(self.Results)))
10534
        for fieldname in self.Results:
10535
            packet.append(fieldname.to_binary())
10536
        packet.append(uatype_Int32.pack(len(self.DiagnosticInfos)))
10537
        for fieldname in self.DiagnosticInfos:
10538
            packet.append(fieldname.to_binary())
10539
        return b''.join(packet)
10540
10541
    @staticmethod
10542
    def from_binary(data):
10543
        return SetMonitoringModeResult(data)
10544
10545
    def _binary_init(self, data):
10546
        length = uatype_Int32.unpack(data.read(4))[0]
10547
        array = []
10548
        if length != -1:
10549
            for _ in range(0, length):
10550
                array.append(StatusCode.from_binary(data))
10551
        self.Results = array
10552
        length = uatype_Int32.unpack(data.read(4))[0]
10553
        array = []
10554
        if length != -1:
10555
            for _ in range(0, length):
10556
                array.append(DiagnosticInfo.from_binary(data))
10557
        self.DiagnosticInfos = array
10558
10559
    def __str__(self):
10560
        return 'SetMonitoringModeResult(' + 'Results:' + str(self.Results) + ', ' + \
10561
               'DiagnosticInfos:' + str(self.DiagnosticInfos) + ')'
10562
10563
    __repr__ = __str__
10564
10565
10566
class SetMonitoringModeResponse(FrozenClass):
@@ 8308-8356 (lines=49) @@
8305
    __repr__ = __str__
8306
8307
8308
class HistoryModifiedData(FrozenClass):
8309
    '''
8310
    :ivar DataValues:
8311
    :vartype DataValues: DataValue
8312
    :ivar ModificationInfos:
8313
    :vartype ModificationInfos: ModificationInfo
8314
    '''
8315
    def __init__(self, binary=None):
8316
        if binary is not None:
8317
            self._binary_init(binary)
8318
            self._freeze = True
8319
            return
8320
        self.DataValues = []
8321
        self.ModificationInfos = []
8322
        self._freeze = True
8323
8324
    def to_binary(self):
8325
        packet = []
8326
        packet.append(uatype_Int32.pack(len(self.DataValues)))
8327
        for fieldname in self.DataValues:
8328
            packet.append(fieldname.to_binary())
8329
        packet.append(uatype_Int32.pack(len(self.ModificationInfos)))
8330
        for fieldname in self.ModificationInfos:
8331
            packet.append(fieldname.to_binary())
8332
        return b''.join(packet)
8333
8334
    @staticmethod
8335
    def from_binary(data):
8336
        return HistoryModifiedData(data)
8337
8338
    def _binary_init(self, data):
8339
        length = uatype_Int32.unpack(data.read(4))[0]
8340
        array = []
8341
        if length != -1:
8342
            for _ in range(0, length):
8343
                array.append(DataValue.from_binary(data))
8344
        self.DataValues = array
8345
        length = uatype_Int32.unpack(data.read(4))[0]
8346
        array = []
8347
        if length != -1:
8348
            for _ in range(0, length):
8349
                array.append(ModificationInfo.from_binary(data))
8350
        self.ModificationInfos = array
8351
8352
    def __str__(self):
8353
        return 'HistoryModifiedData(' + 'DataValues:' + str(self.DataValues) + ', ' + \
8354
               'ModificationInfos:' + str(self.ModificationInfos) + ')'
8355
8356
    __repr__ = __str__
8357
8358
8359
class HistoryEvent(FrozenClass):
@@ 7199-7247 (lines=49) @@
7196
    __repr__ = __str__
7197
7198
7199
class ContentFilterResult(FrozenClass):
7200
    '''
7201
    :ivar ElementResults:
7202
    :vartype ElementResults: ContentFilterElementResult
7203
    :ivar ElementDiagnosticInfos:
7204
    :vartype ElementDiagnosticInfos: DiagnosticInfo
7205
    '''
7206
    def __init__(self, binary=None):
7207
        if binary is not None:
7208
            self._binary_init(binary)
7209
            self._freeze = True
7210
            return
7211
        self.ElementResults = []
7212
        self.ElementDiagnosticInfos = []
7213
        self._freeze = True
7214
7215
    def to_binary(self):
7216
        packet = []
7217
        packet.append(uatype_Int32.pack(len(self.ElementResults)))
7218
        for fieldname in self.ElementResults:
7219
            packet.append(fieldname.to_binary())
7220
        packet.append(uatype_Int32.pack(len(self.ElementDiagnosticInfos)))
7221
        for fieldname in self.ElementDiagnosticInfos:
7222
            packet.append(fieldname.to_binary())
7223
        return b''.join(packet)
7224
7225
    @staticmethod
7226
    def from_binary(data):
7227
        return ContentFilterResult(data)
7228
7229
    def _binary_init(self, data):
7230
        length = uatype_Int32.unpack(data.read(4))[0]
7231
        array = []
7232
        if length != -1:
7233
            for _ in range(0, length):
7234
                array.append(ContentFilterElementResult.from_binary(data))
7235
        self.ElementResults = array
7236
        length = uatype_Int32.unpack(data.read(4))[0]
7237
        array = []
7238
        if length != -1:
7239
            for _ in range(0, length):
7240
                array.append(DiagnosticInfo.from_binary(data))
7241
        self.ElementDiagnosticInfos = array
7242
7243
    def __str__(self):
7244
        return 'ContentFilterResult(' + 'ElementResults:' + str(self.ElementResults) + ', ' + \
7245
               'ElementDiagnosticInfos:' + str(self.ElementDiagnosticInfos) + ')'
7246
7247
    __repr__ = __str__
7248
7249
7250
class ParsingResult(FrozenClass):
@@ 5707-5755 (lines=49) @@
5704
    __repr__ = __str__
5705
5706
5707
class BrowseNextResult(FrozenClass):
5708
    '''
5709
    :ivar Results:
5710
    :vartype Results: BrowseResult
5711
    :ivar DiagnosticInfos:
5712
    :vartype DiagnosticInfos: DiagnosticInfo
5713
    '''
5714
    def __init__(self, binary=None):
5715
        if binary is not None:
5716
            self._binary_init(binary)
5717
            self._freeze = True
5718
            return
5719
        self.Results = []
5720
        self.DiagnosticInfos = []
5721
        self._freeze = True
5722
5723
    def to_binary(self):
5724
        packet = []
5725
        packet.append(uatype_Int32.pack(len(self.Results)))
5726
        for fieldname in self.Results:
5727
            packet.append(fieldname.to_binary())
5728
        packet.append(uatype_Int32.pack(len(self.DiagnosticInfos)))
5729
        for fieldname in self.DiagnosticInfos:
5730
            packet.append(fieldname.to_binary())
5731
        return b''.join(packet)
5732
5733
    @staticmethod
5734
    def from_binary(data):
5735
        return BrowseNextResult(data)
5736
5737
    def _binary_init(self, data):
5738
        length = uatype_Int32.unpack(data.read(4))[0]
5739
        array = []
5740
        if length != -1:
5741
            for _ in range(0, length):
5742
                array.append(BrowseResult.from_binary(data))
5743
        self.Results = array
5744
        length = uatype_Int32.unpack(data.read(4))[0]
5745
        array = []
5746
        if length != -1:
5747
            for _ in range(0, length):
5748
                array.append(DiagnosticInfo.from_binary(data))
5749
        self.DiagnosticInfos = array
5750
5751
    def __str__(self):
5752
        return 'BrowseNextResult(' + 'Results:' + str(self.Results) + ', ' + \
5753
               'DiagnosticInfos:' + str(self.DiagnosticInfos) + ')'
5754
5755
    __repr__ = __str__
5756
5757
5758
class BrowseNextResponse(FrozenClass):
@@ 5138-5186 (lines=49) @@
5135
    __repr__ = __str__
5136
5137
5138
class DeleteReferencesResult(FrozenClass):
5139
    '''
5140
    :ivar Results:
5141
    :vartype Results: StatusCode
5142
    :ivar DiagnosticInfos:
5143
    :vartype DiagnosticInfos: DiagnosticInfo
5144
    '''
5145
    def __init__(self, binary=None):
5146
        if binary is not None:
5147
            self._binary_init(binary)
5148
            self._freeze = True
5149
            return
5150
        self.Results = []
5151
        self.DiagnosticInfos = []
5152
        self._freeze = True
5153
5154
    def to_binary(self):
5155
        packet = []
5156
        packet.append(uatype_Int32.pack(len(self.Results)))
5157
        for fieldname in self.Results:
5158
            packet.append(fieldname.to_binary())
5159
        packet.append(uatype_Int32.pack(len(self.DiagnosticInfos)))
5160
        for fieldname in self.DiagnosticInfos:
5161
            packet.append(fieldname.to_binary())
5162
        return b''.join(packet)
5163
5164
    @staticmethod
5165
    def from_binary(data):
5166
        return DeleteReferencesResult(data)
5167
5168
    def _binary_init(self, data):
5169
        length = uatype_Int32.unpack(data.read(4))[0]
5170
        array = []
5171
        if length != -1:
5172
            for _ in range(0, length):
5173
                array.append(StatusCode.from_binary(data))
5174
        self.Results = array
5175
        length = uatype_Int32.unpack(data.read(4))[0]
5176
        array = []
5177
        if length != -1:
5178
            for _ in range(0, length):
5179
                array.append(DiagnosticInfo.from_binary(data))
5180
        self.DiagnosticInfos = array
5181
5182
    def __str__(self):
5183
        return 'DeleteReferencesResult(' + 'Results:' + str(self.Results) + ', ' + \
5184
               'DiagnosticInfos:' + str(self.DiagnosticInfos) + ')'
5185
5186
    __repr__ = __str__
5187
5188
5189
class DeleteReferencesResponse(FrozenClass):