Code Duplication    Length = 11-14 lines in 3 locations

opcua/ua/uaprotocol_auto.py 3 locations

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