From 44ab402c6c5b62dcda975e9f5f4789e65bae5a9d Mon Sep 17 00:00:00 2001 From: Justus Kuhlmann Date: Fri, 28 Nov 2025 16:13:53 +0100 Subject: [PATCH] start refactor for data backend by only improting datalad into one submodule --- corrlib/data_backend/databackend.py | 7 +++++++ corrlib/data_backend/datalad.py | 13 +++++++++++++ corrlib/tools.py | 9 --------- 3 files changed, 20 insertions(+), 9 deletions(-) create mode 100644 corrlib/data_backend/databackend.py create mode 100644 corrlib/data_backend/datalad.py diff --git a/corrlib/data_backend/databackend.py b/corrlib/data_backend/databackend.py new file mode 100644 index 0000000..dad9fee --- /dev/null +++ b/corrlib/data_backend/databackend.py @@ -0,0 +1,7 @@ +import .datalad as dl + + +class DataBackend: + @abstractmethod + def get_file(self, data, file): + pass \ No newline at end of file diff --git a/corrlib/data_backend/datalad.py b/corrlib/data_backend/datalad.py new file mode 100644 index 0000000..9ccf1a6 --- /dev/null +++ b/corrlib/data_backend/datalad.py @@ -0,0 +1,13 @@ +import datalad.api as dl +import os +from corrlib.data_backend.databackend import + +def DLBackend() + +def get_file(path, file): + if file == "backlogger.db": + print("Downloading database...") + else: + print("Downloading data...") + dl.get(os.path.join(path, file), dataset=path) + print("> downloaded file") \ No newline at end of file diff --git a/corrlib/tools.py b/corrlib/tools.py index 14bfc05..6bc8b27 100644 --- a/corrlib/tools.py +++ b/corrlib/tools.py @@ -17,13 +17,4 @@ def m2k(m): def k2m(k): return (1/(2*k))-4 - - -def get_file(path, file): - if file == "backlogger.db": - print("Downloading database...") - else: - print("Downloading data...") - dl.get(os.path.join(path, file), dataset=path) - print("> downloaded file") \ No newline at end of file