Code Duplication    Length = 55-55 lines in 8 locations

opcua/ua/uaprotocol_auto.py 8 locations

@@ 14056-14110 (lines=55) @@
14053
    __repr__ = __str__
14054
14055
14056
class TransferSubscriptionsResult(FrozenClass):
14057
    '''
14058
    :ivar Results:
14059
    :vartype Results: TransferResult
14060
    :ivar DiagnosticInfos:
14061
    :vartype DiagnosticInfos: DiagnosticInfo
14062
    '''
14063
14064
    ua_types = {
14065
        'Results': 'TransferResult',
14066
        'DiagnosticInfos': 'DiagnosticInfo',
14067
               }
14068
14069
    def __init__(self, binary=None):
14070
        if binary is not None:
14071
            self._binary_init(binary)
14072
            self._freeze = True
14073
            return
14074
        self.Results = []
14075
        self.DiagnosticInfos = []
14076
        self._freeze = True
14077
14078
    def to_binary(self):
14079
        packet = []
14080
        packet.append(uabin.Primitives.Int32.pack(len(self.Results)))
14081
        for fieldname in self.Results:
14082
            packet.append(fieldname.to_binary())
14083
        packet.append(uabin.Primitives.Int32.pack(len(self.DiagnosticInfos)))
14084
        for fieldname in self.DiagnosticInfos:
14085
            packet.append(fieldname.to_binary())
14086
        return b''.join(packet)
14087
14088
    @staticmethod
14089
    def from_binary(data):
14090
        return TransferSubscriptionsResult(data)
14091
14092
    def _binary_init(self, data):
14093
        length = uabin.Primitives.Int32.unpack(data)
14094
        array = []
14095
        if length != -1:
14096
            for _ in range(0, length):
14097
                array.append(TransferResult.from_binary(data))
14098
        self.Results = array
14099
        length = uabin.Primitives.Int32.unpack(data)
14100
        array = []
14101
        if length != -1:
14102
            for _ in range(0, length):
14103
                array.append(DiagnosticInfo.from_binary(data))
14104
        self.DiagnosticInfos = array
14105
14106
    def __str__(self):
14107
        return 'TransferSubscriptionsResult(' + 'Results:' + str(self.Results) + ', ' + \
14108
               'DiagnosticInfos:' + str(self.DiagnosticInfos) + ')'
14109
14110
    __repr__ = __str__
14111
14112
14113
class TransferSubscriptionsResponse(FrozenClass):
@@ 13221-13275 (lines=55) @@
13218
    __repr__ = __str__
13219
13220
13221
class DataChangeNotification(FrozenClass):
13222
    '''
13223
    :ivar MonitoredItems:
13224
    :vartype MonitoredItems: MonitoredItemNotification
13225
    :ivar DiagnosticInfos:
13226
    :vartype DiagnosticInfos: DiagnosticInfo
13227
    '''
13228
13229
    ua_types = {
13230
        'MonitoredItems': 'MonitoredItemNotification',
13231
        'DiagnosticInfos': 'DiagnosticInfo',
13232
               }
13233
13234
    def __init__(self, binary=None):
13235
        if binary is not None:
13236
            self._binary_init(binary)
13237
            self._freeze = True
13238
            return
13239
        self.MonitoredItems = []
13240
        self.DiagnosticInfos = []
13241
        self._freeze = True
13242
13243
    def to_binary(self):
13244
        packet = []
13245
        packet.append(uabin.Primitives.Int32.pack(len(self.MonitoredItems)))
13246
        for fieldname in self.MonitoredItems:
13247
            packet.append(fieldname.to_binary())
13248
        packet.append(uabin.Primitives.Int32.pack(len(self.DiagnosticInfos)))
13249
        for fieldname in self.DiagnosticInfos:
13250
            packet.append(fieldname.to_binary())
13251
        return b''.join(packet)
13252
13253
    @staticmethod
13254
    def from_binary(data):
13255
        return DataChangeNotification(data)
13256
13257
    def _binary_init(self, data):
13258
        length = uabin.Primitives.Int32.unpack(data)
13259
        array = []
13260
        if length != -1:
13261
            for _ in range(0, length):
13262
                array.append(MonitoredItemNotification.from_binary(data))
13263
        self.MonitoredItems = array
13264
        length = uabin.Primitives.Int32.unpack(data)
13265
        array = []
13266
        if length != -1:
13267
            for _ in range(0, length):
13268
                array.append(DiagnosticInfo.from_binary(data))
13269
        self.DiagnosticInfos = array
13270
13271
    def __str__(self):
13272
        return 'DataChangeNotification(' + 'MonitoredItems:' + str(self.MonitoredItems) + ', ' + \
