Code Duplication    Length = 65-65 lines in 2 locations

opcua/ua/uaprotocol_auto.py 2 locations

@@ 12127-12191 (lines=65) @@
12124
        return b''.join(packet)
12125
12126
    @staticmethod
12127
    def from_binary(data):
12128
        obj = SetPublishingModeResponse()
12129
        obj.TypeId = NodeId.from_binary(data)
12130
        obj.ResponseHeader = ResponseHeader.from_binary(data)
12131
        obj.Parameters = SetPublishingModeResult.from_binary(data)
12132
        return obj
12133
12134
    def __str__(self):
12135
        return 'SetPublishingModeResponse(' + 'TypeId:' + str(self.TypeId) + ', ' + \
12136
               'ResponseHeader:' + str(self.ResponseHeader) + ', ' + \
12137
               'Parameters:' + str(self.Parameters) + ')'
12138
12139
    __repr__ = __str__
12140
12141
12142
class NotificationMessage(FrozenClass):
12143
    '''
12144
    :ivar SequenceNumber:
12145
    :vartype SequenceNumber: UInt32
12146
    :ivar PublishTime:
12147
    :vartype PublishTime: DateTime
12148
    :ivar NotificationData:
12149
    :vartype NotificationData: ExtensionObject
12150
    '''
12151
12152
    ua_types = [
12153
        ('SequenceNumber', 'UInt32'),
12154
        ('PublishTime', 'DateTime'),
12155
        ('NotificationData', 'ListOfExtensionObject'),
12156
               ]
12157
12158
    def __init__(self):
12159
        self.SequenceNumber = 0
12160
        self.PublishTime = datetime.utcnow()
12161
        self.NotificationData = []
12162
        self._freeze = True
12163
12164
    def to_binary(self):
12165
        packet = []
12166
        packet.append(uabin.Primitives.UInt32.pack(self.SequenceNumber))
12167
        packet.append(uabin.Primitives.DateTime.pack(self.PublishTime))
12168
        packet.append(uabin.Primitives.Int32.pack(len(self.NotificationData)))
12169
        for fieldname in self.NotificationData:
12170
            packet.append(uabin.extensionobject_to_binary(fieldname))
12171
        return b''.join(packet)
12172
12173
    @staticmethod
12174
    def from_binary(data):
12175
        obj = NotificationMessage()
12176
        self.SequenceNumber = uabin.Primitives.UInt32.unpack(data)
12177
        self.PublishTime = uabin.Primitives.DateTime.unpack(data)
12178
        length = uabin.Primitives.Int32.unpack(data)
12179
        array = []
12180
        if length != -1:
12181
            for _ in range(0, length):
12182
                array.append(uabin.extensionobject_from_binary(data))
12183
        obj.NotificationData = array
12184
        return obj
12185
12186
    def __str__(self):
12187
        return 'NotificationMessage(' + 'SequenceNumber:' + str(self.SequenceNumber) + ', ' + \
12188
               'PublishTime:' + str(self.PublishTime) + ', ' + \
12189
               'NotificationData:' + str(self.NotificationData) + ')'
12190
12191
    __repr__ = __str__
12192
12193
12194
class NotificationData(FrozenClass):
@@ 11915-11979 (lines=65) @@
11912
    __repr__ = __str__
11913
11914
11915
class ModifySubscriptionResponse(FrozenClass):
11916
    '''
11917
    :ivar TypeId:
11918
    :vartype TypeId: NodeId
11919
    :ivar ResponseHeader:
11920
    :vartype ResponseHeader: ResponseHeader
11921
    :ivar Parameters:
11922
    :vartype Parameters: ModifySubscriptionResult
11923
    '''
11924
11925
    ua_types = [
11926
        ('TypeId', 'NodeId'),
11927
        ('ResponseHeader', 'ResponseHeader'),
11928
        ('Parameters', 'ModifySubscriptionResult'),
11929
               ]
11930
11931
    def __init__(self):
11932
        self.TypeId = FourByteNodeId(ObjectIds.ModifySubscriptionResponse_Encoding_DefaultBinary)
11933
        self.ResponseHeader = ResponseHeader()
11934
        self.Parameters = ModifySubscriptionResult()
11935
        self._freeze = True
11936
11937
    def to_binary(self):
11938
        packet = []
11939
        packet.append(self.TypeId.to_binary())
11940
        packet.append(self.ResponseHeader.to_binary())
11941
        packet.append(self.Parameters.to_binary())
11942
        return b''.join(packet)
11943
11944
    @staticmethod
11945
    def from_binary(data):
11946
        obj = ModifySubscriptionResponse()
11947
        obj.TypeId = NodeId.from_binary(data)
11948
        obj.ResponseHeader = ResponseHeader.from_binary(data)
11949
        obj.Parameters = ModifySubscriptionResult.from_binary(data)
11950
        return obj
11951
11952
    def __str__(self):
11953
        return 'ModifySubscriptionResponse(' + 'TypeId:' + str(self.TypeId) + ', ' + \
11954
               'ResponseHeader:' + str(self.ResponseHeader) + ', ' + \
11955
               'Parameters:' + str(self.Parameters) + ')'
11956
11957
    __repr__ = __str__
11958
11959
11960
class SetPublishingModeParameters(FrozenClass):
11961
    '''
11962
    :ivar PublishingEnabled:
11963
    :vartype PublishingEnabled: Boolean
11964
    :ivar SubscriptionIds:
11965
    :vartype SubscriptionIds: UInt32
11966
    '''
11967
11968
    ua_types = [
11969
        ('PublishingEnabled', 'Boolean'),
11970
        ('SubscriptionIds', 'ListOfUInt32'),
11971
               ]
11972
11973
    def __init__(self):
11974
        self.PublishingEnabled = True
11975
        self.SubscriptionIds = []
11976
        self._freeze = True
11977
11978
    def to_binary(self):
11979
        packet = []
11980
        packet.append(uabin.Primitives.Boolean.pack(self.PublishingEnabled))
11981
        packet.append(uabin.Primitives.Int32.pack(len(self.SubscriptionIds)))
11982
        for fieldname in self.SubscriptionIds: