Skip to content

Commit

Permalink
Fix python 3.8 typing
Browse files Browse the repository at this point in the history
  • Loading branch information
igrek51 committed Mar 4, 2024
1 parent 0694917 commit 4b04836
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ dist/
.coverage
coverage.xml
/venv
/venv*

.idea
*.iml
Expand Down
4 changes: 2 additions & 2 deletions nuclear/utils/collections.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ def chunks(lst: List[T], n: int) -> Iterable[List[T]]:
yield lst[i:i + n]


def deduplicate_latest(items: list[T], key: Callable[[T], Any]) -> list[T]:
def deduplicate_latest(items: List[T], key: Callable[[T], Any]) -> List[T]:
"""Deduplicate items in the list by key. Keep the earliest items first, remove the latest duplicates"""
ids = set()
dedup_items: List[T] = []
Expand All @@ -21,7 +21,7 @@ def deduplicate_latest(items: list[T], key: Callable[[T], Any]) -> list[T]:
return dedup_items


def deduplicate_earliest(items: list[T], key: Callable[[T], Any]) -> list[T]:
def deduplicate_earliest(items: List[T], key: Callable[[T], Any]) -> List[T]:
"""Deduplicate items in the list by key. Keep the latest items, remove the earliest duplicates"""
ids = set()
dedup_items: List[T] = []
Expand Down

0 comments on commit 4b04836

Please sign in to comment.