Code Duplication    Length = 17-21 lines in 2 locations

opcua/ua/uaprotocol_auto.py 2 locations

@@ 7456-7476 (lines=21) @@
7453
    @staticmethod
7454
    def from_binary(data):
7455
        return QueryFirstResult(data)
7456
7457
    def _binary_init(self, data):
7458
        length = uatype_Int32.unpack(data.read(4))[0]
7459
        array = []
7460
        if length != -1:
7461
            for _ in range(0, length):
7462
                array.append(QueryDataSet.from_binary(data))
7463
        self.QueryDataSets = array
7464
        self.ContinuationPoint = unpack_bytes(data)
7465
        length = uatype_Int32.unpack(data.read(4))[0]
7466
        array = []
7467
        if length != -1:
7468
            for _ in range(0, length):
7469
                array.append(ParsingResult.from_binary(data))
7470
        self.ParsingResults = array
7471
        length = uatype_Int32.unpack(data.read(4))[0]
7472
        array = []
7473
        if length != -1:
7474
            for _ in range(0, length):
7475
                array.append(DiagnosticInfo.from_binary(data))
7476
        self.DiagnosticInfos = array
7477
        self.FilterResult = ContentFilterResult.from_binary(data)
7478
7479
    def __str__(self):
@@ 12020-12036 (lines=17) @@
12017
    @staticmethod
12018
    def from_binary(data):
12019
        return PublishResult(data)
12020
12021
    def _binary_init(self, data):
12022
        self.SubscriptionId = uatype_UInt32.unpack(data.read(4))[0]
12023
        self.AvailableSequenceNumbers = unpack_uatype_array('UInt32', data)
12024
        self.MoreNotifications = uatype_Boolean.unpack(data.read(1))[0]
12025
        self.NotificationMessage = NotificationMessage.from_binary(data)
12026
        length = uatype_Int32.unpack(data.read(4))[0]
12027
        array = []
12028
        if length != -1:
12029
            for _ in range(0, length):
12030
                array.append(StatusCode.from_binary(data))
12031
        self.Results = array
12032
        length = uatype_Int32.unpack(data.read(4))[0]
12033
        array = []
12034
        if length != -1:
12035
            for _ in range(0, length):
12036
                array.append(DiagnosticInfo.from_binary(data))
12037
        self.DiagnosticInfos = array
12038
12039
    def __str__(self):