in src/databao_context_engine/datasource_config/datasource_context.py [0:0]
def get_all_contexts(project_dir: Path, run_name: str | None = None) -> list[DatasourceContext]:
run_dir = _resolve_run_dir(project_dir, run_name)
result = []
for main_type_dir in sorted((p for p in run_dir.iterdir() if p.is_dir()), key=lambda p: p.name.lower()):
datasource_main_type = main_type_dir.name
for context_path in sorted(
(p for p in main_type_dir.iterdir() if p.suffix in [".yaml", ".yml"]), key=lambda p: p.name.lower()
):
result.append(
DatasourceContext(
# FIXME: The extension will always be yaml here even if the datasource is a file with a different extension
datasource_id=get_datasource_id_from_main_type_and_file_name(
datasource_main_type, context_path.name
),
context=context_path.read_text(),
)
)
return result