summaryrefslogtreecommitdiff
path: root/kvmd/tools.py
diff options
context:
space:
mode:
Diffstat (limited to 'kvmd/tools.py')
-rw-r--r--kvmd/tools.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/kvmd/tools.py b/kvmd/tools.py
index 555ddc3e..40db9b9c 100644
--- a/kvmd/tools.py
+++ b/kvmd/tools.py
@@ -57,6 +57,10 @@ def sorted_kvs(dct: Dict[_DictKeyT, _DictValueT]) -> List[Tuple[_DictKeyT, _Dict
return sorted(dct.items(), key=operator.itemgetter(0))
+def swapped_kvs(dct: Dict[_DictKeyT, _DictValueT]) -> Dict[_DictValueT, _DictKeyT]:
+ return {value: key for (key, value) in dct.items()}
+
+
# =====
def clear_queue(q: multiprocessing.queues.Queue) -> None: # pylint: disable=invalid-name
for _ in range(q.qsize()):