Skip to content

Commit d6b4593

Browse files
Wrap Type to the typing of writer parameter of SaveImage (#4561)
* wrap `Type` to the typing of `writer` parameter of `SaveImage` Signed-off-by: function2 <luolx21@mails.tsinghua.edu.cn>
1 parent 669bddf commit d6b4593

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

monai/transforms/io/array.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
import warnings
2121
from pathlib import Path
2222
from pydoc import locate
23-
from typing import Dict, List, Optional, Sequence, Union
23+
from typing import Dict, List, Optional, Sequence, Type, Union
2424

2525
import numpy as np
2626
import torch
@@ -330,7 +330,7 @@ def __init__(
330330
separate_folder: bool = True,
331331
print_log: bool = True,
332332
output_format: str = "",
333-
writer: Union[image_writer.ImageWriter, str, None] = None,
333+
writer: Union[Type[image_writer.ImageWriter], str, None] = None,
334334
channel_dim: Optional[int] = 0,
335335
) -> None:
336336
self.folder_layout = FolderLayout(

monai/transforms/io/dictionary.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"""
1717

1818
from pathlib import Path
19-
from typing import Optional, Union
19+
from typing import Optional, Type, Union
2020

2121
import numpy as np
2222

@@ -237,7 +237,7 @@ def __init__(
237237
separate_folder: bool = True,
238238
print_log: bool = True,
239239
output_format: str = "",
240-
writer: Union[image_writer.ImageWriter, str, None] = None,
240+
writer: Union[Type[image_writer.ImageWriter], str, None] = None,
241241
) -> None:
242242
super().__init__(keys, allow_missing_keys)
243243
self.meta_keys = ensure_tuple_rep(meta_keys, len(self.keys))

monai/transforms/utils_pytorch_numpy_unification.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ def cumsum(a: NdarrayOrTensor, axis=None, **kwargs) -> NdarrayOrTensor:
276276
"""
277277

278278
if isinstance(a, np.ndarray):
279-
return np.cumsum(a, axis)
279+
return np.cumsum(a, axis) # type: ignore
280280
if axis is None:
281281
return torch.cumsum(a[:], 0, **kwargs)
282282
return torch.cumsum(a, dim=axis, **kwargs)

0 commit comments

Comments
 (0)