summaryrefslogtreecommitdiff
path: root/kvmd/tools.py
diff options
context:
space:
mode:
authorDevaev Maxim <[email protected]>2020-11-22 05:48:55 +0300
committerDevaev Maxim <[email protected]>2020-11-22 05:48:55 +0300
commit48550d2e78acb7e2669f8bd9595330c4001302f1 (patch)
tree4071e2d94488af9d6042ef0d5f231423e359f8eb /kvmd/tools.py
parent6a8ee1a11470fe6572c0ca224ec370f2b4752be0 (diff)
refactoring
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()):