From c85818950816baabd23dcfcd27708bfc645dcd10 Mon Sep 17 00:00:00 2001 From: Madeline Cameron Date: Tue, 6 Apr 2021 19:43:07 -0400 Subject: [PATCH] new: typeform --- my/typeform.py | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 my/typeform.py diff --git a/my/typeform.py b/my/typeform.py new file mode 100644 index 0000000..8e76ebd --- /dev/null +++ b/my/typeform.py @@ -0,0 +1,40 @@ +''' +Typeform data +''' + +REQUIRES = [ + 'git+https://github.com/hpi/typeform' +] + +from dataclasses import dataclass +from pathlib import Path +from typing import Sequence, Iterable + +from .core import Paths, get_files + +from my.config import typeform as user_config + +@dataclass +class typeform(user_config): + # paths[s]/glob to the exported JSON data + export_path: Paths + + +def inputs() -> Sequence[Path]: + return get_files(typeform.export_path) + + +import typeform.dal as dal + + +def responses(): + _dal = dal.DAL(inputs()) + yield from _dal.responses() + +def answers(): + _dal = dal.DAL(inputs()) + yield from _dal.answers() + +def forms(): + _dal = dal.DAL(inputs()) + yield from _dal.forms()