From dec284bde1689a2ec3b48f010779c6eef773a103 Mon Sep 17 00:00:00 2001 From: Bertrand Benjamin Date: Sun, 3 Mar 2024 07:15:34 +0100 Subject: [PATCH] Fix: recursive call for extract_sources --- scripts/flux.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/scripts/flux.py b/scripts/flux.py index 368ea27..e2e5e58 100644 --- a/scripts/flux.py +++ b/scripts/flux.py @@ -28,7 +28,7 @@ class ExcelSource(Source): class CSVSource(Source): - options: dict + options: dict = {} def get_df(self, base_path: Path) -> pd.DataFrame: filepath = base_path / self.filename @@ -76,7 +76,8 @@ def extract_sources(sources: list[Source], base_path: Path = Path()): for src in sources: if "*" in src.filename: expanded_src = [ - src.model_copy(update={"filename": p}) for p in Path.glob(src.filename) + src.model_copy(update={"filename": str(p.relative_to(base_path))}) + for p in base_path.glob(src.filename) ] yield from extract_sources(expanded_src, base_path) else: