Skip to content

Commit 2a7842d

Browse files
committed
apply autofix and validate that docs still build
Signed-off-by: Fabian Klopfer <[email protected]>
1 parent a1046d9 commit 2a7842d

File tree

1 file changed

+18
-6
lines changed

1 file changed

+18
-6
lines changed

monai/transforms/utility/array.py

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -695,7 +695,9 @@ def __init__(
695695
_logger.setLevel(logging.INFO)
696696
if logging.root.getEffectiveLevel() > logging.INFO:
697697
# Avoid duplicate stream handlers to be added when multiple DataStats are used in a chain.
698-
has_console_handler = any(hasattr(h, "is_data_stats_handler") and h.is_data_stats_handler for h in _logger.handlers)
698+
has_console_handler = any(
699+
hasattr(h, "is_data_stats_handler") and h.is_data_stats_handler for h in _logger.handlers
700+
)
699701
if not has_console_handler:
700702
# if the root log level is higher than INFO, set a separate stream handler to record
701703
console = logging.StreamHandler(sys.stdout)
@@ -805,7 +807,9 @@ class Lambda(InvertibleTransform):
805807

806808
backend = [TransformBackends.TORCH, TransformBackends.NUMPY]
807809

808-
def __init__(self, func: Callable | None = None, inv_func: Callable = no_collation, track_meta: bool = True) -> None:
810+
def __init__(
811+
self, func: Callable | None = None, inv_func: Callable = no_collation, track_meta: bool = True
812+
) -> None:
809813
if func is not None and not callable(func):
810814
raise TypeError(f"func must be None or callable but is {type(func).__name__}.")
811815
self.func = func
@@ -1039,7 +1043,9 @@ def __call__(
10391043
if output_shape is None:
10401044
output_shape = self.output_shape
10411045
indices: list[NdarrayOrTensor]
1042-
indices = map_classes_to_indices(label, self.num_classes, image, self.image_threshold, self.max_samples_per_class)
1046+
indices = map_classes_to_indices(
1047+
label, self.num_classes, image, self.image_threshold, self.max_samples_per_class
1048+
)
10431049
if output_shape is not None:
10441050
indices = [unravel_indices(cls_indices, output_shape) for cls_indices in indices]
10451051

@@ -1651,7 +1657,9 @@ class ImageFilter(Transform):
16511657
"""
16521658

16531659
backend = [TransformBackends.TORCH, TransformBackends.NUMPY]
1654-
supported_filters = sorted(["mean", "laplace", "elliptical", "sobel", "sharpen", "median", "gauss", "savitzky_golay"])
1660+
supported_filters = sorted(
1661+
["mean", "laplace", "elliptical", "sobel", "sharpen", "median", "gauss", "savitzky_golay"]
1662+
)
16551663

16561664
def __init__(self, filter: str | NdarrayOrTensor | nn.Module, filter_size: int | None = None, **kwargs) -> None:
16571665
self._check_filter_format(filter, filter_size)
@@ -1792,7 +1800,9 @@ class RandImageFilter(RandomizableTransform):
17921800

17931801
backend = ImageFilter.backend
17941802

1795-
def __init__(self, filter: str | NdarrayOrTensor, filter_size: int | None = None, prob: float = 0.1, **kwargs) -> None:
1803+
def __init__(
1804+
self, filter: str | NdarrayOrTensor, filter_size: int | None = None, prob: float = 0.1, **kwargs
1805+
) -> None:
17961806
super().__init__(prob)
17971807
self.filter = ImageFilter(filter, filter_size, **kwargs)
17981808

@@ -1882,7 +1892,9 @@ def _compute_final_affine(self, affine: torch.Tensor, applied_affine: torch.Tens
18821892

18831893
return affine
18841894

1885-
def transform_coordinates(self, data: torch.Tensor, affine: torch.Tensor | None = None) -> tuple[torch.Tensor, dict]:
1895+
def transform_coordinates(
1896+
self, data: torch.Tensor, affine: torch.Tensor | None = None
1897+
) -> tuple[torch.Tensor, dict]:
18861898
"""
18871899
Transform coordinates using an affine transformation matrix.
18881900

0 commit comments

Comments
 (0)