Code Duplication    Length = 69-69 lines in 2 locations

opcua/ua/uaprotocol_auto.py 2 locations

@@ 12710-12778 (lines=69) @@
12707
    __repr__ = __str__
12708
12709
12710
class ModifySubscriptionParameters(FrozenClass):
12711
    '''
12712
    :ivar SubscriptionId:
12713
    :vartype SubscriptionId: UInt32
12714
    :ivar RequestedPublishingInterval:
12715
    :vartype RequestedPublishingInterval: Double
12716
    :ivar RequestedLifetimeCount:
12717
    :vartype RequestedLifetimeCount: UInt32
12718
    :ivar RequestedMaxKeepAliveCount:
12719
    :vartype RequestedMaxKeepAliveCount: UInt32
12720
    :ivar MaxNotificationsPerPublish:
12721
    :vartype MaxNotificationsPerPublish: UInt32
12722
    :ivar Priority:
12723
    :vartype Priority: Byte
12724
    '''
12725
12726
    ua_types = {
12727
        'SubscriptionId': 'UInt32',
12728
        'RequestedPublishingInterval': 'Double',
12729
        'RequestedLifetimeCount': 'UInt32',
12730
        'RequestedMaxKeepAliveCount': 'UInt32',
12731
        'MaxNotificationsPerPublish': 'UInt32',
12732
        'Priority': 'Byte',
12733
               }
12734
12735
    def __init__(self, binary=None):
12736
        if binary is not None:
12737
            self._binary_init(binary)
12738
            self._freeze = True
12739
            return
12740
        self.SubscriptionId = 0
12741
        self.RequestedPublishingInterval = 0
12742
        self.RequestedLifetimeCount = 0
12743
        self.RequestedMaxKeepAliveCount = 0
12744
        self.MaxNotificationsPerPublish = 0
12745
        self.Priority = 0
12746
        self._freeze = True
12747
12748
    def to_binary(self):
12749
        packet = []
12750
        packet.append(uabin.Primitives.UInt32.pack(self.SubscriptionId))
12751
        packet.append(uabin.Primitives.Double.pack(self.RequestedPublishingInterval))
12752
        packet.append(uabin.Primitives.UInt32.pack(self.RequestedLifetimeCount))
12753
        packet.append(uabin.Primitives.UInt32.pack(self.RequestedMaxKeepAliveCount))
12754
        packet.append(uabin.Primitives.UInt32.pack(self.MaxNotificationsPerPublish))
12755
        packet.append(uabin.Primitives.Byte.pack(self.Priority))
12756
        return b''.join(packet)
12757
12758
    @staticmethod
12759
    def from_binary(data):
12760
        return ModifySubscriptionParameters(data)
12761
12762
    def _binary_init(self, data):
12763
        self.SubscriptionId = uabin.Primitives.UInt32.unpack(data)
12764
        self.RequestedPublishingInterval = uabin.Primitives.Double.unpack(data)
12765
        self.RequestedLifetimeCount = uabin.Primitives.UInt32.unpack(data)
12766
        self.RequestedMaxKeepAliveCount = uabin.Primitives.UInt32.unpack(data)
12767
        self.MaxNotificationsPerPublish = uabin.Primitives.UInt32.unpack(data)
12768
        self.Priority = uabin.Primitives.Byte.unpack(data)
12769
12770
    def __str__(self):
12771
        return 'ModifySubscriptionParameters(' + 'SubscriptionId:' + str(self.SubscriptionId) + ', ' + \
12772
               'RequestedPublishingInterval:' + str(self.RequestedPublishingInterval) + ', ' + \
12773
               'RequestedLifetimeCount:' + str(self.RequestedLifetimeCount) + ', ' + \
12774
               'RequestedMaxKeepAliveCount:' + str(self.RequestedMaxKeepAliveCount) + ', ' + \
12775
               'MaxNotificationsPerPublish:' + str(self.MaxNotificationsPerPublish) + ', ' + \
12776
               'Priority:' + str(self.Priority) + ')'
12777
12778
    __repr__ = __str__
