Code Duplication    Length = 42-44 lines in 6 locations

opcua/ua/uaprotocol_auto.py 6 locations

@@ 5972-6015 (lines=44) @@
5969
    __repr__ = __str__
5970
5971
5972
class BrowsePathResult(FrozenClass):
5973
    '''
5974
    The result of a translate opearation.
5975
5976
    :ivar StatusCode:
5977
    :vartype StatusCode: StatusCode
5978
    :ivar Targets:
5979
    :vartype Targets: BrowsePathTarget
5980
    '''
5981
    def __init__(self, binary=None):
5982
        if binary is not None:
5983
            self._binary_init(binary)
5984
            self._freeze = True
5985
            return
5986
        self.StatusCode = StatusCode()
5987
        self.Targets = []
5988
        self._freeze = True
5989
5990
    def to_binary(self):
5991
        packet = []
5992
        packet.append(self.StatusCode.to_binary())
5993
        packet.append(uatype_Int32.pack(len(self.Targets)))
5994
        for fieldname in self.Targets:
5995
            packet.append(fieldname.to_binary())
5996
        return b''.join(packet)
5997
5998
    @staticmethod
5999
    def from_binary(data):
6000
        return BrowsePathResult(data)
6001
6002
    def _binary_init(self, data):
6003
        self.StatusCode = StatusCode.from_binary(data)
6004
        length = uatype_Int32.unpack(data.read(4))[0]
6005
        array = []
6006
        if length != -1:
6007
            for _ in range(0, length):
6008
                array.append(BrowsePathTarget.from_binary(data))
6009
        self.Targets = array
6010
6011
    def __str__(self):
6012
        return 'BrowsePathResult(' + 'StatusCode:' + str(self.StatusCode) + ', ' + \
6013
               'Targets:' + str(self.Targets) + ')'
6014
6015
    __repr__ = __str__
6016
6017
6018
class TranslateBrowsePathsToNodeIdsParameters(FrozenClass):
@@ 10427-10469 (lines=43) @@
10424
    __repr__ = __str__
10425
10426
10427
class SetMonitoringModeParameters(FrozenClass):
10428
    '''
10429
    :ivar SubscriptionId:
10430
    :vartype SubscriptionId: UInt32
10431
    :ivar MonitoringMode:
10432
    :vartype MonitoringMode: MonitoringMode
10433
    :ivar MonitoredItemIds:
10434
    :vartype MonitoredItemIds: UInt32
10435
    '''
10436
    def __init__(self, binary=None):
10437
        if binary is not None:
10438
            self._binary_init(binary)
10439
            self._freeze = True
10440
            return
10441
        self.SubscriptionId = 0
10442
        self.MonitoringMode = MonitoringMode(0)
10443
        self.MonitoredItemIds = []
10444
        self._freeze = True
10445
10446
    def to_binary(self):
10447
        packet = []
10448
        packet.append(uatype_UInt32.pack(self.SubscriptionId))
10449
        packet.append(uatype_UInt32.pack(self.MonitoringMode.value))
10450
        packet.append(uatype_Int32.pack(len(self.MonitoredItemIds)))
10451
        for fieldname in self.MonitoredItemIds:
10452
            packet.append(uatype_UInt32.pack(fieldname))
10453
        return b''.join(packet)
10454
10455
    @staticmethod
10456
    def from_binary(data):
10457
        return SetMonitoringModeParameters(data)
10458
10459
    def _binary_init(self, data):
10460
        self.SubscriptionId = uatype_UInt32.unpack(data.read(4))[0]
10461
        self.MonitoringMode = MonitoringMode(uatype_UInt32.unpack(data.read(4))[0])
10462
        self.MonitoredItemIds = unpack_uatype_array('UInt32', data)
10463
10464
    def __str__(self):
10465
        return 'SetMonitoringModeParameters(' + 'SubscriptionId:' + str(self.SubscriptionId) + ', ' + \
10466
               'MonitoringMode:' + str(self.MonitoringMode) + ', ' + \
10467
               'MonitoredItemIds:' + str(self.MonitoredItemIds) + ')'
10468
10469
    __repr__ = __str__
10470
10471
10472
class SetMonitoringModeRequest(FrozenClass):
@@ 11735-11776 (lines=42) @@
11732
    __repr__ = __str__
11733
11734
11735
class EventFieldList(FrozenClass):
11736
    '''
11737
    :ivar ClientHandle:
11738
    :vartype ClientHandle: UInt32
11739
    :ivar EventFields:
11740
    :vartype EventFields: Variant
11741
    '''
11742
    def __init__(self, binary=None):
11743
        if binary is not None:
11744
            self._binary_init(binary)
11745
            self._freeze = True
11746
            return
11747
        self.ClientHandle = 0
11748
        self.EventFields = []
11749
        self._freeze = True
11750
11751
    def to_binary(self):
11752
        packet = []
11753
        packet.append(uatype_UInt32.pack(self.ClientHandle))
11754
        packet.append(uatype_Int32.pack(len(self.EventFields)))
11755
        for fieldname in self.EventFields:
11756
            packet.append(fieldname.to_binary())
11757
        return b''.join(packet)
11758
11759
    @staticmethod
11760
    def from_binary(data):
11761
        return EventFieldList(data)
11762
11763
    def _binary_init(self, data):
11764
        self.ClientHandle = uatype_UInt32.unpack(data.read(4))[0]
11765
        length = uatype_Int32.unpack(data.read(4))[0]
11766
        array = []
11767
        if length != -1:
11768
            for _ in range(0, length):
11769
                array.append(Variant.from_binary(data))
11770
        self.EventFields = array
11771
11772
    def __str__(self):
11773
        return 'EventFieldList(' + 'ClientHandle:' + str(self.ClientHandle) + ', ' + \
