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:
parent
0534c5c57d
commit
42399f6250
4 changed files with 28 additions and 17 deletions
|
@ -45,6 +45,9 @@ class bluemaestro:
|
|||
class stackexchange:
|
||||
export_path: Paths = ''
|
||||
|
||||
class pinboard:
|
||||
export_dir: Paths = ''
|
||||
|
||||
class google:
|
||||
takeout_path: Paths = ''
|
||||
|
||||
|
|
21
my/kobo.py
21
my/kobo.py
|
@ -2,9 +2,12 @@
|
|||
[[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?
|
||||
from dataclasses import dataclass
|
||||
from .core import Paths
|
||||
REQUIRES = [
|
||||
'kobuddy',
|
||||
]
|
||||
|
||||
|
||||
from .core import Paths, dataclass
|
||||
from my.config import kobo as user_config
|
||||
@dataclass
|
||||
class kobo(user_config):
|
||||
|
@ -31,11 +34,9 @@ from kobuddy import *
|
|||
|
||||
|
||||
|
||||
def stats():
|
||||
from .core import stat
|
||||
return {
|
||||
**stat(get_highlights),
|
||||
}
|
||||
from .core import stat, Stats
|
||||
def stats() -> Stats:
|
||||
return stat(get_highlights)
|
||||
|
||||
## 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
|
||||
|
||||
|
||||
def get_todos():
|
||||
def get_todos() -> List[Highlight]:
|
||||
def with_todo(ann):
|
||||
if ann is None:
|
||||
ann = ''
|
||||
|
@ -71,6 +72,6 @@ def get_todos():
|
|||
return by_annotation(with_todo)
|
||||
|
||||
|
||||
def test_todos():
|
||||
def test_todos() -> None:
|
||||
todos = get_todos()
|
||||
assert len(todos) > 3
|
||||
|
|
|
@ -1,21 +1,26 @@
|
|||
"""
|
||||
[[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
|
||||
|
||||
# TODO would be nice to make interfaces available for mypy...
|
||||
|
||||
import pinbexport.dal as pinbexport
|
||||
|
||||
Bookmark = pinbexport.Bookmark
|
||||
|
||||
|
||||
# yep; clearly looks that the purpose of my. package is to wire files to DAL implicitly; otherwise it's just passtrhough.
|
||||
def dal():
|
||||
sources = get_files(config.export_dir, glob='*.json')
|
||||
model = pinbexport.DAL(sources)
|
||||
def dal() -> pinbexport.DAL:
|
||||
from .core import get_files
|
||||
inputs = get_files(config.export_dir) # todo rename to export_path
|
||||
model = pinbexport.DAL(inputs)
|
||||
return model
|
||||
|
||||
|
||||
def bookmarks():
|
||||
from typing import Iterable
|
||||
def bookmarks() -> Iterable[pinbexport.Bookmark]:
|
||||
return dal().bookmarks()
|
||||
|
|
2
tox.ini
2
tox.ini
|
@ -74,6 +74,7 @@ commands =
|
|||
hpi module install my.pocket
|
||||
hpi module install my.reddit
|
||||
hpi module install my.stackexchange.stexport
|
||||
hpi module install my.pinboard
|
||||
|
||||
# TODO fuck. -p my.github isn't checking the subpackages?? wtf...
|
||||
python3 -m mypy \
|
||||
|
@ -84,6 +85,7 @@ commands =
|
|||
-p my.pocket \
|
||||
-p my.reddit \
|
||||
-p my.stackexchange.stexport \
|
||||
-p my.pinboard \
|
||||
-p my.body.exercise.cardio \
|
||||
-p my.body.exercise.cross_trainer \
|
||||
-p my.bluemaestro \
|
||||
|
|
Loading…
Add table
Reference in a new issue