Move files
This commit is contained in:
parent
d2af1b8151
commit
f160b07163
159 changed files with 104 additions and 88 deletions
|
|
@ -1,16 +0,0 @@
|
|||
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())
|
||||
Loading…
Add table
Add a link
Reference in a new issue