cand_lists = cand_lists if isinstance(cand_lists, (list, tuple)) else [cand_lists]
for cand_list in cand_lists:
if len(cand_list) == 0:
raise ValueError("cand_lists contain empty cand_list.")
candidate_class = cand_list[0].__tablename__
// Keys are used as a global index
if key:
keys_map = {key: 0}
key_size = len(keys_map)
else:
all_keys = get_sparse_matrix_keys(session, key_table)
key_size = len(all_keys)
keys_map = {}
for (i, k) in enumerate(all_keys):
if candidate_class in k.candidate_classes:
keys_map[k.name] = i
indptr = [0]
indices = []
data = []