Code Duplication    Length = 50-52 lines in 4 locations

opcua/ua/uaprotocol_auto.py 4 locations

@@ 2021-2072 (lines=52) @@
2018
    __repr__ = __str__
2019
2020
2021
class GetEndpointsParameters(FrozenClass):
2022
    '''
2023
    :ivar EndpointUrl:
2024
    :vartype EndpointUrl: String
2025
    :ivar LocaleIds:
2026
    :vartype LocaleIds: String
2027
    :ivar ProfileUris:
2028
    :vartype ProfileUris: String
2029
    '''
2030
2031
    ua_types = {
2032
        'EndpointUrl': 'String',
2033
        'LocaleIds': 'String',
2034
        'ProfileUris': 'String',
2035
               }
2036
2037
    def __init__(self, binary=None):
2038
        if binary is not None:
2039
            self._binary_init(binary)
2040
            self._freeze = True
2041
            return
2042
        self.EndpointUrl = None
2043
        self.LocaleIds = []
2044
        self.ProfileUris = []
2045
        self._freeze = True
2046
2047
    def to_binary(self):
2048
        packet = []
2049
        packet.append(uabin.Primitives.String.pack(self.EndpointUrl))
2050
        packet.append(uabin.Primitives.Int32.pack(len(self.LocaleIds)))
2051
        for fieldname in self.LocaleIds:
2052
            packet.append(uabin.Primitives.String.pack(fieldname))
2053
        packet.append(uabin.Primitives.Int32.pack(len(self.ProfileUris)))
2054
        for fieldname in self.ProfileUris:
2055
            packet.append(uabin.Primitives.String.pack(fieldname))
2056
        return b''.join(packet)
2057
2058
    @staticmethod
2059
    def from_binary(data):
2060
        return GetEndpointsParameters(data)
2061
2062
    def _binary_init(self, data):
2063
        self.EndpointUrl = uabin.Primitives.String.unpack(data)
2064
        self.LocaleIds = uabin.Primitives.String.unpack_array(data)
2065
        self.ProfileUris = uabin.Primitives.String.unpack_array(data)
2066
2067
    def __str__(self):
2068
        return 'GetEndpointsParameters(' + 'EndpointUrl:' + str(self.EndpointUrl) + ', ' + \
2069
               'LocaleIds:' + str(self.LocaleIds) + ', ' + \
2070
               'ProfileUris:' + str(self.ProfileUris) + ')'
2071
2072
    __repr__ = __str__
2073
2074
2075
class GetEndpointsRequest(FrozenClass):
@@ 1435-1486 (lines=52) @@
1432
    __repr__ = __str__
1433
1434
1435
class FindServersParameters(FrozenClass):
1436
    '''
1437
    :ivar EndpointUrl:
1438
    :vartype EndpointUrl: String
1439
    :ivar LocaleIds:
1440
    :vartype LocaleIds: String
1441
    :ivar ServerUris:
1442
    :vartype ServerUris: String
1443
    '''
1444
1445
    ua_types = {
1446
        'EndpointUrl': 'String',
1447
        'LocaleIds': 'String',
1448
        'ServerUris': 'String',
1449
               }
1450
1451
    def __init__(self, binary=None):
1452
        if binary is not None:
1453
            self._binary_init(binary)
1454
            self._freeze = True
1455
            return
1456
        self.EndpointUrl = None
1457
        self.LocaleIds = []
1458
        self.ServerUris = []
1459
        self._freeze = True
1460
1461
    def to_binary(self):
1462
        packet = []
1463
        packet.append(uabin.Primitives.String.pack(self.EndpointUrl))
1464
        packet.append(uabin.Primitives.Int32.pack(len(self.LocaleIds)))
1465
        for fieldname in self.LocaleIds:
1466
            packet.append(uabin.Primitives.String.pack(fieldname))
1467
        packet.append(uabin.Primitives.Int32.pack(len(self.ServerUris)))
1468
        for fieldname in self.ServerUris:
1469
            packet.append(uabin.Primitives.String.pack(fieldname))
1470
        return b''.join(packet)
1471
1472
    @staticmethod
1473
    def from_binary(data):
1474
        return FindServersParameters(data)
1475
1476
    def _binary_init(self, data):
1477
        self.EndpointUrl = uabin.Primitives.String.unpack(data)
1478
        self.LocaleIds = uabin.Primitives.String.unpack_array(data)
1479
        self.ServerUris = uabin.Primitives.String.unpack_array(data)
1480
1481
    def __str__(self):
1482
        return 'FindServersParameters(' + 'EndpointUrl:' + str(self.EndpointUrl) + ', ' + \
1483
               'LocaleIds:' + str(self.LocaleIds) + ', ' + \
1484
               'ServerUris:' + str(self.ServerUris) + ')'
1485
1486
    __repr__ = __str__
1487
1488
1489
class FindServersRequest(FrozenClass):
@@ 11861-11910 (lines=50) @@
11858
    __repr__ = __str__
