general: use less explicit kompress boilerplate in modules

now get_files/kompress library can handle it transparently
This commit is contained in:
karlicoss 2023-10-14 23:18:01 +01:00
parent c63e80ce94
commit 8c2d1c9463
9 changed files with 14 additions and 19 deletions

View file

@ -146,12 +146,11 @@ class TakeoutHTMLParser(HTMLParser):
def read_html(tpath: Path, file: str) -> Iterable[Parsed]:
from ...core.kompress import kopen
results: List[Parsed] = []
def cb(dt: datetime, url: Url, title: Title) -> None:
results.append((dt, url, title))
parser = TakeoutHTMLParser(callback=cb)
with kopen(tpath, file) as fo:
with (tpath / file).open() as fo:
data = fo.read()
parser.feed(data)
return results