Code Duplication    Length = 13-14 lines in 2 locations

opcua/ua/uaprotocol_auto.py 2 locations

@@ 14407-14420 (lines=14) @@
14404
        self.ClientCertificate = None
14405
        self._freeze = True
14406
14407
    def to_binary(self):
14408
        packet = []
14409
        packet.append(self.SessionId.to_binary())
14410
        packet.append(uabin.Primitives.String.pack(self.ClientUserIdOfSession))
14411
        packet.append(uabin.Primitives.Int32.pack(len(self.ClientUserIdHistory)))
14412
        for fieldname in self.ClientUserIdHistory:
14413
            packet.append(uabin.Primitives.String.pack(fieldname))
14414
        packet.append(uabin.Primitives.String.pack(self.AuthenticationMechanism))
14415
        packet.append(uabin.Primitives.String.pack(self.Encoding))
14416
        packet.append(uabin.Primitives.String.pack(self.TransportProtocol))
14417
        packet.append(uabin.Primitives.UInt32.pack(self.SecurityMode.value))
14418
        packet.append(uabin.Primitives.String.pack(self.SecurityPolicyUri))
14419
        packet.append(uabin.Primitives.ByteString.pack(self.ClientCertificate))
14420
        return b''.join(packet)
14421
14422
    @staticmethod
14423
    def from_binary(data):
@@ 2117-2129 (lines=13) @@
2114
        self.SecurityLevel = 0
2115
        self._freeze = True
2116
2117
    def to_binary(self):
2118
        packet = []
2119
        packet.append(uabin.Primitives.String.pack(self.EndpointUrl))
2120
        packet.append(self.Server.to_binary())
2121
        packet.append(uabin.Primitives.ByteString.pack(self.ServerCertificate))
2122
        packet.append(uabin.Primitives.UInt32.pack(self.SecurityMode.value))
2123
        packet.append(uabin.Primitives.String.pack(self.SecurityPolicyUri))
2124
        packet.append(uabin.Primitives.Int32.pack(len(self.UserIdentityTokens)))
2125
        for fieldname in self.UserIdentityTokens:
2126
            packet.append(fieldname.to_binary())
2127
        packet.append(uabin.Primitives.String.pack(self.TransportProfileUri))
2128
        packet.append(uabin.Primitives.Byte.pack(self.SecurityLevel))
2129
        return b''.join(packet)
2130
2131
    @staticmethod
2132
    def from_binary(data):