13273
               'DiagnosticInfos:' + str(self.DiagnosticInfos) + ')'
13274
13275
    __repr__ = __str__
13276
13277
13278
class MonitoredItemNotification(FrozenClass):
@@ 13026-13080 (lines=55) @@
13023
    __repr__ = __str__
13024
13025
13026
class SetPublishingModeResult(FrozenClass):
13027
    '''
13028
    :ivar Results:
13029
    :vartype Results: StatusCode
13030
    :ivar DiagnosticInfos:
13031
    :vartype DiagnosticInfos: DiagnosticInfo
13032
    '''
13033
13034
    ua_types = {
13035
        'Results': 'StatusCode',
13036
        'DiagnosticInfos': 'DiagnosticInfo',
13037
               }
13038
13039
    def __init__(self, binary=None):
13040
        if binary is not None:
13041
            self._binary_init(binary)
13042
            self._freeze = True
13043
            return
13044
        self.Results = []
13045
        self.DiagnosticInfos = []
13046
        self._freeze = True
13047
13048
    def to_binary(self):
13049
        packet = []
13050
        packet.append(uabin.Primitives.Int32.pack(len(self.Results)))
13051
        for fieldname in self.Results:
13052
            packet.append(fieldname.to_binary())
13053
        packet.append(uabin.Primitives.Int32.pack(len(self.DiagnosticInfos)))
13054
        for fieldname in self.DiagnosticInfos:
13055
            packet.append(fieldname.to_binary())
13056
        return b''.join(packet)
13057
13058
    @staticmethod
13059
    def from_binary(data):
13060
        return SetPublishingModeResult(data)
13061
13062
    def _binary_init(self, data):
13063
        length = uabin.Primitives.Int32.unpack(data)
13064
        array = []
13065
        if length != -1:
13066
            for _ in range(0, length):
13067
                array.append(StatusCode.from_binary(data))
13068
        self.Results = array
13069
        length = uabin.Primitives.Int32.unpack(data)
13070
        array = []
13071
        if length != -1:
13072
            for _ in range(0, length):
13073
                array.append(DiagnosticInfo.from_binary(data))
13074
        self.DiagnosticInfos = array
13075
13076
    def __str__(self):
13077
        return 'SetPublishingModeResult(' + 'Results:' + str(self.Results) + ', ' + \
13078
               'DiagnosticInfos:' + str(self.DiagnosticInfos) + ')'
13079
13080
    __repr__ = __str__
13081
13082
13083
class SetPublishingModeResponse(FrozenClass):
@@ 11963-12017 (lines=55) @@
11960
    __repr__ = __str__
11961
11962
11963
class SetMonitoringModeResult(FrozenClass):
11964
    '''
11965
    :ivar Results:
11966
    :vartype Results: StatusCode
11967
    :ivar DiagnosticInfos:
11968
    :vartype DiagnosticInfos: DiagnosticInfo
11969
    '''
11970
11971
    ua_types = {
11972
        'Results': 'StatusCode',
11973
        'DiagnosticInfos': 'DiagnosticInfo',
11974
               }
11975
11976
    def __init__(self, binary=None):
11977
        if binary is not None:
11978
            self._binary_init(binary)
11979
            self._freeze = True
11980
            return
11981
        self.Results = []
11982
        self.DiagnosticInfos = []
11983
        self._freeze = True
11984
11985
    def to_binary(self):
11986
        packet = []
11987
        packet.append(uabin.Primitives.Int32.pack(len(self.Results)))
11988
        for fieldname in self.Results:
11989
            packet.append(fieldname.to_binary())
11990
        packet.append(uabin.Primitives.Int32.pack(len(self.DiagnosticInfos)))
11991
        for fieldname in self.DiagnosticInfos:
11992
            packet.append(fieldname.to_binary())
11993
        return b''.join(packet)
11994
11995
    @staticmethod
11996
    def from_binary(data):
11997
        return SetMonitoringModeResult(data)
11998
11999
    def _binary_init(self, data):
12000
        length = uabin.Primitives.Int32.unpack(data)
12001
        array = []
12002
        if length != -1:
12003
            for _ in range(0, length):
12004
                array.append(StatusCode.from_binary(data))
12005
        self.Results = array
12006
        length = uabin.Primitives.Int32.unpack(data)
12007
        array = []
12008
        if length != -1:
12009
            for _ in range(0, length):
12010
                array.append(DiagnosticInfo.from_binary(data))
12011
        self.DiagnosticInfos = array
12012
12013
    def __str__(self):
12014
        return 'SetMonitoringModeResult(' + 'Results:' + str(self.Results) + ', ' + \
12015
               'DiagnosticInfos:' + str(self.DiagnosticInfos) + ')'
12016
12017
    __repr__ = __str__