12779
12780
12781
class ModifySubscriptionRequest(FrozenClass):
@@ 12482-12550 (lines=69) @@
12479
    __repr__ = __str__
12480
12481
12482
class CreateSubscriptionParameters(FrozenClass):
12483
    '''
12484
    :ivar RequestedPublishingInterval:
12485
    :vartype RequestedPublishingInterval: Double
12486
    :ivar RequestedLifetimeCount:
12487
    :vartype RequestedLifetimeCount: UInt32
12488
    :ivar RequestedMaxKeepAliveCount:
12489
    :vartype RequestedMaxKeepAliveCount: UInt32
12490
    :ivar MaxNotificationsPerPublish:
12491
    :vartype MaxNotificationsPerPublish: UInt32
12492
    :ivar PublishingEnabled:
12493
    :vartype PublishingEnabled: Boolean
12494
    :ivar Priority:
12495
    :vartype Priority: Byte
12496
    '''
12497
12498
    ua_types = {
12499
        'RequestedPublishingInterval': 'Double',
12500
        'RequestedLifetimeCount': 'UInt32',
12501
        'RequestedMaxKeepAliveCount': 'UInt32',
12502
        'MaxNotificationsPerPublish': 'UInt32',
12503
        'PublishingEnabled': 'Boolean',
12504
        'Priority': 'Byte',
12505
               }
12506
12507
    def __init__(self, binary=None):
12508
        if binary is not None:
12509
            self._binary_init(binary)
12510
            self._freeze = True
12511
            return
12512
        self.RequestedPublishingInterval = 0
12513
        self.RequestedLifetimeCount = 0
12514
        self.RequestedMaxKeepAliveCount = 0
12515
        self.MaxNotificationsPerPublish = 0
12516
        self.PublishingEnabled = True
12517
        self.Priority = 0
12518
        self._freeze = True
12519
12520
    def to_binary(self):
12521
        packet = []
12522
        packet.append(uabin.Primitives.Double.pack(self.RequestedPublishingInterval))
12523
        packet.append(uabin.Primitives.UInt32.pack(self.RequestedLifetimeCount))
12524
        packet.append(uabin.Primitives.UInt32.pack(self.RequestedMaxKeepAliveCount))
12525
        packet.append(uabin.Primitives.UInt32.pack(self.MaxNotificationsPerPublish))
12526
        packet.append(uabin.Primitives.Boolean.pack(self.PublishingEnabled))
12527
        packet.append(uabin.Primitives.Byte.pack(self.Priority))
12528
        return b''.join(packet)
12529
12530
    @staticmethod
12531
    def from_binary(data):
12532
        return CreateSubscriptionParameters(data)
12533
12534
    def _binary_init(self, data):
12535
        self.RequestedPublishingInterval = uabin.Primitives.Double.unpack(data)
12536
        self.RequestedLifetimeCount = uabin.Primitives.UInt32.unpack(data)
12537
        self.RequestedMaxKeepAliveCount = uabin.Primitives.UInt32.unpack(data)
12538
        self.MaxNotificationsPerPublish = uabin.Primitives.UInt32.unpack(data)
12539
        self.PublishingEnabled = uabin.Primitives.Boolean.unpack(data)
12540
        self.Priority = uabin.Primitives.Byte.unpack(data)
12541
12542
    def __str__(self):
12543
        return 'CreateSubscriptionParameters(' + 'RequestedPublishingInterval:' + str(self.RequestedPublishingInterval) + ', ' + \
12544
               'RequestedLifetimeCount:' + str(self.RequestedLifetimeCount) + ', ' + \
12545
               'RequestedMaxKeepAliveCount:' + str(self.RequestedMaxKeepAliveCount) + ', ' + \
12546
               'MaxNotificationsPerPublish:' + str(self.MaxNotificationsPerPublish) + ', ' + \
12547
               'PublishingEnabled:' + str(self.PublishingEnabled) + ', ' + \
12548
               'Priority:' + str(self.Priority) + ')'
12549
12550
    __repr__ = __str__
12551
12552
12553
class CreateSubscriptionRequest(FrozenClass):