From 091a947adeecde4d7d587b35fb854bb6fe9ba56d Mon Sep 17 00:00:00 2001 From: dcarron <daniel.carron@idiap.ch> Date: Fri, 14 Jun 2024 18:00:13 +0200 Subject: [PATCH] [mednet.info] More sensible check of configuration file --- src/mednet/scripts/info.py | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/src/mednet/scripts/info.py b/src/mednet/scripts/info.py index 4ad4f516..620e1a9d 100644 --- a/src/mednet/scripts/info.py +++ b/src/mednet/scripts/info.py @@ -34,9 +34,6 @@ def database_configuration( Name of the library to show configurations for. """ - if not rc.path.exists(): - _echo(f"{lib_name} configuration", f"{str(rc.path)} [MISSING]", "white") - click.secho(f"configured {lib_name} databases:", bold=True) for k, v in raw_databases.items(): if "datadir" not in v: @@ -87,18 +84,23 @@ def info( "cyan", ) - _echo("mednet configuration file: ", str(load_rc().path), "white") + rc = load_rc() - database_configuration( - load_rc(), - _get_raw_databases_classification(), - "classification", - ) - database_configuration( - load_rc(), - _get_raw_databases_segmentation(), - "segmentation", - ) + if not rc.path.exists(): + _echo("mednet configuration", f"{str(rc.path)} [MISSING]", "white") + else: + _echo("mednet configuration file: ", str(rc.path), "white") + + database_configuration( + rc, + _get_raw_databases_classification(), + "classification", + ) + database_configuration( + rc, + _get_raw_databases_segmentation(), + "segmentation", + ) click.secho("dependencies:", bold=True) python = typing.cast(dict[str, str], m["python"]) -- GitLab