Code Duplication    Length = 65-65 lines in 2 locations

opcua/ua/uaprotocol_auto.py 2 locations

@@ 12127-12191 (lines=65) @@
12124
    __repr__ = __str__
12125
12126
12127
class ModifySubscriptionParameters(FrozenClass):
12128
    '''
12129
    :ivar SubscriptionId:
12130
    :vartype SubscriptionId: UInt32
12131
    :ivar RequestedPublishingInterval:
12132
    :vartype RequestedPublishingInterval: Double
12133
    :ivar RequestedLifetimeCount:
12134
    :vartype RequestedLifetimeCount: UInt32
12135
    :ivar RequestedMaxKeepAliveCount:
12136
    :vartype RequestedMaxKeepAliveCount: UInt32
12137
    :ivar MaxNotificationsPerPublish:
12138
    :vartype MaxNotificationsPerPublish: UInt32
12139
    :ivar Priority:
12140
    :vartype Priority: Byte
12141
    '''
12142
12143
    ua_types = [
12144
12145
        ('SubscriptionId', 'UInt32'),
12146
        ('RequestedPublishingInterval', 'Double'),
12147
        ('RequestedLifetimeCount', 'UInt32'),
12148
        ('RequestedMaxKeepAliveCount', 'UInt32'),
12149
        ('MaxNotificationsPerPublish', 'UInt32'),
12150
        ('Priority', 'Byte'),
12151
               ]
12152
12153
    def __init__(self):
12154
        self.SubscriptionId = 0
12155
        self.RequestedPublishingInterval = 0
12156
        self.RequestedLifetimeCount = 0
12157
        self.RequestedMaxKeepAliveCount = 0
12158
        self.MaxNotificationsPerPublish = 0
12159
        self.Priority = 0
12160
        self._freeze = True
12161
12162
    def to_binary(self):
12163
        packet = []
12164
        packet.append(uabin.Primitives.UInt32.pack(self.SubscriptionId))
12165
        packet.append(uabin.Primitives.Double.pack(self.RequestedPublishingInterval))
12166
        packet.append(uabin.Primitives.UInt32.pack(self.RequestedLifetimeCount))
12167
        packet.append(uabin.Primitives.UInt32.pack(self.RequestedMaxKeepAliveCount))
12168
        packet.append(uabin.Primitives.UInt32.pack(self.MaxNotificationsPerPublish))
12169
        packet.append(uabin.Primitives.Byte.pack(self.Priority))
12170
        return b''.join(packet)
12171
12172
    @staticmethod
12173
    def from_binary(data):
12174
        obj = ModifySubscriptionParameters()
12175
        self.SubscriptionId = uabin.Primitives.UInt32.unpack(data)
12176
        self.RequestedPublishingInterval = uabin.Primitives.Double.unpack(data)
12177
        self.RequestedLifetimeCount = uabin.Primitives.UInt32.unpack(data)
12178
        self.RequestedMaxKeepAliveCount = uabin.Primitives.UInt32.unpack(data)
12179
        self.MaxNotificationsPerPublish = uabin.Primitives.UInt32.unpack(data)
12180
        self.Priority = uabin.Primitives.Byte.unpack(data)
12181
        return obj
12182
12183
    def __str__(self):
12184
        return 'ModifySubscriptionParameters(' + 'SubscriptionId:' + str(self.SubscriptionId) + ', ' + \
12185
               'RequestedPublishingInterval:' + str(self.RequestedPublishingInterval) + ', ' + \
12186
               'RequestedLifetimeCount:' + str(self.RequestedLifetimeCount) + ', ' + \
12187
               'RequestedMaxKeepAliveCount:' + str(self.RequestedMaxKeepAliveCount) + ', ' + \
12188
               'MaxNotificationsPerPublish:' + str(self.MaxNotificationsPerPublish) + ', ' + \
12189
               'Priority:' + str(self.Priority) + ')'
12190
12191
    __repr__ = __str__
