core: cleanup itertool style helpers

- deprecate group_by_key, should use itertool.bucket instead
- move make_dict and ensure_unique to my.core.utils.itertools
This commit is contained in:
Dima Gerasimov 2024-08-13 10:22:39 +03:00
parent 918e8ee551
commit 029fa3ae84
7 changed files with 119 additions and 93 deletions

View file

@ -65,11 +65,10 @@ def _dal() -> dal.DAL:
@mcachew(depends_on=inputs)
def events() -> Results:
from my.core.common import ensure_unique
key = lambda e: object() if isinstance(e, Exception) else e.eid
# key = lambda e: object() if isinstance(e, Exception) else e.eid
# crap. sometimes API events can be repeated with exactly the same payload and different id
# yield from ensure_unique(_events(), key=key)
yield from _events()
return _events()
def _events() -> Results: