kmip/core/attributes.py
def create(cls, name_value, name_type):
        '''
            Returns a Name object, populated with the given value and type
        '''
        if isinstance(name_value, Name.NameValue):
            value = name_value
        elif isinstance(name_value, str):
            value = cls.NameValue(name_value)
        else:
            name = 'Name'
            msg = exceptions.ErrorStrings.BAD_EXP_RECV
            member = 'name_value'
            raise TypeError(msg.format('{0}.{1}'.format(name, member),
                                       'name_value', type(Name.NameValue),
                                       type(name_value)))

        if isinstance(name_type, Name.NameType):
            n_type = name_type
        elif isinstance(name_type, Enum):
            n_type = cls.NameType(name_type)
        else:
            name = 'Name'
            msg = exceptions.ErrorStrings.BAD_EXP_RECV
            member = 'name_type'
            raise TypeError(msg.format('{0}.{1}'.format(name, member),
                                       'name_type', type(Name.NameType),
                                       type(name_type)))

        return Name(name_value=value,
                    name_type=n_type)
def create(cls, name_value, name_type):
        '''
            Returns a Name object, populated with the given value and type
        '''
        if isinstance(name_value, Name.NameValue):
            value = name_value
        elif isinstance(name_value, str):
            value = cls.NameValue(name_value)
        else:
            name = 'Name'
            msg = exceptions.ErrorStrings.BAD_EXP_RECV
            member = 'name_value'
            raise TypeError(msg.format('{0}.{1}'.format(name, member),
                                       'name_value', type(Name.NameValue),
                                       type(name_value)))

        if isinstance(name_type, Name.NameType):
            n_type = name_type
        elif isinstance(name_type, Enum):
            n_type = cls.NameType(name_type)
        else:
            name = 'Name'
            msg = exceptions.ErrorStrings.BAD_EXP_RECV
            member = 'name_type'
            raise TypeError(msg.format('{0}.{1}'.format(name, member),
                                       'name_type', type(Name.NameType),
                                       type(name_type)))

        return Name(name_value=value,
                    name_type=n_type)
def create ( cls , name_value , name_type ) : if isinstance ( name_value , Name . NameValue ) : value = name_value elif isinstance ( name_value , str ) : value = cls . NameValue ( name_value ) else : name = 'Name' msg = exceptions . ErrorStrings . BAD_EXP_RECV member = 'name_value' raise TypeError ( msg . format ( '{0}.{1}' . format ( name , member ) , 'name_value' , type ( Name . NameValue ) , type ( name_value ) ) ) if isinstance ( name_type , Name . NameType ) : n_type = name_type elif isinstance ( name_type , Enum ) : n_type = cls . NameType ( name_type ) else : name = 'Name' msg = exceptions . ErrorStrings . BAD_EXP_RECV member = 'name_type' raise TypeError ( msg . format ( '{0}.{1}' . format ( name , member ) , 'name_type' , type ( Name . NameType ) , type ( name_type ) ) ) return Name ( name_value = value , name_type = n_type )
Returns a Name object, populated with the given value and type
Returns a Name object populated with the given value and type