11774
               'EventFields:' + str(self.EventFields) + ')'
11775
11776
    __repr__ = __str__
11777
11778
11779
class HistoryEventFieldList(FrozenClass):
@@ 9601-9642 (lines=42) @@
9598
    __repr__ = __str__
9599
9600
9601
class EventFilter(FrozenClass):
9602
    '''
9603
    :ivar SelectClauses:
9604
    :vartype SelectClauses: SimpleAttributeOperand
9605
    :ivar WhereClause:
9606
    :vartype WhereClause: ContentFilter
9607
    '''
9608
    def __init__(self, binary=None):
9609
        if binary is not None:
9610
            self._binary_init(binary)
9611
            self._freeze = True
9612
            return
9613
        self.SelectClauses = []
9614
        self.WhereClause = ContentFilter()
9615
        self._freeze = True
9616
9617
    def to_binary(self):
9618
        packet = []
9619
        packet.append(uatype_Int32.pack(len(self.SelectClauses)))
9620
        for fieldname in self.SelectClauses:
9621
            packet.append(fieldname.to_binary())
9622
        packet.append(self.WhereClause.to_binary())
9623
        return b''.join(packet)
9624
9625
    @staticmethod
9626
    def from_binary(data):
9627
        return EventFilter(data)
9628
9629
    def _binary_init(self, data):
9630
        length = uatype_Int32.unpack(data.read(4))[0]
9631
        array = []
9632
        if length != -1:
9633
            for _ in range(0, length):
9634
                array.append(SimpleAttributeOperand.from_binary(data))
9635
        self.SelectClauses = array
9636
        self.WhereClause = ContentFilter.from_binary(data)
9637
9638
    def __str__(self):
9639
        return 'EventFilter(' + 'SelectClauses:' + str(self.SelectClauses) + ', ' + \
9640
               'WhereClause:' + str(self.WhereClause) + ')'
9641
9642
    __repr__ = __str__
9643
9644
9645
class AggregateConfiguration(FrozenClass):
@@ 6887-6928 (lines=42) @@
6884
    __repr__ = __str__
6885
6886
6887
class ContentFilterElement(FrozenClass):
6888
    '''
6889
    :ivar FilterOperator:
6890
    :vartype FilterOperator: FilterOperator
6891
    :ivar FilterOperands:
6892
    :vartype FilterOperands: ExtensionObject
6893
    '''
6894
    def __init__(self, binary=None):
6895
        if binary is not None:
6896
            self._binary_init(binary)
6897
            self._freeze = True
6898
            return
6899
        self.FilterOperator = FilterOperator(0)
6900
        self.FilterOperands = []
6901
        self._freeze = True
6902
6903
    def to_binary(self):
6904
        packet = []
6905
        packet.append(uatype_UInt32.pack(self.FilterOperator.value))
6906
        packet.append(uatype_Int32.pack(len(self.FilterOperands)))
6907
        for fieldname in self.FilterOperands:
6908
            packet.append(extensionobject_to_binary(fieldname))
6909
        return b''.join(packet)
6910
6911
    @staticmethod
6912
    def from_binary(data):
6913
        return ContentFilterElement(data)
6914
6915
    def _binary_init(self, data):
6916
        self.FilterOperator = FilterOperator(uatype_UInt32.unpack(data.read(4))[0])
6917
        length = uatype_Int32.unpack(data.read(4))[0]
6918
        array = []
6919
        if length != -1:
6920
            for _ in range(0, length):
6921
                array.append(extensionobject_from_binary(data))
6922
        self.FilterOperands = array
6923
6924
    def __str__(self):
6925
        return 'ContentFilterElement(' + 'FilterOperator:' + str(self.FilterOperator) + ', ' + \
6926
               'FilterOperands:' + str(self.FilterOperands) + ')'
6927
6928
    __repr__ = __str__
6929
6930
6931
class ContentFilter(FrozenClass):
@@ 2234-2275 (lines=42) @@
2231
    __repr__ = __str__
2232
2233
2234
class RegisterServer2Parameters(FrozenClass):
2235
    '''
2236
    :ivar Server:
2237
    :vartype Server: RegisteredServer
2238
    :ivar DiscoveryConfiguration:
2239
    :vartype DiscoveryConfiguration: ExtensionObject
2240
    '''
2241
    def __init__(self, binary=None):
2242
        if binary is not None:
2243
            self._binary_init(binary)
2244
            self._freeze = True
2245
            return
2246
        self.Server = RegisteredServer()
2247
        self.DiscoveryConfiguration = []
2248
        self._freeze = True
2249
2250
    def to_binary(self):
2251
        packet = []
2252
        packet.append(self.Server.to_binary())
2253
        packet.append(uatype_Int32.pack(len(self.DiscoveryConfiguration)))
2254
        for fieldname in self.DiscoveryConfiguration:
2255
            packet.append(extensionobject_to_binary(fieldname))
2256
        return b''.join(packet)
2257
2258
    @staticmethod
2259
    def from_binary(data):
2260
        return RegisterServer2Parameters(data)
2261
2262
    def _binary_init(self, data):
2263
        self.Server = RegisteredServer.from_binary(data)
2264
        length = uatype_Int32.unpack(data.read(4))[0]
2265
        array = []
2266
        if length != -1:
2267
            for _ in range(0, length):
2268
                array.append(extensionobject_from_binary(data))
2269
        self.DiscoveryConfiguration = array
2270
2271
    def __str__(self):
2272
        return 'RegisterServer2Parameters(' + 'Server:' + str(self.Server) + ', ' + \
2273
               'DiscoveryConfiguration:' + str(self.DiscoveryConfiguration) + ')'
2274
2275
    __repr__ = __str__
2276
2277
2278
class RegisterServer2Request(FrozenClass):