use cachew for events

This commit is contained in:
Dima Gerasimov 2019-12-08 10:30:28 +00:00
parent 97f5fb2f36
commit da758abaf0

View file

@ -211,8 +211,17 @@ def iter_gdpr_events() -> Iterator[Res[Event]]:
yield e yield e
def iter_backup_events(): # TODO FIXME shit, cachew would need to support exceptions??
model = get_model() # TODO ugh. union types are sort of inevitable..
# TODO cachew: perhaps warn when function got no params? might end up as TODO
# TODO instead of hash, use 'deps'?? makes it a bit less misleading..
# TODO make cahcew optional, warn if it's not available
# TODO dependencies should involve our package and source packages somehow? that's very hard in general of course
from cachew import cachew
@cachew(paths.github.cache_dir, hashf=lambda model: model.sources)
def iter_backup_events(model=get_model()) -> Iterator[Event]:
for d in model.events(): for d in model.events():
yield _parse_event(d) yield _parse_event(d)