Code Duplication    Length = 53-55 lines in 2 locations

opcua/ua/uaprotocol_auto.py 2 locations

@@ 11531-11585 (lines=55) @@
11528
    __repr__ = __str__
11529
11530
11531
class SetTriggeringParameters(FrozenClass):
11532
    '''
11533
    :ivar SubscriptionId:
11534
    :vartype SubscriptionId: UInt32
11535
    :ivar TriggeringItemId:
11536
    :vartype TriggeringItemId: UInt32
11537
    :ivar LinksToAdd:
11538
    :vartype LinksToAdd: UInt32
11539
    :ivar LinksToRemove:
11540
    :vartype LinksToRemove: UInt32
11541
    '''
11542
11543
    ua_types = [
11544
11545
        ('SubscriptionId', 'UInt32'),
11546
        ('TriggeringItemId', 'UInt32'),
11547
        ('LinksToAdd', 'ListOfUInt32'),
11548
        ('LinksToRemove', 'ListOfUInt32'),
11549
               ]
11550
11551
    def __init__(self):
11552
        self.SubscriptionId = 0
11553
        self.TriggeringItemId = 0
11554
        self.LinksToAdd = []
11555
        self.LinksToRemove = []
11556
        self._freeze = True
11557
11558
    def to_binary(self):
11559
        packet = []
11560
        packet.append(uabin.Primitives.UInt32.pack(self.SubscriptionId))
11561
        packet.append(uabin.Primitives.UInt32.pack(self.TriggeringItemId))
11562
        packet.append(uabin.Primitives.Int32.pack(len(self.LinksToAdd)))
11563
        for fieldname in self.LinksToAdd:
11564
            packet.append(uabin.Primitives.UInt32.pack(fieldname))
11565
        packet.append(uabin.Primitives.Int32.pack(len(self.LinksToRemove)))
11566
        for fieldname in self.LinksToRemove:
11567
            packet.append(uabin.Primitives.UInt32.pack(fieldname))
11568
        return b''.join(packet)
11569
11570
    @staticmethod
11571
    def from_binary(data):
11572
        obj = SetTriggeringParameters()
11573
        self.SubscriptionId = uabin.Primitives.UInt32.unpack(data)
11574
        self.TriggeringItemId = uabin.Primitives.UInt32.unpack(data)
11575
        obj.LinksToAdd = uabin.Primitives.UInt32.unpack_array(data)
11576
        obj.LinksToRemove = uabin.Primitives.UInt32.unpack_array(data)
11577
        return obj
11578
11579
    def __str__(self):
11580
        return 'SetTriggeringParameters(' + 'SubscriptionId:' + str(self.SubscriptionId) + ', ' + \
11581
               'TriggeringItemId:' + str(self.TriggeringItemId) + ', ' + \
11582
               'LinksToAdd:' + str(self.LinksToAdd) + ', ' + \
11583
               'LinksToRemove:' + str(self.LinksToRemove) + ')'
11584
11585
    __repr__ = __str__
11586
11587
11588
class SetTriggeringRequest(FrozenClass):
@@ 1769-1821 (lines=53) @@
1766
    __repr__ = __str__
1767
1768
1769
class ServerOnNetwork(FrozenClass):
1770
    '''
1771
    :ivar RecordId:
1772
    :vartype RecordId: UInt32
1773
    :ivar ServerName:
1774
    :vartype ServerName: String
1775
    :ivar DiscoveryUrl:
1776
    :vartype DiscoveryUrl: String
1777
    :ivar ServerCapabilities:
1778
    :vartype ServerCapabilities: String
1779
    '''
1780
1781
    ua_types = [
1782
1783
        ('RecordId', 'UInt32'),
1784
        ('ServerName', 'String'),
1785
        ('DiscoveryUrl', 'String'),
1786
        ('ServerCapabilities', 'ListOfString'),
1787
               ]
1788
1789
    def __init__(self):
1790
        self.RecordId = 0
1791
        self.ServerName = None
1792
        self.DiscoveryUrl = None
1793
        self.ServerCapabilities = []
1794
        self._freeze = True
1795
1796
    def to_binary(self):
1797
        packet = []
1798
        packet.append(uabin.Primitives.UInt32.pack(self.RecordId))
1799
        packet.append(uabin.Primitives.String.pack(self.ServerName))
1800
        packet.append(uabin.Primitives.String.pack(self.DiscoveryUrl))
1801
        packet.append(uabin.Primitives.Int32.pack(len(self.ServerCapabilities)))
1802
        for fieldname in self.ServerCapabilities:
1803
            packet.append(uabin.Primitives.String.pack(fieldname))
1804
        return b''.join(packet)
1805
1806
    @staticmethod
1807
    def from_binary(data):
1808
        obj = ServerOnNetwork()
1809
        self.RecordId = uabin.Primitives.UInt32.unpack(data)
1810
        self.ServerName = uabin.Primitives.String.unpack(data)
1811
        self.DiscoveryUrl = uabin.Primitives.String.unpack(data)
1812
        obj.ServerCapabilities = uabin.Primitives.String.unpack_array(data)
1813
        return obj
1814
1815
    def __str__(self):
1816
        return 'ServerOnNetwork(' + 'RecordId:' + str(self.RecordId) + ', ' + \
1817
               'ServerName:' + str(self.ServerName) + ', ' + \
1818
               'DiscoveryUrl:' + str(self.DiscoveryUrl) + ', ' + \
1819
               'ServerCapabilities:' + str(self.ServerCapabilities) + ')'
1820
1821
    __repr__ = __str__
1822
1823
1824
class FindServersOnNetworkParameters(FrozenClass):