standartize use of my_configuration in github

This commit is contained in:
Dima Gerasimov 2019-12-06 21:07:25 +00:00
parent 8a800e9b06
commit 4ca872f711

View file

@ -1,13 +1,3 @@
from functools import lru_cache
from ... import paths
@lru_cache()
def ghexport():
from ...common import import_file
return import_file(paths.ghexport.repo / 'model.py')
from typing import Dict, List, Union, Any, NamedTuple, Tuple, Optional from typing import Dict, List, Union, Any, NamedTuple, Tuple, Optional
from datetime import datetime from datetime import datetime
from pathlib import Path from pathlib import Path
@ -15,6 +5,11 @@ import logging
import pytz import pytz
from ..common import get_files
from my_configuration import paths
import my_configuration.repos.ghexport.model as ghexport
def get_logger(): def get_logger():
return logging.getLogger('my.github') # TODO __package__??? return logging.getLogger('my.github') # TODO __package__???
@ -76,8 +71,8 @@ def _get_summary(e) -> Tuple[str, Optional[str]]:
def get_model(): def get_model():
sources = list(sorted(paths.ghexport.export_dir.glob('*.json'))) sources = get_files(paths.github.export_dir, glob='*.json')
model = ghexport().Model(sources) model = ghexport.Model(sources)
return model return model
@ -105,7 +100,6 @@ def get_events():
def test(): def test():
assert len(get_events()) > 100
events = get_events() events = get_events()
assert len(events) > 100 assert len(events) > 100
for e in events: for e in events: