Skip to content
Snippets Groups Projects
Commit 1a1e95a9 authored by Daniel CARRON's avatar Daniel CARRON :b: Committed by André Anjos
Browse files

[database] Rename split to fold

parent 6dd4de74
No related branches found
No related tags found
1 merge request!46Create common library
......@@ -112,7 +112,7 @@ def list_():
""",
)
@click.argument(
"split",
"fold",
nargs=1,
)
@click.option(
......@@ -125,6 +125,6 @@ def list_():
default=0,
)
@verbosity_option(logger=logger, expose_value=False)
def check(split, limit): # numpydoc ignore=PR01
def check(fold, limit): # numpydoc ignore=PR01
"""Check file access on one or more DataModules."""
check_("mednet.libs.classification.config", split, limit)
check_("mednet.libs.classification.config", fold, limit)
......@@ -35,18 +35,18 @@ def list_(config: dict[str, dict[str, str]]) -> None:
click.echo(f'- {k} ({v["module"]}): NOT installed')
def check(entry_point_group, split, limit): # numpydoc ignore=PR01
def check(entry_point_group, fold, limit): # numpydoc ignore=PR01
"""Check file access on one or more DataModules."""
import importlib.metadata
import sys
click.secho(f"Checking split `{split}`...", fg="yellow")
click.secho(f"Checking fold `{fold}`...", fg="yellow")
try:
module = importlib.metadata.entry_points(group=entry_point_group)[
split
fold
].module
except KeyError:
raise Exception(f"Could not find database split `{split}`")
raise Exception(f"Could not find database fold `{fold}`")
datamodule = importlib.import_module(module).datamodule
......@@ -60,14 +60,14 @@ def check(entry_point_group, split, limit): # numpydoc ignore=PR01
for k, loader in loaders.items():
if limit == 0:
click.secho(
f"Checking all samples of dataset `{k}` at split `{split}`...",
f"Checking all samples of dataset `{k}` at fold `{fold}`...",
fg="yellow",
)
loader_limit = sys.maxsize
else:
click.secho(
f"Checking first {limit} samples of dataset "
f"`{k}` at split `{split}`...",
f"`{k}` at fold `{fold}`...",
fg="yellow",
)
loader_limit = limit
......@@ -88,11 +88,11 @@ def check(entry_point_group, split, limit): # numpydoc ignore=PR01
if not errors:
click.secho(
f"OK! No errors were reported for database split `{split}`.",
f"OK! No errors were reported for database fold `{fold}`.",
fg="green",
)
else:
click.secho(
f"Found {errors} errors loading DataModule `{split}`.",
f"Found {errors} errors loading DataModule `{fold}`.",
fg="red",
)
......@@ -101,7 +101,7 @@ def list_():
@database.command(
epilog="""Examples:
1. Check if all files from the split 'montgomery-f0' of the Montgomery
1. Check if all files from the fold 'montgomery-f0' of the Montgomery
database can be loaded:
.. code:: sh
......@@ -111,7 +111,7 @@ def list_():
""",
)
@click.argument(
"split",
"fold",
nargs=1,
)
@click.option(
......@@ -124,6 +124,6 @@ def list_():
default=0,
)
@verbosity_option(logger=logger, expose_value=False)
def check(split, limit): # numpydoc ignore=PR01
def check(fold, limit): # numpydoc ignore=PR01
"""Check file access on one or more DataModules."""
check_("mednet.libs.segmentation.config", split, limit)
check_("mednet.libs.segmentation.config", fold, limit)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment