// flattening list benchmark here
// http://stackoverflow.com/a/952952
all_ids_in_pairs = {id_ for pair in id_pairs for id_ in pair}
if not all_ids_in_pairs.issubset(ids):
raise ValueError("`id_pairs` are not a subset of `ids`")
if isinstance(metric, str):
After Change
if not all_ids_in_pairs.issubset(ids):
raise ValueError("`id_pairs` are not a subset of `ids`")
hashes = {i for i in id_pairs}.union({i[::-1] for i in id_pairs})
if len(hashes) != len(id_pairs) * 2:
raise ValueError("Duplicate ID pairs observed.")