Fix: recursive call for extract_sources

This commit is contained in:
Bertrand Benjamin 2024-03-03 07:15:34 +01:00
parent d0961b0909
commit dec284bde1
1 changed files with 3 additions and 2 deletions

View File

@ -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: