Code Duplication    Length = 13-14 lines in 2 locations

opcua/ua/uaprotocol_auto.py 2 locations

@@ 15154-15167 (lines=14) @@
15151
        self.ClientCertificate = None
15152
        self._freeze = True
15153
15154
    def to_binary(self):
15155
        packet = []
15156
        packet.append(self.SessionId.to_binary())
15157
        packet.append(uabin.Primitives.String.pack(self.ClientUserIdOfSession))
15158
        packet.append(uabin.Primitives.Int32.pack(len(self.ClientUserIdHistory)))
15159
        for fieldname in self.ClientUserIdHistory:
15160
            packet.append(uabin.Primitives.String.pack(fieldname))
15161
        packet.append(uabin.Primitives.String.pack(self.AuthenticationMechanism))
15162
        packet.append(uabin.Primitives.String.pack(self.Encoding))
15163
        packet.append(uabin.Primitives.String.pack(self.TransportProtocol))
15164
        packet.append(uabin.Primitives.UInt32.pack(self.SecurityMode.value))
15165
        packet.append(uabin.Primitives.String.pack(self.SecurityPolicyUri))
15166
        packet.append(uabin.Primitives.ByteString.pack(self.ClientCertificate))
15167
        return b''.join(packet)
15168
15169
    @staticmethod
15170
    def from_binary(data):
@@ 1975-1987 (lines=13) @@
1972
        self.SecurityLevel = 0
1973
        self._freeze = True
1974
1975
    def to_binary(self):
1976
        packet = []
1977
        packet.append(uabin.Primitives.String.pack(self.EndpointUrl))
1978
        packet.append(self.Server.to_binary())
1979
        packet.append(uabin.Primitives.ByteString.pack(self.ServerCertificate))
1980
        packet.append(uabin.Primitives.UInt32.pack(self.SecurityMode.value))
1981
        packet.append(uabin.Primitives.String.pack(self.SecurityPolicyUri))
1982
        packet.append(uabin.Primitives.Int32.pack(len(self.UserIdentityTokens)))
1983
        for fieldname in self.UserIdentityTokens:
1984
            packet.append(fieldname.to_binary())
1985
        packet.append(uabin.Primitives.String.pack(self.TransportProfileUri))
1986
        packet.append(uabin.Primitives.Byte.pack(self.SecurityLevel))
1987
        return b''.join(packet)
1988
1989
    @staticmethod
1990
    def from_binary(data):