From 7bba1bd558cbf934171f6754fc4ceddfd1010909 Mon Sep 17 00:00:00 2001 From: monai-bot <64792179+monai-bot@users.noreply.github.com> Date: Mon, 27 May 2024 11:00:36 +0100 Subject: [PATCH] auto updates (#7807) Signed-off-by: monai-bot Signed-off-by: monai-bot Co-authored-by: YunLiu <55491388+KumoLiu@users.noreply.github.com> --- monai/bundle/scripts.py | 17 ++++++++++++++--- tests/test_clip_intensity_percentiles.py | 1 + 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/monai/bundle/scripts.py b/monai/bundle/scripts.py index 598d938cbd..4718344bab 100644 --- a/monai/bundle/scripts.py +++ b/monai/bundle/scripts.py @@ -10,6 +10,7 @@ # limitations under the License. from __future__ import annotations +from io import StringIO import ast import json @@ -116,10 +117,20 @@ def _pop_args(src: dict, *args: Any, **kwargs: Any) -> tuple: def _log_input_summary(tag: str, args: dict) -> None: - logger.info(f"--- input summary of monai.bundle.scripts.{tag} ---") +<<<<<<< HEAD + log_buffer = StringIO() + log_buffer.write(f"--- input summary of monai.bundle.scripts.{tag} ---\n") for name, val in args.items(): - logger.info(f"> {name}: {pprint_edges(val, PPRINT_CONFIG_N)}") - logger.info("---\n\n") + log_buffer.write(f"> {name}: {pprint_edges(val, PPRINT_CONFIG_N)}\n") + log_buffer.write("---\n\n") +======= + log_buffer = StringIO() + log_buffer.write(f"--- input summary of monai.bundle.scripts.{tag} ---\n") + for name, val in args.items(): + log_buffer.write(f"> {name}: {pprint_edges(val, PPRINT_CONFIG_N)}\n") + log_buffer.write("---\n\n") +>>>>>>> 28f5ebe7e3a0487b9d78123a80d565f1fa26615a + logger.info(log_buffer.getvalue()) # output all content in buffer def _get_var_names(expr: str) -> list[str]: diff --git a/tests/test_clip_intensity_percentiles.py b/tests/test_clip_intensity_percentiles.py index a821558fb7..cab2a89a47 100644 --- a/tests/test_clip_intensity_percentiles.py +++ b/tests/test_clip_intensity_percentiles.py @@ -22,6 +22,7 @@ class TestClipIntensityPercentiles2D(NumpyImageTestCase2D): + @parameterized.expand([[p] for p in TEST_NDARRAYS]) def test_hard_clipping_two_sided(self, p): hard_clipper = ClipIntensityPercentiles(upper=95, lower=5)