12018
12019
12020
class SetMonitoringModeResponse(FrozenClass):
@@ 9436-9490 (lines=55) @@
9433
    __repr__ = __str__
9434
9435
9436
class HistoryModifiedData(FrozenClass):
9437
    '''
9438
    :ivar DataValues:
9439
    :vartype DataValues: DataValue
9440
    :ivar ModificationInfos:
9441
    :vartype ModificationInfos: ModificationInfo
9442
    '''
9443
9444
    ua_types = {
9445
        'DataValues': 'DataValue',
9446
        'ModificationInfos': 'ModificationInfo',
9447
               }
9448
9449
    def __init__(self, binary=None):
9450
        if binary is not None:
9451
            self._binary_init(binary)
9452
            self._freeze = True
9453
            return
9454
        self.DataValues = []
9455
        self.ModificationInfos = []
9456
        self._freeze = True
9457
9458
    def to_binary(self):
9459
        packet = []
9460
        packet.append(uabin.Primitives.Int32.pack(len(self.DataValues)))
9461
        for fieldname in self.DataValues:
9462
            packet.append(fieldname.to_binary())
9463
        packet.append(uabin.Primitives.Int32.pack(len(self.ModificationInfos)))
9464
        for fieldname in self.ModificationInfos:
9465
            packet.append(fieldname.to_binary())
9466
        return b''.join(packet)
9467
9468
    @staticmethod
9469
    def from_binary(data):
9470
        return HistoryModifiedData(data)
9471
9472
    def _binary_init(self, data):
9473
        length = uabin.Primitives.Int32.unpack(data)
9474
        array = []
9475
        if length != -1:
9476
            for _ in range(0, length):
9477
                array.append(DataValue.from_binary(data))
9478
        self.DataValues = array
9479
        length = uabin.Primitives.Int32.unpack(data)
9480
        array = []
9481
        if length != -1:
9482
            for _ in range(0, length):
9483
                array.append(ModificationInfo.from_binary(data))
9484
        self.ModificationInfos = array
9485
9486
    def __str__(self):
9487
        return 'HistoryModifiedData(' + 'DataValues:' + str(self.DataValues) + ', ' + \
9488
               'ModificationInfos:' + str(self.ModificationInfos) + ')'
9489
9490
    __repr__ = __str__
9491
9492
9493
class HistoryEvent(FrozenClass):
@@ 8163-8217 (lines=55) @@
8160
    __repr__ = __str__
8161
8162
8163
class ContentFilterResult(FrozenClass):
8164
    '''
8165
    :ivar ElementResults:
8166
    :vartype ElementResults: ContentFilterElementResult
8167
    :ivar ElementDiagnosticInfos:
8168
    :vartype ElementDiagnosticInfos: DiagnosticInfo
8169
    '''
8170
8171
    ua_types = {
8172
        'ElementResults': 'ContentFilterElementResult',
8173
        'ElementDiagnosticInfos': 'DiagnosticInfo',
8174
               }
8175
8176
    def __init__(self, binary=None):
8177
        if binary is not None:
8178
            self._binary_init(binary)
8179
            self._freeze = True
8180
            return
8181
        self.ElementResults = []
8182
        self.ElementDiagnosticInfos = []
8183
        self._freeze = True
8184
8185
    def to_binary(self):
8186
        packet = []
8187
        packet.append(uabin.Primitives.Int32.pack(len(self.ElementResults)))
8188
        for fieldname in self.ElementResults:
8189
            packet.append(fieldname.to_binary())
8190
        packet.append(uabin.Primitives.Int32.pack(len(self.ElementDiagnosticInfos)))
8191
        for fieldname in self.ElementDiagnosticInfos:
8192
            packet.append(fieldname.to_binary())
8193
        return b''.join(packet)
8194
8195
    @staticmethod
8196
    def from_binary(data):
8197
        return ContentFilterResult(data)
8198
8199
    def _binary_init(self, data):
8200
        length = uabin.Primitives.Int32.unpack(data)
8201
        array = []
8202
        if length != -1:
8203
            for _ in range(0, length):
8204
                array.append(ContentFilterElementResult.from_binary(data))
8205
        self.ElementResults = array
8206
        length = uabin.Primitives.Int32.unpack(data)
8207
        array = []
8208
        if length != -1:
8209
            for _ in range(0, length):
8210
                array.append(DiagnosticInfo.from_binary(data))
8211
        self.ElementDiagnosticInfos = array
8212
8213
    def __str__(self):
8214
        return 'ContentFilterResult(' + 'ElementResults:' + str(self.ElementResults) + ', ' + \
8215
               'ElementDiagnosticInfos:' + str(self.ElementDiagnosticInfos) + ')'
