Skip to content

Commit

Permalink
Bump ruff from 0.8.6 to 0.9.0 in /requirements (#1028)
Browse files Browse the repository at this point in the history
* Bump ruff from 0.8.6 to 0.9.0 in /requirements

Bumps [ruff](https://github.com/astral-sh/ruff) from 0.8.6 to 0.9.0.
- [Release notes](https://github.com/astral-sh/ruff/releases)
- [Changelog](https://github.com/astral-sh/ruff/blob/main/CHANGELOG.md)
- [Commits](astral-sh/ruff@0.8.6...0.9.0)

---
updated-dependencies:
- dependency-name: ruff
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>

* Update ruff

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Adam J. Stewart <[email protected]>
  • Loading branch information
dependabot[bot] and adamjstewart authored Jan 11, 2025
1 parent 850ef14 commit eaf8be6
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 19 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ test = [
'pytest',
'pytest-cov',
'pytest-xdist',
'ruff',
'ruff>=0.9',
]

[project.urls]
Expand Down
2 changes: 1 addition & 1 deletion requirements/test.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ packaging==24.2
pytest==8.3.4
pytest-xdist==3.6.1
pytest-cov==6.0.0
ruff==0.8.6
ruff==0.9.1
6 changes: 3 additions & 3 deletions segmentation_models_pytorch/decoders/unetplusplus/decoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ def __init__(
blocks[f"x_{depth_idx}_{layer_idx}"] = DecoderBlock(
in_ch, skip_ch, out_ch, **kwargs
)
blocks[f"x_{0}_{len(self.in_channels)-1}"] = DecoderBlock(
blocks[f"x_{0}_{len(self.in_channels) - 1}"] = DecoderBlock(
self.in_channels[-1], 0, self.out_channels[-1], **kwargs
)
self.blocks = nn.ModuleDict(blocks)
Expand Down Expand Up @@ -148,8 +148,8 @@ def forward(self, *features):
)
dense_x[f"x_{depth_idx}_{dense_l_i}"] = self.blocks[
f"x_{depth_idx}_{dense_l_i}"
](dense_x[f"x_{depth_idx}_{dense_l_i-1}"], cat_features)
](dense_x[f"x_{depth_idx}_{dense_l_i - 1}"], cat_features)
dense_x[f"x_{0}_{self.depth}"] = self.blocks[f"x_{0}_{self.depth}"](
dense_x[f"x_{0}_{self.depth-1}"]
dense_x[f"x_{0}_{self.depth - 1}"]
)
return dense_x[f"x_{0}_{self.depth}"]
6 changes: 3 additions & 3 deletions segmentation_models_pytorch/encoders/mix_transformer.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,9 @@ def __init__(
sr_ratio=1,
):
super().__init__()
assert (
dim % num_heads == 0
), f"dim {dim} should be divided by num_heads {num_heads}."
assert dim % num_heads == 0, (
f"dim {dim} should be divided by num_heads {num_heads}."
)

self.dim = dim
self.num_heads = num_heads
Expand Down
4 changes: 1 addition & 3 deletions segmentation_models_pytorch/encoders/mobileone.py
Original file line number Diff line number Diff line change
Expand Up @@ -381,9 +381,7 @@ def _make_stage(
for ix, stride in enumerate(strides):
use_se = False
if num_se_blocks > num_blocks:
raise ValueError(
"Number of SE blocks cannot " "exceed number of layers."
)
raise ValueError("Number of SE blocks cannot exceed number of layers.")
if ix >= (num_blocks - num_se_blocks):
use_se = True

Expand Down
6 changes: 3 additions & 3 deletions segmentation_models_pytorch/losses/dice.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ def __init__(
super(DiceLoss, self).__init__()
self.mode = mode
if classes is not None:
assert (
mode != BINARY_MODE
), "Masking classes is not supported with mode=binary"
assert mode != BINARY_MODE, (
"Masking classes is not supported with mode=binary"
)
classes = to_tensor(classes, dtype=torch.long)

self.classes = classes
Expand Down
6 changes: 3 additions & 3 deletions segmentation_models_pytorch/losses/jaccard.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ def __init__(

self.mode = mode
if classes is not None:
assert (
mode != BINARY_MODE
), "Masking classes is not supported with mode=binary"
assert mode != BINARY_MODE, (
"Masking classes is not supported with mode=binary"
)
classes = to_tensor(classes, dtype=torch.long)

self.classes = classes
Expand Down
4 changes: 2 additions & 2 deletions tests/encoders/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,12 +127,12 @@ def test_depth(self):
self.assertEqual(
height_strides,
self.output_strides[: depth + 1],
f"Encoder `{encoder_name}` should have output strides {self.output_strides[:depth + 1]}, but has {height_strides}",
f"Encoder `{encoder_name}` should have output strides {self.output_strides[: depth + 1]}, but has {height_strides}",
)
self.assertEqual(
width_strides,
self.output_strides[: depth + 1],
f"Encoder `{encoder_name}` should have output strides {self.output_strides[:depth + 1]}, but has {width_strides}",
f"Encoder `{encoder_name}` should have output strides {self.output_strides[: depth + 1]}, but has {width_strides}",
)

# check encoder output stride property
Expand Down

0 comments on commit eaf8be6

Please sign in to comment.