Exemple #1
0
def set_name_texts(ibs, name_rowid_list, name_text_list, verbose=False):
    r"""
    Changes the name text. Does not affect the animals of this name.
    Effectively just changes the TEXT UUID

    CommandLine:
        python -m ibeis.control.manual_name_funcs --test-set_name_texts

    RESTful:
        Method: PUT
        URL:    /api/name/texts/

    Example:
        >>> # DISABLE_DOCTEST
        >>> from ibeis.control.manual_name_funcs import *  # NOQA
        >>> import ibeis
        >>> ibs = ibeis.opendb('testdb1')
        >>> nid_list = ibs.get_valid_nids()[0:2]
        >>> name_list = ibs.get_name_texts(nid_list)
        >>> # result = set_name_texts(ibs, nid_list, name_list)
        >>> print(result)
    """
    if verbose:
        print('[ibs] setting %d name texts' % (len(name_rowid_list),))
    ibsfuncs.assert_valid_names(name_text_list)
    #sanitize_name_texts(ibs, name_text_list):
    #ibsfuncs.assert_lblannot_rowids_are_type(ibs, nid_list, ibs.lbltype_ids[const.INDIVIDUAL_KEY])
    #ibs.set_lblannot_values(nid_list, name_list)
    val_list = ((value,) for value in name_text_list)
    ibs.db.set(const.NAME_TABLE, (NAME_TEXT,), val_list, name_rowid_list)
Exemple #2
0
def sanitize_name_texts(ibs, name_text_list):
    r"""

    RESTful:
        Method: PUT
        URL:    /api/name/sanitize
    """
    ibsfuncs.assert_valid_names(name_text_list)
    name_text_list_ = [None
                       if name_text == const.UNKNOWN
                       else name_text
                       for name_text in name_text_list]
    return name_text_list_