From a84b51807fc0b9fb62cd5d063252aad1e16288da Mon Sep 17 00:00:00 2001 From: Dima Gerasimov Date: Fri, 24 Apr 2020 18:10:33 +0100 Subject: [PATCH] more takeout to a separate subpackage --- my/{kython/ktakeout.py => google/takeout/html.py} | 4 ++-- my/{takeout.py => google/takeout/paths.py} | 5 ++--- my/location/takeout.py | 2 +- my/media/youtube.py | 4 ++-- tests/takeout.py | 4 ++-- 5 files changed, 9 insertions(+), 10 deletions(-) rename my/{kython/ktakeout.py => google/takeout/html.py} (98%) rename my/{takeout.py => google/takeout/paths.py} (89%) diff --git a/my/kython/ktakeout.py b/my/google/takeout/html.py similarity index 98% rename from my/kython/ktakeout.py rename to my/google/takeout/html.py index 30688e3..2fccee9 100644 --- a/my/kython/ktakeout.py +++ b/my/google/takeout/html.py @@ -8,7 +8,7 @@ from collections import OrderedDict from urllib.parse import unquote import pytz -from ..core.time import abbr_to_timezone +from ...core.time import abbr_to_timezone # Mar 8, 2018, 5:14:40 PM _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]: - from .kompress import kopen + from ...kython.kompress import kopen results: List[Parsed] = [] def cb(dt: datetime, url: Url, title: Title) -> None: results.append((dt, url, title)) diff --git a/my/takeout.py b/my/google/takeout/paths.py similarity index 89% rename from my/takeout.py rename to my/google/takeout/paths.py index e38e493..312e2f4 100644 --- a/my/takeout.py +++ b/my/google/takeout/paths.py @@ -1,9 +1,8 @@ from pathlib import Path from typing import Optional, Iterable -from .common import get_files -from .kython.kompress import kopen, kexists -from .kython.ktakeout import read_html +from ...common import get_files +from ...kython.kompress import kopen, kexists from my.config import google as config diff --git a/my/location/takeout.py b/my/location/takeout.py index 79ad25c..da53664 100644 --- a/my/location/takeout.py +++ b/my/location/takeout.py @@ -23,7 +23,7 @@ except: import ijson # type: ignore 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 diff --git a/my/media/youtube.py b/my/media/youtube.py index 6331190..ffe2740 100755 --- a/my/media/youtube.py +++ b/my/media/youtube.py @@ -2,8 +2,8 @@ from datetime import datetime from typing import NamedTuple, List -from ..kython.ktakeout import read_html -from ..takeout import get_last_takeout +from ..google.takeout.html import read_html +from ..google.takeout.paths import get_last_takeout class Watched(NamedTuple): diff --git a/tests/takeout.py b/tests/takeout.py index 6acca9b..918582f 100644 --- a/tests/takeout.py +++ b/tests/takeout.py @@ -32,8 +32,8 @@ import pytest # type: ignore ) def test_parser(path: str): path = 'Takeout/' + path - from my.kython.ktakeout import read_html - from my.takeout import get_last_takeout + from my.google.takeout.html import read_html + from my.google.takeout.paths import get_last_takeout tpath = get_last_takeout(path=path)