diff --git a/src/aac_datasets/utils/collections.py b/src/aac_datasets/utils/collections.py index 4a0dcaf..b622893 100644 --- a/src/aac_datasets/utils/collections.py +++ b/src/aac_datasets/utils/collections.py @@ -2,10 +2,10 @@ # -*- coding: utf-8 -*- from typing import ( + Any, Dict, Iterable, List, - Literal, Mapping, Sequence, TypeVar, @@ -13,6 +13,8 @@ overload, ) +from typing_extensions import Literal + K = TypeVar("K") T = TypeVar("T") V = TypeVar("V") @@ -26,7 +28,7 @@ def list_dict_to_dict_list( lst: Sequence[Mapping[K, V]], key_mode: Literal["intersect", "same"], - default_val: W = None, + default_val: Any = None, ) -> Dict[K, List[V]]: ... @@ -90,6 +92,6 @@ def union_lists(lst_of_lst: Iterable[Iterable[T]]) -> List[T]: """Performs union of elements in lists (like set union), but keep their original order.""" out = {} for lst_i in lst_of_lst: - out |= dict.fromkeys(lst_i) + out.update(dict.fromkeys(lst_i)) out = list(out) return out