Returns all disjoint mappings in key-value pairs.
(self)
| 9372 | root_values.update(self._root_id_to_values.pop(subtree_root)) |
| 9373 | |
| 9374 | def items(self) -> list[tuple[set[TKey], set[TValue]]]: |
| 9375 | """Returns all disjoint mappings in key-value pairs.""" |
| 9376 | root_id_to_keys: dict[int, set[TKey]] = {} |
| 9377 | for key in self._key_to_id: |
| 9378 | root_id = self._lookup_root_id(key) |
| 9379 | if root_id not in root_id_to_keys: |
| 9380 | root_id_to_keys[root_id] = set() |
| 9381 | root_id_to_keys[root_id].add(key) |
| 9382 | |
| 9383 | output = [] |
| 9384 | for root_id, keys in root_id_to_keys.items(): |
| 9385 | output.append((keys, self._root_id_to_values[root_id])) |
| 9386 | |
| 9387 | return output |
| 9388 | |
| 9389 | def _lookup_or_make_root_id(self, key: TKey) -> int: |
| 9390 | if key in self._key_to_id: |
no test coverage detected