from itertools import islice
from typing import Any, Callable, Dict, Iterator, Tuple
-import list_utils
-
-
def init_or_inc(
d: Dict[Any, Any],
key: Any,
def coalesce_by_creating_list(key, v1, v2):
- return list_utils.flatten([v1, v2])
+ from list_utils import flatten
+ return flatten([v1, v2])
def coalesce_by_creating_set(key, v1, v2):
def coalesce(
inputs: Iterator[Dict[Any, Any]],
*,
- aggregation_function: Callable[[Any, Any, Any], Any] = coalesce_by_creating_list
+ aggregation_function: Callable[[Any, Any], Any] = coalesce_by_creating_list
) -> Dict[Any, Any]:
- out = {}
+ out: Dict[Any, Any] = {}
for d in inputs:
for key in d:
if key in out: