Move files

This commit is contained in:
Andras Schmelczer 2022-06-25 14:01:14 +02:00
parent cf0ac4b161
commit 0bf865ce2a
233 changed files with 117 additions and 2394 deletions

View file

@ -0,0 +1,16 @@
from typing import Any, Callable, Iterable, List
def unique(
values: Iterable[Any], *, key: Callable[[Any], Any] = lambda v: v
) -> List[Any]:
"""Only keep first occurrences and maintain order"""
key_values = {}
for v in values:
k = key(v)
if k not in key_values:
# dicts maintain insertion order: https://mail.python.org/pipermail/python-dev/2017-December/151283.html
key_values[k] = v
return list(key_values.values())