From 4ca872f711290e4df99f7f98b6e9945d94a85371 Mon Sep 17 00:00:00 2001 From: Dima Gerasimov Date: Fri, 6 Dec 2019 21:07:25 +0000 Subject: [PATCH] standartize use of my_configuration in github --- my/coding/{github/__init__.py => github.py} | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) rename my/coding/{github/__init__.py => github.py} (89%) diff --git a/my/coding/github/__init__.py b/my/coding/github.py similarity index 89% rename from my/coding/github/__init__.py rename to my/coding/github.py index 1c41858..587745f 100644 --- a/my/coding/github/__init__.py +++ b/my/coding/github.py @@ -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 datetime import datetime from pathlib import Path @@ -15,6 +5,11 @@ import logging import pytz +from ..common import get_files + +from my_configuration import paths +import my_configuration.repos.ghexport.model as ghexport + def get_logger(): return logging.getLogger('my.github') # TODO __package__??? @@ -76,8 +71,8 @@ def _get_summary(e) -> Tuple[str, Optional[str]]: def get_model(): - sources = list(sorted(paths.ghexport.export_dir.glob('*.json'))) - model = ghexport().Model(sources) + sources = get_files(paths.github.export_dir, glob='*.json') + model = ghexport.Model(sources) return model @@ -105,7 +100,6 @@ def get_events(): def test(): - assert len(get_events()) > 100 events = get_events() assert len(events) > 100 for e in events: