Code Duplication    Length = 59-59 lines in 2 locations

opcua/ua/uaprotocol_auto.py 2 locations

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