Skip to content

Commit 6fd7fbc

Browse files
committed
fix mypy
Signed-off-by: YunLiu <[email protected]>
1 parent b00ed2d commit 6fd7fbc

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

monai/transforms/compose.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ def execute_compose(
6666
data: a tensor-like object to be transformed
6767
transforms: a sequence of transforms to be carried out
6868
map_items: whether to apply transform to each item in the input `data` if `data` is a list or tuple.
69-
defaults to `True`. If set to an integer, the transform will be applied to that index of the input `data`.
69+
defaults to `True`. If set to an integer, recursively map the items in `data` `map_items` times.
7070
unpack_items: whether to unpack input `data` with `*` as parameters for the callable function of transform.
7171
defaults to `False`.
7272
start: the index of the first transform to be executed. If not set, this defaults to 0
@@ -206,7 +206,7 @@ class Compose(Randomizable, InvertibleTransform, LazyTransform):
206206
Args:
207207
transforms: sequence of callables.
208208
map_items: whether to apply transform to each item in the input `data` if `data` is a list or tuple.
209-
defaults to `True`. If set to an integer, the transform will be applied to that index of the input `data`.
209+
defaults to `True`. If set to an integer, recursively map the items in `data` `map_items` times.
210210
unpack_items: whether to unpack input `data` with `*` as parameters for the callable function of transform.
211211
defaults to `False`.
212212
log_stats: this optional parameter allows you to specify a logger by name for logging of pipeline execution.
@@ -392,7 +392,7 @@ class OneOf(Compose):
392392
weights: probabilities corresponding to each callable in transforms.
393393
Probabilities are normalized to sum to one.
394394
map_items: whether to apply transform to each item in the input `data` if `data` is a list or tuple.
395-
defaults to `True`.
395+
defaults to `True`. If set to an integer, recursively map the items in `data` `map_items` times.
396396
unpack_items: whether to unpack input `data` with `*` as parameters for the callable function of transform.
397397
defaults to `False`.
398398
log_stats: this optional parameter allows you to specify a logger by name for logging of pipeline execution.
@@ -414,7 +414,7 @@ def __init__(
414414
self,
415415
transforms: Sequence[Callable] | Callable | None = None,
416416
weights: Sequence[float] | float | None = None,
417-
map_items: bool = True,
417+
map_items: bool | int = True,
418418
unpack_items: bool = False,
419419
log_stats: bool | str = False,
420420
lazy: bool | None = False,

monai/transforms/transform.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ def apply_transform(
106106
log_stats: bool | str = False,
107107
lazy: bool | None = None,
108108
overrides: dict | None = None,
109-
) -> list[ReturnType] | ReturnType:
109+
) -> list[Any] | ReturnType:
110110
"""
111111
Transform `data` with `transform`.
112112
@@ -119,7 +119,7 @@ def apply_transform(
119119
data: an object to be transformed.
120120
map_items: whether to apply transform to each item in `data`,
121121
if `data` is a list or tuple. Defaults to True.
122-
it can also be an int, if so, apply the transform to each item in the list `map_items` times.
122+
it can also be an int, if so, recursively map the items in `data` `map_items` times.
123123
unpack_items: whether to unpack parameters using `*`. Defaults to False.
124124
log_stats: log errors when they occur in the processing pipeline. By default, this is set to False, which
125125
disables the logger for processing pipeline errors. Setting it to None or True will enable logging to the

0 commit comments

Comments
 (0)