mirror of
https://gitlab.nic.cz/labs/bird.git
synced 2025-03-17 20:07:04 +00:00
19 lines
368 B
Python
19 lines
368 B
Python
import asyncio
|
|
|
|
async def dict_gather(d: dict):
|
|
return dict(zip(d.keys(), await asyncio.gather(*d.values())))
|
|
|
|
def dict_expand(d: dict):
|
|
out = {}
|
|
for k,v in d.items():
|
|
p,*r = k
|
|
if p not in out:
|
|
out[p] = {}
|
|
try:
|
|
r ,= r
|
|
except ValueError:
|
|
r = tuple(r)
|
|
out[p][r] = v
|
|
|
|
return out
|