Code Duplication    Length = 13-14 lines in 2 locations

opcua/ua/uaprotocol_auto.py 2 locations

@@ 15188-15201 (lines=14) @@
15185
        self.ClientCertificate = None
15186
        self._freeze = True
15187
15188
    def to_binary(self):
15189
        packet = []
15190
        packet.append(self.SessionId.to_binary())
15191
        packet.append(uabin.Primitives.String.pack(self.ClientUserIdOfSession))
15192
        packet.append(uabin.Primitives.Int32.pack(len(self.ClientUserIdHistory)))
15193
        for fieldname in self.ClientUserIdHistory:
15194
            packet.append(uabin.Primitives.String.pack(fieldname))
15195
        packet.append(uabin.Primitives.String.pack(self.AuthenticationMechanism))
15196
        packet.append(uabin.Primitives.String.pack(self.Encoding))
15197
        packet.append(uabin.Primitives.String.pack(self.TransportProtocol))
15198
        packet.append(uabin.Primitives.UInt32.pack(self.SecurityMode.value))
15199
        packet.append(uabin.Primitives.String.pack(self.SecurityPolicyUri))
15200
        packet.append(uabin.Primitives.ByteString.pack(self.ClientCertificate))
15201
        return b''.join(packet)
15202
15203
    @staticmethod
15204
    def from_binary(data):
@@ 1973-1985 (lines=13) @@
1970
        self.SecurityLevel = 0
1971
        self._freeze = True
1972
1973
    def to_binary(self):
1974
        packet = []
1975
        packet.append(uabin.Primitives.String.pack(self.EndpointUrl))
1976
        packet.append(self.Server.to_binary())
1977
        packet.append(uabin.Primitives.ByteString.pack(self.ServerCertificate))
1978
        packet.append(uabin.Primitives.UInt32.pack(self.SecurityMode.value))
1979
        packet.append(uabin.Primitives.String.pack(self.SecurityPolicyUri))
1980
        packet.append(uabin.Primitives.Int32.pack(len(self.UserIdentityTokens)))
1981
        for fieldname in self.UserIdentityTokens:
1982
            packet.append(fieldname.to_binary())
1983
        packet.append(uabin.Primitives.String.pack(self.TransportProfileUri))
1984
        packet.append(uabin.Primitives.Byte.pack(self.SecurityLevel))
1985
        return b''.join(packet)
1986
1987
    @staticmethod
1988
    def from_binary(data):