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 pathlib import Path
|
||||||
from datetime import datetime
|
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:
|
try:
|
||||||
|
@ -33,6 +33,7 @@ class Config(NamedTuple):
|
||||||
def hypexport(self):
|
def hypexport(self):
|
||||||
hp = self.hypexport_path_
|
hp = self.hypexport_path_
|
||||||
if hp is not None:
|
if hp is not None:
|
||||||
|
from .common import import_file
|
||||||
return import_file(Path(hp) / 'model.py', 'hypexport.model')
|
return import_file(Path(hp) / 'model.py', 'hypexport.model')
|
||||||
else:
|
else:
|
||||||
global Model
|
global Model
|
||||||
|
|
|
@ -30,8 +30,7 @@ def _get_files():
|
||||||
export_path = _export_path
|
export_path = _export_path
|
||||||
if export_path is None:
|
if export_path is None:
|
||||||
# fallback to mycfg
|
# fallback to mycfg
|
||||||
# TODO import mycfg?
|
from mycfg import paths
|
||||||
from . import paths
|
|
||||||
export_path = paths.instapaper.export_path
|
export_path = paths.instapaper.export_path
|
||||||
return list(sorted(Path(export_path).glob('*.json')))
|
return list(sorted(Path(export_path).glob('*.json')))
|
||||||
|
|
||||||
|
|
|
@ -1,20 +1,16 @@
|
||||||
from functools import lru_cache
|
from functools import lru_cache
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
from . import paths
|
from mycfg.repos.pinbexport import model as pinbexport
|
||||||
|
from mycfg import paths
|
||||||
@lru_cache()
|
|
||||||
def pinbexport():
|
|
||||||
from .common import import_file
|
|
||||||
return import_file(Path(paths.pinbexport.repo) / 'model.py')
|
|
||||||
|
|
||||||
# TODO would be nice to make interfaces available for mypy...
|
# TODO would be nice to make interfaces available for mypy...
|
||||||
Bookmark = pinbexport().Bookmark
|
Bookmark = pinbexport.Bookmark
|
||||||
|
|
||||||
def get_model():
|
def get_model():
|
||||||
export_dir = Path(paths.pinbexport.export_dir)
|
export_dir = Path(paths.pinbexport.export_dir)
|
||||||
sources = list(sorted(export_dir.glob('*.json')))
|
sources = list(sorted(export_dir.glob('*.json')))
|
||||||
model = pinbexport().Model(sources)
|
model = pinbexport.Model(sources)
|
||||||
return model
|
return model
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -4,17 +4,13 @@ from typing import NamedTuple
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
import pytz
|
import pytz
|
||||||
|
|
||||||
from .. import paths
|
from mycfg.repos.goodrexport import model as goodrexport
|
||||||
|
from mycfg import paths
|
||||||
@lru_cache()
|
|
||||||
def goodrexport():
|
|
||||||
from ..common import import_file
|
|
||||||
return import_file(paths.goodrexport.repo / 'model.py')
|
|
||||||
|
|
||||||
|
|
||||||
def get_model():
|
def get_model():
|
||||||
sources = list(sorted(paths.goodrexport.export_dir.glob('*.xml')))
|
sources = list(sorted(paths.goodrexport.export_dir.glob('*.xml')))
|
||||||
model = goodrexport().Model(sources)
|
model = goodrexport.Model(sources)
|
||||||
return model
|
return model
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,14 +1,7 @@
|
||||||
from functools import lru_cache
|
import mycfg.repos.stexport.model as stexport
|
||||||
|
from mycfg import paths
|
||||||
from . import paths
|
|
||||||
|
|
||||||
@lru_cache()
|
|
||||||
def stexport():
|
|
||||||
from .common import import_file
|
|
||||||
stexport_model = import_file(paths.stexport.repo / 'model.py')
|
|
||||||
return stexport_model
|
|
||||||
|
|
||||||
|
|
||||||
def get_data():
|
def get_data():
|
||||||
sources = [max(paths.stexport.export_dir.glob('*.json'))]
|
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