Code Duplication    Length = 11-14 lines in 3 locations

opcua/ua/uaprotocol_auto.py 3 locations

@@ 15154-15167 (lines=14) @@
15151
    :vartype TransportProtocol: String
15152
    :ivar SecurityMode:
15153
    :vartype SecurityMode: MessageSecurityMode
15154
    :ivar SecurityPolicyUri:
15155
    :vartype SecurityPolicyUri: String
15156
    :ivar ClientCertificate:
15157
    :vartype ClientCertificate: ByteString
15158
    '''
15159
15160
    ua_types = {
15161
        'SessionId': 'NodeId',
15162
        'ClientUserIdOfSession': 'String',
15163
        'ClientUserIdHistory': 'String',
15164
        'AuthenticationMechanism': 'String',
15165
        'Encoding': 'String',
15166
        'TransportProtocol': 'String',
15167
        'SecurityMode': 'MessageSecurityMode',
15168
        'SecurityPolicyUri': 'String',
15169
        'ClientCertificate': 'ByteString',
15170
               }
@@ 1975-1987 (lines=13) @@
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):
1989
        return EndpointDescription(data)
1990
@@ 3133-3143 (lines=11) @@
3130
3131
    def to_binary(self):
3132
        packet = []
3133
        packet.append(self.ClientDescription.to_binary())
3134
        packet.append(uabin.Primitives.String.pack(self.ServerUri))
3135
        packet.append(uabin.Primitives.String.pack(self.EndpointUrl))
3136
        packet.append(uabin.Primitives.String.pack(self.SessionName))
3137
        packet.append(uabin.Primitives.ByteString.pack(self.ClientNonce))
3138
        packet.append(uabin.Primitives.ByteString.pack(self.ClientCertificate))
3139
        packet.append(uabin.Primitives.Double.pack(self.RequestedSessionTimeout))
3140
        packet.append(uabin.Primitives.UInt32.pack(self.MaxResponseMessageSize))
3141
        return b''.join(packet)
3142
3143
    @staticmethod
3144
    def from_binary(data):
3145
        return CreateSessionParameters(data)
3146