Skip to content

Commit ac84a4e

Browse files
authored
Fix Ruff type check issue (#7885)
Fixes #7884 #7832 ### Types of changes <!--- Put an `x` in all the boxes that apply, and remove the not applicable items --> - [x] Non-breaking change (fix or new feature that would not break existing functionality). - [ ] Breaking change (fix or new feature that would cause existing functionality to change). - [ ] New tests added to cover the changes. - [ ] Integration tests passed locally by running `./runtests.sh -f -u --net --coverage`. - [ ] Quick tests passed locally by running `./runtests.sh --quick --unittests --disttests`. - [ ] In-line docstrings updated. - [ ] Documentation updated, tested `make html` command in the `docs/` folder. --------- Signed-off-by: YunLiu <55491388+KumoLiu@users.noreply.github.com>
1 parent 586c659 commit ac84a4e

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

docs/source/transforms.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -667,6 +667,12 @@ Post-processing
667667
:members:
668668
:special-members: __call__
669669

670+
`Invert`
671+
"""""""""
672+
.. autoclass:: Invert
673+
:members:
674+
:special-members: __call__
675+
670676
Regularization
671677
^^^^^^^^^^^^^^
672678

pyproject.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ exclude = "monai/bundle/__main__.py"
3838

3939
[tool.ruff]
4040
line-length = 133
41-
lint.ignore-init-module-imports = true
4241
lint.ignore = ["F401", "E741"]
4342

4443
[tool.pytype]

tests/test_pad_collation.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ def tearDown(self) -> None:
8989

9090
@parameterized.expand(TESTS)
9191
def test_pad_collation(self, t_type, collate_method, transform):
92-
if t_type == dict:
92+
if t_type is dict:
9393
dataset = CacheDataset(self.dict_data, transform, progress=False)
9494
else:
9595
dataset = _Dataset(self.list_data, self.list_labels, transform)
@@ -104,7 +104,7 @@ def test_pad_collation(self, t_type, collate_method, transform):
104104
loader = DataLoader(dataset, batch_size=10, collate_fn=collate_method)
105105
# check collation in forward direction
106106
for data in loader:
107-
if t_type == dict:
107+
if t_type is dict:
108108
shapes = []
109109
decollated_data = decollate_batch(data)
110110
for d in decollated_data:
@@ -113,7 +113,7 @@ def test_pad_collation(self, t_type, collate_method, transform):
113113
self.assertTrue(len(output["image"].applied_operations), len(dataset.transform.transforms))
114114
self.assertTrue(len(set(shapes)) > 1) # inverted shapes must be different because of random xforms
115115

116-
if t_type == dict:
116+
if t_type is dict:
117117
batch_inverse = BatchInverseTransform(dataset.transform, loader)
118118
for data in loader:
119119
output = batch_inverse(data)

0 commit comments

Comments
 (0)