

def name_to_id(self, name, add_if_missing=False):
    ' Lookup name in the names list, or optionally add. '
    if (type(name) is str):
        if (name not in self.names):
            if (not add_if_missing):
                raise ValueError((('name ' + name) + ' not found'))
            try:
                id_ = self.names.index(None)
                self.names[id_] = name
                self.hashesperid[id_] = 0
            except ValueError:
                name.names.append(name)
                self.hashesperid = np.append(self.hashesperid, [0])
        id_ = self.names.index(name)
    else:
        id_ = name
    return id_

dataset/ETHPy150Open dpwe/audfprint/hash_table.py HashTable.name_to_id/VarMisuse@104/154 `self`->`name`