core: move mcachew into my.core.cachew; use better typing annotations (copied from cachew)

This commit is contained in:
Dima Gerasimov 2023-06-07 22:06:29 +01:00
parent f8cd31044e
commit 6f57def9cd
7 changed files with 113 additions and 77 deletions

View file

@ -32,8 +32,12 @@ def dir_hash(path: Path):
return mtimes
def _cachew_depends_on():
return dir_hash(config.export_path)
# TODO take __file__ into account somehow?
@mcachew(cache_path=cache_dir() / 'emfit.cache', hashf=lambda: dir_hash(config.export_path))
@mcachew(cache_path=cache_dir() / 'emfit.cache', depends_on=_cachew_depends_on)
def datas() -> Iterable[Res[Emfit]]:
import dataclasses