diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 2660a30e2..51dc01cb5 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,6 +1,6 @@ repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v5.0.0 # Use the ref you want to point at + rev: v6.0.0 # Use the ref you want to point at hooks: - id: trailing-whitespace - id: check-ast @@ -16,7 +16,7 @@ repos: - id: check-toml - repo: https://github.com/astral-sh/ruff-pre-commit - rev: 'v0.11.4' + rev: 'v0.15.6' hooks: - id: ruff args: [--fix, --exit-non-zero-on-fix] @@ -25,7 +25,7 @@ repos: types_or: [python, jupyter] - repo: https://github.com/pre-commit/mirrors-mypy - rev: v1.15.0 + rev: v1.19.1 hooks: - id: mypy entry: python3 -m mypy --config-file pyproject.toml diff --git a/cyclops/monitor/utils.py b/cyclops/monitor/utils.py index d990c5096..0fdcd2b42 100644 --- a/cyclops/monitor/utils.py +++ b/cyclops/monitor/utils.py @@ -289,7 +289,7 @@ def load_model(model_path: str) -> Any: loaded pre-trained model """ - file_type = model_path.split(".")[-1] + file_type = model_path.rsplit(".", maxsplit=1)[-1] if file_type in ("pkl", "pickle"): with open(model_path, "rb") as file: model = pickle.load(file) @@ -310,7 +310,7 @@ def save_model(model: Any, output_path: str) -> None: path to save the model to """ - file_type = output_path.split(".")[-1] + file_type = output_path.rsplit(".", maxsplit=1)[-1] if file_type in ("pkl", "pickle"): with open(output_path, "wb") as file: pickle.dump(model, file) diff --git a/cyclops/report/report.py b/cyclops/report/report.py index 19f916581..9ffd29b0f 100644 --- a/cyclops/report/report.py +++ b/cyclops/report/report.py @@ -966,8 +966,9 @@ def log_performance_metrics( results: Dict[str, Any], metric_descriptions: Dict[str, str], pass_fail_thresholds: Union[float, Dict[str, float]] = 0.7, - pass_fail_threshold_fn: Callable[[float, float], bool] = lambda x, - threshold: bool(x >= threshold), + pass_fail_threshold_fn: Callable[[float, float], bool] = lambda x, threshold: ( + bool(x >= threshold) + ), ) -> None: """ Log all performance metrics to the model card report. diff --git a/docs/source/tutorials/nihcxr/monitor_api.ipynb b/docs/source/tutorials/nihcxr/monitor_api.ipynb index 53e9ebcd3..b6662ddda 100644 --- a/docs/source/tutorials/nihcxr/monitor_api.ipynb +++ b/docs/source/tutorials/nihcxr/monitor_api.ipynb @@ -25,7 +25,6 @@ "source": [ "\"\"\"NIHCXR Clinical Drift Experiments Tutorial.\"\"\"\n", "\n", - "\n", "import random\n", "\n", "import numpy as np\n",