Code Duplication    Length = 59-59 lines in 2 locations

opcua/ua/uaprotocol_auto.py 2 locations

@@ 11166-11224 (lines=59) @@
11163
11164
    __repr__ = __str__
11165
11166
11167
class ModifySubscriptionParameters(FrozenClass):
11168
    '''
11169
    :ivar SubscriptionId:
11170
    :vartype SubscriptionId: UInt32
11171
    :ivar RequestedPublishingInterval:
11172
    :vartype RequestedPublishingInterval: Double
11173
    :ivar RequestedLifetimeCount:
11174
    :vartype RequestedLifetimeCount: UInt32
11175
    :ivar RequestedMaxKeepAliveCount:
11176
    :vartype RequestedMaxKeepAliveCount: UInt32
11177
    :ivar MaxNotificationsPerPublish:
11178
    :vartype MaxNotificationsPerPublish: UInt32
11179
    :ivar Priority:
11180
    :vartype Priority: Byte
11181
    '''
11182
    def __init__(self, binary=None):
11183
        if binary is not None:
11184
            self._binary_init(binary)
11185
            self._freeze = True
11186
            return
11187
        self.SubscriptionId = 0
11188
        self.RequestedPublishingInterval = 0
11189
        self.RequestedLifetimeCount = 0
11190
        self.RequestedMaxKeepAliveCount = 0
11191
        self.MaxNotificationsPerPublish = 0
11192
        self.Priority = 0
11193
        self._freeze = True
11194
11195
    def to_binary(self):
11196
        packet = []
11197
        packet.append(uatype_UInt32.pack(self.SubscriptionId))
11198
        packet.append(uatype_Double.pack(self.RequestedPublishingInterval))
11199
        packet.append(uatype_UInt32.pack(self.RequestedLifetimeCount))
11200
        packet.append(uatype_UInt32.pack(self.RequestedMaxKeepAliveCount))
11201
        packet.append(uatype_UInt32.pack(self.MaxNotificationsPerPublish))
11202
        packet.append(uatype_Byte.pack(self.Priority))
11203
        return b''.join(packet)
11204
11205
    @staticmethod
11206
    def from_binary(data):
11207
        return ModifySubscriptionParameters(data)
11208
11209
    def _binary_init(self, data):
11210
        self.SubscriptionId = uatype_UInt32.unpack(data.read(4))[0]
11211
        self.RequestedPublishingInterval = uatype_Double.unpack(data.read(8))[0]
11212
        self.RequestedLifetimeCount = uatype_UInt32.unpack(data.read(4))[0]
11213
        self.RequestedMaxKeepAliveCount = uatype_UInt32.unpack(data.read(4))[0]
11214
        self.MaxNotificationsPerPublish = uatype_UInt32.unpack(data.read(4))[0]
11215
        self.Priority = uatype_Byte.unpack(data.read(1))[0]
11216
11217
    def __str__(self):
11218
        return 'ModifySubscriptionParameters(' + 'SubscriptionId:' + str(self.SubscriptionId) + ', ' + \
11219
               'RequestedPublishingInterval:' + str(self.RequestedPublishingInterval) + ', ' + \
11220
               'RequestedLifetimeCount:' + str(self.RequestedLifetimeCount) + ', ' + \
11221
               'RequestedMaxKeepAliveCount:' + str(self.RequestedMaxKeepAliveCount) + ', ' + \
11222
               'MaxNotificationsPerPublish:' + str(self.MaxNotificationsPerPublish) + ', ' + \
11223
               'Priority:' + str(self.Priority) + ')'
11224
11225
    __repr__ = __str__
11226
11227
@@ 10970-11028 (lines=59) @@
10967
10968
    __repr__ = __str__
10969
10970
10971
class CreateSubscriptionParameters(FrozenClass):
10972
    '''
10973
    :ivar RequestedPublishingInterval:
10974
    :vartype RequestedPublishingInterval: Double
10975
    :ivar RequestedLifetimeCount:
10976
    :vartype RequestedLifetimeCount: UInt32
10977
    :ivar RequestedMaxKeepAliveCount:
10978
    :vartype RequestedMaxKeepAliveCount: UInt32
10979
    :ivar MaxNotificationsPerPublish:
10980
    :vartype MaxNotificationsPerPublish: UInt32
10981
    :ivar PublishingEnabled:
10982
    :vartype PublishingEnabled: Boolean
10983
    :ivar Priority:
10984
    :vartype Priority: Byte
10985
    '''
10986
    def __init__(self, binary=None):
10987
        if binary is not None:
10988
            self._binary_init(binary)
10989
            self._freeze = True
10990
            return
10991
        self.RequestedPublishingInterval = 0
10992
        self.RequestedLifetimeCount = 0
10993
        self.RequestedMaxKeepAliveCount = 0
10994
        self.MaxNotificationsPerPublish = 0
10995
        self.PublishingEnabled = True
10996
        self.Priority = 0
10997
        self._freeze = True
10998
10999
    def to_binary(self):
11000
        packet = []
11001
        packet.append(uatype_Double.pack(self.RequestedPublishingInterval))
11002
        packet.append(uatype_UInt32.pack(self.RequestedLifetimeCount))
11003
        packet.append(uatype_UInt32.pack(self.RequestedMaxKeepAliveCount))
11004
        packet.append(uatype_UInt32.pack(self.MaxNotificationsPerPublish))
11005
        packet.append(uatype_Boolean.pack(self.PublishingEnabled))
11006
        packet.append(uatype_Byte.pack(self.Priority))
11007
        return b''.join(packet)
11008
11009
    @staticmethod
11010
    def from_binary(data):
11011
        return CreateSubscriptionParameters(data)
11012
11013
    def _binary_init(self, data):
11014
        self.RequestedPublishingInterval = uatype_Double.unpack(data.read(8))[0]
11015
        self.RequestedLifetimeCount = uatype_UInt32.unpack(data.read(4))[0]
11016
        self.RequestedMaxKeepAliveCount = uatype_UInt32.unpack(data.read(4))[0]
11017
        self.MaxNotificationsPerPublish = uatype_UInt32.unpack(data.read(4))[0]
11018
        self.PublishingEnabled = uatype_Boolean.unpack(data.read(1))[0]
11019
        self.Priority = uatype_Byte.unpack(data.read(1))[0]
11020
11021
    def __str__(self):
11022
        return 'CreateSubscriptionParameters(' + 'RequestedPublishingInterval:' + str(self.RequestedPublishingInterval) + ', ' + \
11023
               'RequestedLifetimeCount:' + str(self.RequestedLifetimeCount) + ', ' + \
11024
               'RequestedMaxKeepAliveCount:' + str(self.RequestedMaxKeepAliveCount) + ', ' + \
11025
               'MaxNotificationsPerPublish:' + str(self.MaxNotificationsPerPublish) + ', ' + \
11026
               'PublishingEnabled:' + str(self.PublishingEnabled) + ', ' + \
11027
               'Priority:' + str(self.Priority) + ')'
11028
11029
    __repr__ = __str__
11030
11031