12192
12193
12194
class ModifySubscriptionRequest(FrozenClass):
@@ 11915-11979 (lines=65) @@
11912
    __repr__ = __str__
11913
11914
11915
class CreateSubscriptionParameters(FrozenClass):
11916
    '''
11917
    :ivar RequestedPublishingInterval:
11918
    :vartype RequestedPublishingInterval: Double
11919
    :ivar RequestedLifetimeCount:
11920
    :vartype RequestedLifetimeCount: UInt32
11921
    :ivar RequestedMaxKeepAliveCount:
11922
    :vartype RequestedMaxKeepAliveCount: UInt32
11923
    :ivar MaxNotificationsPerPublish:
11924
    :vartype MaxNotificationsPerPublish: UInt32
11925
    :ivar PublishingEnabled:
11926
    :vartype PublishingEnabled: Boolean
11927
    :ivar Priority:
11928
    :vartype Priority: Byte
11929
    '''
11930
11931
    ua_types = [
11932
11933
        ('RequestedPublishingInterval', 'Double'),
11934
        ('RequestedLifetimeCount', 'UInt32'),
11935
        ('RequestedMaxKeepAliveCount', 'UInt32'),
11936
        ('MaxNotificationsPerPublish', 'UInt32'),
11937
        ('PublishingEnabled', 'Boolean'),
11938
        ('Priority', 'Byte'),
11939
               ]
11940
11941
    def __init__(self):
11942
        self.RequestedPublishingInterval = 0
11943
        self.RequestedLifetimeCount = 0
11944
        self.RequestedMaxKeepAliveCount = 0
11945
        self.MaxNotificationsPerPublish = 0
11946
        self.PublishingEnabled = True
11947
        self.Priority = 0
11948
        self._freeze = True
11949
11950
    def to_binary(self):
11951
        packet = []
11952
        packet.append(uabin.Primitives.Double.pack(self.RequestedPublishingInterval))
11953
        packet.append(uabin.Primitives.UInt32.pack(self.RequestedLifetimeCount))
11954
        packet.append(uabin.Primitives.UInt32.pack(self.RequestedMaxKeepAliveCount))
11955
        packet.append(uabin.Primitives.UInt32.pack(self.MaxNotificationsPerPublish))
11956
        packet.append(uabin.Primitives.Boolean.pack(self.PublishingEnabled))
11957
        packet.append(uabin.Primitives.Byte.pack(self.Priority))
11958
        return b''.join(packet)
11959
11960
    @staticmethod
11961
    def from_binary(data):
11962
        obj = CreateSubscriptionParameters()
11963
        self.RequestedPublishingInterval = uabin.Primitives.Double.unpack(data)
11964
        self.RequestedLifetimeCount = uabin.Primitives.UInt32.unpack(data)
11965
        self.RequestedMaxKeepAliveCount = uabin.Primitives.UInt32.unpack(data)
11966
        self.MaxNotificationsPerPublish = uabin.Primitives.UInt32.unpack(data)
11967
        self.PublishingEnabled = uabin.Primitives.Boolean.unpack(data)
11968
        self.Priority = uabin.Primitives.Byte.unpack(data)
11969
        return obj
11970
11971
    def __str__(self):
11972
        return 'CreateSubscriptionParameters(' + 'RequestedPublishingInterval:' + str(self.RequestedPublishingInterval) + ', ' + \
11973
               'RequestedLifetimeCount:' + str(self.RequestedLifetimeCount) + ', ' + \
11974
               'RequestedMaxKeepAliveCount:' + str(self.RequestedMaxKeepAliveCount) + ', ' + \
11975
               'MaxNotificationsPerPublish:' + str(self.MaxNotificationsPerPublish) + ', ' + \
11976
               'PublishingEnabled:' + str(self.PublishingEnabled) + ', ' + \
11977
               'Priority:' + str(self.Priority) + ')'
11978
11979
    __repr__ = __str__
11980
11981
11982
class CreateSubscriptionRequest(FrozenClass):