pinboard: *breaking backwards compability*, use pinbexport module directy

Use 'hpi module install my.pinboard' to install it

relevant: https://github.com/karlicoss/HPI/issues/79
This commit is contained in:
Dima Gerasimov 2021-02-18 20:13:14 +00:00 committed by karlicoss
parent 0534c5c57d
commit 42399f6250
4 changed files with 28 additions and 17 deletions

View file

@ -45,6 +45,9 @@ class bluemaestro:
class stackexchange: class stackexchange:
export_path: Paths = '' export_path: Paths = ''
class pinboard:
export_dir: Paths = ''
class google: class google:
takeout_path: Paths = '' takeout_path: Paths = ''

View file

@ -2,9 +2,12 @@
[[https://uk.kobobooks.com/products/kobo-aura-one][Kobo]] e-ink reader: annotations and reading stats [[https://uk.kobobooks.com/products/kobo-aura-one][Kobo]] e-ink reader: annotations and reading stats
""" """
# TODO require installing kobuddy, need to upload to pypi as well? REQUIRES = [
from dataclasses import dataclass 'kobuddy',
from .core import Paths ]
from .core import Paths, dataclass
from my.config import kobo as user_config from my.config import kobo as user_config
@dataclass @dataclass
class kobo(user_config): class kobo(user_config):
@ -31,11 +34,9 @@ from kobuddy import *
def stats(): from .core import stat, Stats
from .core import stat def stats() -> Stats:
return { return stat(get_highlights)
**stat(get_highlights),
}
## TODO hmm. not sure if all this really belongs here?... perhaps orger? ## TODO hmm. not sure if all this really belongs here?... perhaps orger?
@ -63,7 +64,7 @@ def by_annotation(predicatish: Predicatish, **kwargs) -> List[Highlight]:
return res return res
def get_todos(): def get_todos() -> List[Highlight]:
def with_todo(ann): def with_todo(ann):
if ann is None: if ann is None:
ann = '' ann = ''
@ -71,6 +72,6 @@ def get_todos():
return by_annotation(with_todo) return by_annotation(with_todo)
def test_todos(): def test_todos() -> None:
todos = get_todos() todos = get_todos()
assert len(todos) > 3 assert len(todos) > 3

View file

@ -1,21 +1,26 @@
""" """
[[https://pinboard.in][Pinboard]] bookmarks [[https://pinboard.in][Pinboard]] bookmarks
""" """
from .common import get_files REQUIRES = [
'git+https://github.com/karlicoss/pinbexport',
]
from my.config.repos.pinbexport import dal as pinbexport
from my.config import pinboard as config from my.config import pinboard as config
# TODO would be nice to make interfaces available for mypy...
import pinbexport.dal as pinbexport
Bookmark = pinbexport.Bookmark Bookmark = pinbexport.Bookmark
# yep; clearly looks that the purpose of my. package is to wire files to DAL implicitly; otherwise it's just passtrhough. # yep; clearly looks that the purpose of my. package is to wire files to DAL implicitly; otherwise it's just passtrhough.
def dal(): def dal() -> pinbexport.DAL:
sources = get_files(config.export_dir, glob='*.json') from .core import get_files
model = pinbexport.DAL(sources) inputs = get_files(config.export_dir) # todo rename to export_path
model = pinbexport.DAL(inputs)
return model return model
def bookmarks(): from typing import Iterable
def bookmarks() -> Iterable[pinbexport.Bookmark]:
return dal().bookmarks() return dal().bookmarks()

View file

@ -74,6 +74,7 @@ commands =
hpi module install my.pocket hpi module install my.pocket
hpi module install my.reddit hpi module install my.reddit
hpi module install my.stackexchange.stexport hpi module install my.stackexchange.stexport
hpi module install my.pinboard
# TODO fuck. -p my.github isn't checking the subpackages?? wtf... # TODO fuck. -p my.github isn't checking the subpackages?? wtf...
python3 -m mypy \ python3 -m mypy \
@ -84,6 +85,7 @@ commands =
-p my.pocket \ -p my.pocket \
-p my.reddit \ -p my.reddit \
-p my.stackexchange.stexport \ -p my.stackexchange.stexport \
-p my.pinboard \
-p my.body.exercise.cardio \ -p my.body.exercise.cardio \
-p my.body.exercise.cross_trainer \ -p my.body.exercise.cross_trainer \
-p my.bluemaestro \ -p my.bluemaestro \