# Path: graphscale/utils.py
# async def async_list(coros: List[Awaitable[T]]) -> List[T]:
#     """Use to await a list and return a list.
#     Example: list_of_results = await async_list(list_of_gens)
#     """
#     return await asyncio.gather(*coros)


from abc import ABCMeta, abstractmethod
from collections import OrderedDict
from datetime import datetime
from enum import Enum, auto
from typing import Any, Dict, Iterable, List, NamedTuple, Sequence, Optional
from uuid import UUID, uuid4
from graphscale.utils import async_list
            await from_id_shard.gen_insert_edge(edge_definition, from_id, new_id, {})

        for index in self.iterate_applicable_indexes(type_id, data):
            indexed_value = data[index.indexed_attr]
            index_shard = self.get_shard_from_value(indexed_value)
            await index_shard.gen_insert_index_entry(index, indexed_value, new_id)

        return new_id

    async def gen_insert_objects(self, type_id: int, datas: List[KvetchData]) -> List[UUID]:
        if len(self._shards) > 1:
            raise Exception('shards > 1 currently not supported')

        shard = self._shards[0]

        new_ids = []
        for _ in range(0, len(datas)):
            new_ids.append(uuid4())

        await shard.gen_insert_objects(new_ids, type_id, datas)
        return new_ids

    async def gen_object(self, obj_id: UUID) -> KvetchData:
        shard = self.get_shard_from_obj_id(obj_id)
        return await shard.gen_object(obj_id)

    async def gen_objects(self, obj_ids: List[UUID]) -> Dict[UUID, KvetchData]:
        # construct dictionary of shard_id to all ids in that shard
        shard_to_ids = {}  # type: Dict[int, List[UUID]]
        for obj_id in obj_ids:

# Path: graphscale/utils.py
# async def async_list(coros: List[Awaitable[T]]) -> List[T]:
#     """Use to await a list and return a list.
#     Example: list_of_results = await async_list(list_of_gens)
#     """
#     return await asyncio.gather(*coros)


# Path: graphscale/kvetch/kvetch.py
from abc import ABCMeta, abstractmethod
from collections import OrderedDict
from datetime import datetime
from enum import Enum, auto
from typing import Any, Dict, Iterable, List, NamedTuple, Sequence, Optional
from uuid import UUID, uuid4
from graphscale.utils import async_list

            await from_id_shard.gen_insert_edge(edge_definition, from_id, new_id, {})

        for index in self.iterate_applicable_indexes(type_id, data):
            indexed_value = data[index.indexed_attr]
            index_shard = self.get_shard_from_value(indexed_value)
            await index_shard.gen_insert_index_entry(index, indexed_value, new_id)

        return new_id

    async def gen_insert_objects(self, type_id: int, datas: List[KvetchData]) -> List[UUID]:
        if len(self._shards) > 1:
            raise Exception('shards > 1 currently not supported')

        shard = self._shards[0]

        new_ids = []
        for _ in range(0, len(datas)):
            new_ids.append(uuid4())

        await shard.gen_insert_objects(new_ids, type_id, datas)
        return new_ids

    async def gen_object(self, obj_id: UUID) -> KvetchData:
        shard = self.get_shard_from_obj_id(obj_id)
        return await shard.gen_object(obj_id)

    async def gen_objects(self, obj_ids: List[UUID]) -> Dict[UUID, KvetchData]:
        # construct dictionary of shard_id to all ids in that shard
        shard_to_ids = {}  # type: Dict[int, List[UUID]]
        for obj_id in obj_ids:

            shard_id = self.get_shard_id_from_obj_id(obj_id)