8216
8217
    __repr__ = __str__
8218
8219
8220
class ParsingResult(FrozenClass):
@@ 6454-6508 (lines=55) @@
6451
    __repr__ = __str__
6452
6453
6454
class BrowseNextResult(FrozenClass):
6455
    '''
6456
    :ivar Results:
6457
    :vartype Results: BrowseResult
6458
    :ivar DiagnosticInfos:
6459
    :vartype DiagnosticInfos: DiagnosticInfo
6460
    '''
6461
6462
    ua_types = {
6463
        'Results': 'BrowseResult',
6464
        'DiagnosticInfos': 'DiagnosticInfo',
6465
               }
6466
6467
    def __init__(self, binary=None):
6468
        if binary is not None:
6469
            self._binary_init(binary)
6470
            self._freeze = True
6471
            return
6472
        self.Results = []
6473
        self.DiagnosticInfos = []
6474
        self._freeze = True
6475
6476
    def to_binary(self):
6477
        packet = []
6478
        packet.append(uabin.Primitives.Int32.pack(len(self.Results)))
6479
        for fieldname in self.Results:
6480
            packet.append(fieldname.to_binary())
6481
        packet.append(uabin.Primitives.Int32.pack(len(self.DiagnosticInfos)))
6482
        for fieldname in self.DiagnosticInfos:
6483
            packet.append(fieldname.to_binary())
6484
        return b''.join(packet)
6485
6486
    @staticmethod
6487
    def from_binary(data):
6488
        return BrowseNextResult(data)
6489
6490
    def _binary_init(self, data):
6491
        length = uabin.Primitives.Int32.unpack(data)
6492
        array = []
6493
        if length != -1:
6494
            for _ in range(0, length):
6495
                array.append(BrowseResult.from_binary(data))
6496
        self.Results = array
6497
        length = uabin.Primitives.Int32.unpack(data)
6498
        array = []
6499
        if length != -1:
6500
            for _ in range(0, length):
6501
                array.append(DiagnosticInfo.from_binary(data))
6502
        self.DiagnosticInfos = array
6503
6504
    def __str__(self):
6505
        return 'BrowseNextResult(' + 'Results:' + str(self.Results) + ', ' + \
6506
               'DiagnosticInfos:' + str(self.DiagnosticInfos) + ')'
6507
6508
    __repr__ = __str__
6509
6510
6511
class BrowseNextResponse(FrozenClass):
@@ 5802-5856 (lines=55) @@
5799
    __repr__ = __str__
5800
5801
5802
class DeleteReferencesResult(FrozenClass):
5803
    '''
5804
    :ivar Results:
5805
    :vartype Results: StatusCode
5806
    :ivar DiagnosticInfos:
5807
    :vartype DiagnosticInfos: DiagnosticInfo
5808
    '''
5809
5810
    ua_types = {
5811
        'Results': 'StatusCode',
5812
        'DiagnosticInfos': 'DiagnosticInfo',
5813
               }
5814
5815
    def __init__(self, binary=None):
5816
        if binary is not None:
5817
            self._binary_init(binary)
5818
            self._freeze = True
5819
            return
5820
        self.Results = []
5821
        self.DiagnosticInfos = []
5822
        self._freeze = True
5823
5824
    def to_binary(self):
5825
        packet = []
5826
        packet.append(uabin.Primitives.Int32.pack(len(self.Results)))
5827
        for fieldname in self.Results:
5828
            packet.append(fieldname.to_binary())
5829
        packet.append(uabin.Primitives.Int32.pack(len(self.DiagnosticInfos)))
5830
        for fieldname in self.DiagnosticInfos:
5831
            packet.append(fieldname.to_binary())
5832
        return b''.join(packet)
5833
5834
    @staticmethod
5835
    def from_binary(data):
5836
        return DeleteReferencesResult(data)
5837
5838
    def _binary_init(self, data):
5839
        length = uabin.Primitives.Int32.unpack(data)
5840
        array = []
5841
        if length != -1:
5842
            for _ in range(0, length):
5843
                array.append(StatusCode.from_binary(data))
5844
        self.Results = array
5845
        length = uabin.Primitives.Int32.unpack(data)
5846
        array = []
5847
        if length != -1:
5848
            for _ in range(0, length):
5849
                array.append(DiagnosticInfo.from_binary(data))
5850
        self.DiagnosticInfos = array
5851
5852
    def __str__(self):
5853
        return 'DeleteReferencesResult(' + 'Results:' + str(self.Results) + ', ' + \
5854
               'DiagnosticInfos:' + str(self.DiagnosticInfos) + ')'
5855
5856
    __repr__ = __str__
5857
5858
5859
class DeleteReferencesResponse(FrozenClass):