fix .paths imports
This commit is contained in:
parent
3ee2deecae
commit
0415ea2560
5 changed files with 13 additions and 28 deletions
|
@ -2,7 +2,7 @@ from typing import Dict, List, NamedTuple, Optional, Sequence, Any
|
|||
from pathlib import Path
|
||||
from datetime import datetime
|
||||
|
||||
from .common import group_by_key, the, cproperty, PathIsh, import_file
|
||||
from .common import group_by_key, the, cproperty, PathIsh
|
||||
|
||||
|
||||
try:
|
||||
|
@ -33,6 +33,7 @@ class Config(NamedTuple):
|
|||
def hypexport(self):
|
||||
hp = self.hypexport_path_
|
||||
if hp is not None:
|
||||
from .common import import_file
|
||||
return import_file(Path(hp) / 'model.py', 'hypexport.model')
|
||||
else:
|
||||
global Model
|
||||
|
|
|
@ -30,8 +30,7 @@ def _get_files():
|
|||
export_path = _export_path
|
||||
if export_path is None:
|
||||
# fallback to mycfg
|
||||
# TODO import mycfg?
|
||||
from . import paths
|
||||
from mycfg import paths
|
||||
export_path = paths.instapaper.export_path
|
||||
return list(sorted(Path(export_path).glob('*.json')))
|
||||
|
||||
|
|
|
@ -1,20 +1,16 @@
|
|||
from functools import lru_cache
|
||||
from pathlib import Path
|
||||
|
||||
from . import paths
|
||||
|
||||
@lru_cache()
|
||||
def pinbexport():
|
||||
from .common import import_file
|
||||
return import_file(Path(paths.pinbexport.repo) / 'model.py')
|
||||
from mycfg.repos.pinbexport import model as pinbexport
|
||||
from mycfg import paths
|
||||
|
||||
# TODO would be nice to make interfaces available for mypy...
|
||||
Bookmark = pinbexport().Bookmark
|
||||
Bookmark = pinbexport.Bookmark
|
||||
|
||||
def get_model():
|
||||
export_dir = Path(paths.pinbexport.export_dir)
|
||||
sources = list(sorted(export_dir.glob('*.json')))
|
||||
model = pinbexport().Model(sources)
|
||||
model = pinbexport.Model(sources)
|
||||
return model
|
||||
|
||||
|
||||
|
|
|
@ -4,17 +4,13 @@ from typing import NamedTuple
|
|||
from datetime import datetime
|
||||
import pytz
|
||||
|
||||
from .. import paths
|
||||
|
||||
@lru_cache()
|
||||
def goodrexport():
|
||||
from ..common import import_file
|
||||
return import_file(paths.goodrexport.repo / 'model.py')
|
||||
from mycfg.repos.goodrexport import model as goodrexport
|
||||
from mycfg import paths
|
||||
|
||||
|
||||
def get_model():
|
||||
sources = list(sorted(paths.goodrexport.export_dir.glob('*.xml')))
|
||||
model = goodrexport().Model(sources)
|
||||
model = goodrexport.Model(sources)
|
||||
return model
|
||||
|
||||
|
||||
|
|
|
@ -1,14 +1,7 @@
|
|||
from functools import lru_cache
|
||||
|
||||
from . import paths
|
||||
|
||||
@lru_cache()
|
||||
def stexport():
|
||||
from .common import import_file
|
||||
stexport_model = import_file(paths.stexport.repo / 'model.py')
|
||||
return stexport_model
|
||||
import mycfg.repos.stexport.model as stexport
|
||||
from mycfg import paths
|
||||
|
||||
|
||||
def get_data():
|
||||
sources = [max(paths.stexport.export_dir.glob('*.json'))]
|
||||
return stexport().Model(sources).site_model('stackoverflow')
|
||||
return stexport.Model(sources).site_model('stackoverflow')
|
||||
|
|
Loading…
Add table
Reference in a new issue