more takeout to a separate subpackage

This commit is contained in:
Dima Gerasimov 2020-04-24 18:10:33 +01:00
parent d1aa4d19dc
commit a84b51807f
5 changed files with 9 additions and 10 deletions

View file

@ -8,7 +8,7 @@ from collections import OrderedDict
from urllib.parse import unquote from urllib.parse import unquote
import pytz import pytz
from ..core.time import abbr_to_timezone from ...core.time import abbr_to_timezone
# Mar 8, 2018, 5:14:40 PM # Mar 8, 2018, 5:14:40 PM
_TIME_FORMAT = "%b %d, %Y, %I:%M:%S %p" _TIME_FORMAT = "%b %d, %Y, %I:%M:%S %p"
@ -126,7 +126,7 @@ class TakeoutHTMLParser(HTMLParser):
def read_html(tpath: Path, file: str) -> Iterable[Parsed]: def read_html(tpath: Path, file: str) -> Iterable[Parsed]:
from .kompress import kopen from ...kython.kompress import kopen
results: List[Parsed] = [] results: List[Parsed] = []
def cb(dt: datetime, url: Url, title: Title) -> None: def cb(dt: datetime, url: Url, title: Title) -> None:
results.append((dt, url, title)) results.append((dt, url, title))

View file

@ -1,9 +1,8 @@
from pathlib import Path from pathlib import Path
from typing import Optional, Iterable from typing import Optional, Iterable
from .common import get_files from ...common import get_files
from .kython.kompress import kopen, kexists from ...kython.kompress import kopen, kexists
from .kython.ktakeout import read_html
from my.config import google as config from my.config import google as config

View file

@ -23,7 +23,7 @@ except:
import ijson # type: ignore import ijson # type: ignore
from ..common import get_files, LazyLogger, mcachew from ..common import get_files, LazyLogger, mcachew
from ..takeout import get_last_takeout from ..google.takeout.paths import get_last_takeout
from ..kython import kompress from ..kython import kompress

View file

@ -2,8 +2,8 @@
from datetime import datetime from datetime import datetime
from typing import NamedTuple, List from typing import NamedTuple, List
from ..kython.ktakeout import read_html from ..google.takeout.html import read_html
from ..takeout import get_last_takeout from ..google.takeout.paths import get_last_takeout
class Watched(NamedTuple): class Watched(NamedTuple):

View file

@ -32,8 +32,8 @@ import pytest # type: ignore
) )
def test_parser(path: str): def test_parser(path: str):
path = 'Takeout/' + path path = 'Takeout/' + path
from my.kython.ktakeout import read_html from my.google.takeout.html import read_html
from my.takeout import get_last_takeout from my.google.takeout.paths import get_last_takeout
tpath = get_last_takeout(path=path) tpath = get_last_takeout(path=path)