Skip to content

Commit

Permalink
Mod: Update collections funcs typing.
Browse files Browse the repository at this point in the history
  • Loading branch information
Labbeti committed Mar 4, 2024
1 parent 1fbbd28 commit b503f63
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/aac_datasets/utils/collections.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-

from typing import Any, Dict, Iterable, List, TypeVar

from typing import Any, Dict, Iterable, List, Mapping, Sequence, TypeVar

T = TypeVar("T")


def list_dict_to_dict_list(
lst: List[Dict[str, T]],
lst: Sequence[Mapping[str, T]],
key_mode: str = "intersect",
default: Any = None,
) -> Dict[str, List[T]]:
Expand Down Expand Up @@ -41,7 +40,7 @@ def list_dict_to_dict_list(
return {key: [item.get(key, default) for item in lst] for key in keys}


def intersect_lists(lst_of_lst: List[Iterable[T]]) -> List[T]:
def intersect_lists(lst_of_lst: Sequence[Iterable[T]]) -> List[T]:
"""Performs intersection of elements in lists (like set intersection), but keep their original order."""
if len(lst_of_lst) <= 0:
return []
Expand Down

0 comments on commit b503f63

Please sign in to comment.