X-Git-Url: https://wannabe.guru.org/gitweb/?a=blobdiff_plain;f=dict_utils.py;h=74e8fdab22749917f21ae88c150b838120bb0820;hb=b10d30a46e601c9ee1f843241f2d69a1f90f7a94;hp=0a2df252b6e97dbe7baa2c636aab6da4f6da3652;hpb=11eeb8574b7b4620ac6fd440cb251f8aa2458f5b;p=python_utils.git diff --git a/dict_utils.py b/dict_utils.py index 0a2df25..74e8fda 100644 --- a/dict_utils.py +++ b/dict_utils.py @@ -3,6 +3,7 @@ from itertools import islice from typing import Any, Callable, Dict, Iterator, Tuple + def init_or_inc( d: Dict[Any, Any], key: Any, @@ -39,9 +40,9 @@ def raise_on_duplicated_keys(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: