Skip to content

Commit

Permalink
Fix Ruff type check issue (#7885)
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
KumoLiu authored Jun 28, 2024
1 parent 586c659 commit ac84a4e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
6 changes: 6 additions & 0 deletions docs/source/transforms.rst
Original file line number Diff line number Diff line change
Expand Up @@ -667,6 +667,12 @@ Post-processing
:members:
:special-members: __call__

`Invert`
"""""""""
.. autoclass:: Invert
:members:
:special-members: __call__

Regularization
^^^^^^^^^^^^^^

Expand Down
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ exclude = "monai/bundle/__main__.py"

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

[tool.pytype]
Expand Down
6 changes: 3 additions & 3 deletions tests/test_pad_collation.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def tearDown(self) -> None:

@parameterized.expand(TESTS)
def test_pad_collation(self, t_type, collate_method, transform):
if t_type == dict:
if t_type is dict:
dataset = CacheDataset(self.dict_data, transform, progress=False)
else:
dataset = _Dataset(self.list_data, self.list_labels, transform)
Expand All @@ -104,7 +104,7 @@ def test_pad_collation(self, t_type, collate_method, transform):
loader = DataLoader(dataset, batch_size=10, collate_fn=collate_method)
# check collation in forward direction
for data in loader:
if t_type == dict:
if t_type is dict:
shapes = []
decollated_data = decollate_batch(data)
for d in decollated_data:
Expand All @@ -113,7 +113,7 @@ def test_pad_collation(self, t_type, collate_method, transform):
self.assertTrue(len(output["image"].applied_operations), len(dataset.transform.transforms))
self.assertTrue(len(set(shapes)) > 1) # inverted shapes must be different because of random xforms

if t_type == dict:
if t_type is dict:
batch_inverse = BatchInverseTransform(dataset.transform, loader)
for data in loader:
output = batch_inverse(data)
Expand Down

0 comments on commit ac84a4e

Please sign in to comment.