From 5fd5b91b92341d9e9ec07a9d2dc77922a6f34ba0 Mon Sep 17 00:00:00 2001 From: Dima Gerasimov Date: Sat, 9 May 2020 23:32:30 +0100 Subject: [PATCH] Try the NamedTuple apptoach got google takeouts --- my/google/takeout/paths.py | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/my/google/takeout/paths.py b/my/google/takeout/paths.py index 312e2f4..21d4ef3 100644 --- a/my/google/takeout/paths.py +++ b/my/google/takeout/paths.py @@ -1,10 +1,29 @@ +from typing import NamedTuple +from ...core.common import Paths + +class google(NamedTuple): + ''' + Expects [[https://takeout.google.com][Google Takeout]] data. + ''' + takeout_path: Paths # path/paths/glob for the takeout zips + +### + +from my.config import google as user_config + +### +# TODO: generalize the thing from my.reddit +# i.e. config = make_config(google, user_config) +# reveal_type(config) should be 'google' +config = google(**{k: v for k, v in vars(user_config).items() if k in google._fields}) +### + from pathlib import Path from typing import Optional, Iterable from ...common import get_files from ...kython.kompress import kopen, kexists -from my.config import google as config def get_takeouts(*, path: Optional[str]=None) -> Iterable[Path]: """