notes provider

This commit is contained in:
Dima Gerasimov 2018-11-13 20:24:49 +00:00
commit aa3155ff40

26
notes/__init__.py Normal file
View file

@ -0,0 +1,26 @@
from glob import glob
from typing import List
from porg import Org # typing: ignore
# TODO move to porg?
class PorgAll:
def __init__(self, paths: List[str]) -> None:
self.paths = paths
def query_all(self, query):
res = []
for p in self.paths:
ofiles = glob(p + '/**/*.org', recursive=True)
for of in ofiles:
org = Org.from_file(of)
res.extend(query(org))
return res
def get_notes():
ORG_PATHS = [
'***REMOVED***',
'***REMOVED***',
]
return PorgAll(ORG_PATHS)