From 7631f1f2e498e8a1829c02e3543bb8dd88770ffd Mon Sep 17 00:00:00 2001 From: karlicoss Date: Thu, 2 Nov 2023 00:27:09 +0000 Subject: [PATCH] monzo.monzoexport: initial module --- my/config.py | 5 +++++ my/monzo/monzoexport.py | 45 +++++++++++++++++++++++++++++++++++++++++ tox.ini | 1 + 3 files changed, 51 insertions(+) create mode 100644 my/monzo/monzoexport.py diff --git a/my/config.py b/my/config.py index 9cc9c11..ac44f41 100644 --- a/my/config.py +++ b/my/config.py @@ -269,3 +269,8 @@ class whatsapp: class harmonic: export_path: Paths + + +class monzo: + class monzoexport: + export_path: Paths diff --git a/my/monzo/monzoexport.py b/my/monzo/monzoexport.py new file mode 100644 index 0000000..3aa0cf5 --- /dev/null +++ b/my/monzo/monzoexport.py @@ -0,0 +1,45 @@ +""" +Monzo transactions data (using https://github.com/karlicoss/monzoexport ) +""" +REQUIRES = [ + 'git+https://github.com/karlicoss/monzoexport', +] + +from dataclasses import dataclass +from pathlib import Path +from typing import Sequence, Iterator + +from my.core import ( + Paths, + get_files, + make_logger, +) +import my.config + + +@dataclass +class config(my.config.monzo.monzoexport): + ''' + Uses [[https://github.com/karlicoss/monzoexport][ghexport]] outputs. + ''' + + export_path: Paths + '''path[s]/glob to the exported JSON data''' + + +logger = make_logger(__name__) + + +def inputs() -> Sequence[Path]: + return get_files(config.export_path) + + +import monzoexport.dal as dal + + +def _dal() -> dal.DAL: + return dal.DAL(inputs()) + + +def transactions() -> Iterator[dal.MonzoTransaction]: + return _dal().transactions() diff --git a/tox.ini b/tox.ini index ac0a68d..dad6d9b 100644 --- a/tox.ini +++ b/tox.ini @@ -153,6 +153,7 @@ commands = my.ip.all \ my.kobo \ my.location.gpslogger \ + my.monzo.monzoexport \ my.orgmode \ my.pdfs \ my.pinboard \