11859
11860
11861
class SetMonitoringModeParameters(FrozenClass):
11862
    '''
11863
    :ivar SubscriptionId:
11864
    :vartype SubscriptionId: UInt32
11865
    :ivar MonitoringMode:
11866
    :vartype MonitoringMode: MonitoringMode
11867
    :ivar MonitoredItemIds:
11868
    :vartype MonitoredItemIds: UInt32
11869
    '''
11870
11871
    ua_types = {
11872
        'SubscriptionId': 'UInt32',
11873
        'MonitoringMode': 'MonitoringMode',
11874
        'MonitoredItemIds': 'UInt32',
11875
               }
11876
11877
    def __init__(self, binary=None):
11878
        if binary is not None:
11879
            self._binary_init(binary)
11880
            self._freeze = True
11881
            return
11882
        self.SubscriptionId = 0
11883
        self.MonitoringMode = MonitoringMode(0)
11884
        self.MonitoredItemIds = []
11885
        self._freeze = True
11886
11887
    def to_binary(self):
11888
        packet = []
11889
        packet.append(uabin.Primitives.UInt32.pack(self.SubscriptionId))
11890
        packet.append(uabin.Primitives.UInt32.pack(self.MonitoringMode.value))
11891
        packet.append(uabin.Primitives.Int32.pack(len(self.MonitoredItemIds)))
11892
        for fieldname in self.MonitoredItemIds:
11893
            packet.append(uabin.Primitives.UInt32.pack(fieldname))
11894
        return b''.join(packet)
11895
11896
    @staticmethod
11897
    def from_binary(data):
11898
        return SetMonitoringModeParameters(data)
11899
11900
    def _binary_init(self, data):
11901
        self.SubscriptionId = uabin.Primitives.UInt32.unpack(data)
11902
        self.MonitoringMode = MonitoringMode(uabin.Primitives.UInt32.unpack(data))
11903
        self.MonitoredItemIds = uabin.Primitives.UInt32.unpack_array(data)
11904
11905
    def __str__(self):
11906
        return 'SetMonitoringModeParameters(' + 'SubscriptionId:' + str(self.SubscriptionId) + ', ' + \
11907
               'MonitoringMode:' + str(self.MonitoringMode) + ', ' + \
11908
               'MonitoredItemIds:' + str(self.MonitoredItemIds) + ')'
11909
11910
    __repr__ = __str__
11911
11912
11913
class SetMonitoringModeRequest(FrozenClass):
@@ 1659-1708 (lines=50) @@
1656
    __repr__ = __str__
1657
1658
1659
class FindServersOnNetworkParameters(FrozenClass):
1660
    '''
1661
    :ivar StartingRecordId:
1662
    :vartype StartingRecordId: UInt32
1663
    :ivar MaxRecordsToReturn:
1664
    :vartype MaxRecordsToReturn: UInt32
1665
    :ivar ServerCapabilityFilter:
1666
    :vartype ServerCapabilityFilter: String
1667
    '''
1668
1669
    ua_types = {
1670
        'StartingRecordId': 'UInt32',
1671
        'MaxRecordsToReturn': 'UInt32',
1672
        'ServerCapabilityFilter': 'String',
1673
               }
1674
1675
    def __init__(self, binary=None):
1676
        if binary is not None:
1677
            self._binary_init(binary)
1678
            self._freeze = True
1679
            return
1680
        self.StartingRecordId = 0
1681
        self.MaxRecordsToReturn = 0
1682
        self.ServerCapabilityFilter = []
1683
        self._freeze = True
1684
1685
    def to_binary(self):
1686
        packet = []
1687
        packet.append(uabin.Primitives.UInt32.pack(self.StartingRecordId))
1688
        packet.append(uabin.Primitives.UInt32.pack(self.MaxRecordsToReturn))
1689
        packet.append(uabin.Primitives.Int32.pack(len(self.ServerCapabilityFilter)))
1690
        for fieldname in self.ServerCapabilityFilter:
1691
            packet.append(uabin.Primitives.String.pack(fieldname))
1692
        return b''.join(packet)
1693
1694
    @staticmethod
1695
    def from_binary(data):
1696
        return FindServersOnNetworkParameters(data)
1697
1698
    def _binary_init(self, data):
1699
        self.StartingRecordId = uabin.Primitives.UInt32.unpack(data)
1700
        self.MaxRecordsToReturn = uabin.Primitives.UInt32.unpack(data)
1701
        self.ServerCapabilityFilter = uabin.Primitives.String.unpack_array(data)
1702
1703
    def __str__(self):
1704
        return 'FindServersOnNetworkParameters(' + 'StartingRecordId:' + str(self.StartingRecordId) + ', ' + \
1705
               'MaxRecordsToReturn:' + str(self.MaxRecordsToReturn) + ', ' + \
1706
               'ServerCapabilityFilter:' + str(self.ServerCapabilityFilter) + ')'
1707
1708
    __repr__ = __str__
1709
1710
1711
class FindServersOnNetworkRequest(FrozenClass):