fix model -> dal rename
This commit is contained in:
parent
6787c9c0d6
commit
9cfcc3373f
1 changed files with 7 additions and 9 deletions
|
@ -6,9 +6,10 @@ from pathlib import Path
|
||||||
import pytz
|
import pytz
|
||||||
|
|
||||||
from ..common import get_files, mcachew
|
from ..common import get_files, mcachew
|
||||||
|
from ..error import Res
|
||||||
|
|
||||||
from mycfg import paths
|
from mycfg import paths
|
||||||
import mycfg.repos.ghexport.model as ghexport
|
import mycfg.repos.ghexport.dal as ghexport
|
||||||
|
|
||||||
|
|
||||||
def get_logger():
|
def get_logger():
|
||||||
|
@ -24,9 +25,6 @@ class Event(NamedTuple):
|
||||||
body: Optional[str]=None
|
body: Optional[str]=None
|
||||||
|
|
||||||
|
|
||||||
T = TypeVar('T')
|
|
||||||
Res = Union[T, Exception]
|
|
||||||
|
|
||||||
# TODO split further, title too
|
# TODO split further, title too
|
||||||
def _get_summary(e) -> Tuple[str, Optional[str], Optional[str]]:
|
def _get_summary(e) -> Tuple[str, Optional[str], Optional[str]]:
|
||||||
tp = e['type']
|
tp = e['type']
|
||||||
|
@ -75,10 +73,9 @@ def _get_summary(e) -> Tuple[str, Optional[str], Optional[str]]:
|
||||||
return tp, None, None
|
return tp, None, None
|
||||||
|
|
||||||
|
|
||||||
def get_model():
|
def get_dal():
|
||||||
sources = get_files(paths.github.export_dir, glob='*.json')
|
sources = get_files(paths.github.export_dir, glob='*.json')
|
||||||
model = ghexport.Model(sources)
|
return ghexport.DAL(sources)
|
||||||
return model
|
|
||||||
|
|
||||||
|
|
||||||
def _parse_dt(s: str) -> datetime:
|
def _parse_dt(s: str) -> datetime:
|
||||||
|
@ -211,8 +208,9 @@ def iter_gdpr_events() -> Iterator[Res[Event]]:
|
||||||
yield e
|
yield e
|
||||||
|
|
||||||
|
|
||||||
@mcachew(paths.github.cache_dir, hashf=lambda model: model.sources)
|
# TODO hmm. not good, need to be lazier?...
|
||||||
def iter_backup_events(model=get_model()) -> Iterator[Event]:
|
@mcachew(paths.github.cache_dir, hashf=lambda dal: dal.sources)
|
||||||
|
def iter_backup_events(model=get_dal()) -> Iterator[Event]:
|
||||||
for d in model.events():
|
for d in model.events():
|
||||||
yield _parse_event(d)
|
yield _parse_event(d)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue