refactoring

This commit is contained in:
Devaev Maxim
2020-11-22 05:48:55 +03:00
parent 6a8ee1a114
commit 48550d2e78
3 changed files with 34 additions and 17 deletions

View File

@@ -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()):