Skip to content

Commit eaf8be6

Browse files
Bump ruff from 0.8.6 to 0.9.0 in /requirements (#1028)
* 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]>
1 parent 850ef14 commit eaf8be6

File tree

8 files changed

+17
-19
lines changed

8 files changed

+17
-19
lines changed

pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ test = [
4343
'pytest',
4444
'pytest-cov',
4545
'pytest-xdist',
46-
'ruff',
46+
'ruff>=0.9',
4747
]
4848

4949
[project.urls]

requirements/test.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ packaging==24.2
22
pytest==8.3.4
33
pytest-xdist==3.6.1
44
pytest-cov==6.0.0
5-
ruff==0.8.6
5+
ruff==0.9.1

segmentation_models_pytorch/decoders/unetplusplus/decoder.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ def __init__(
119119
blocks[f"x_{depth_idx}_{layer_idx}"] = DecoderBlock(
120120
in_ch, skip_ch, out_ch, **kwargs
121121
)
122-
blocks[f"x_{0}_{len(self.in_channels)-1}"] = DecoderBlock(
122+
blocks[f"x_{0}_{len(self.in_channels) - 1}"] = DecoderBlock(
123123
self.in_channels[-1], 0, self.out_channels[-1], **kwargs
124124
)
125125
self.blocks = nn.ModuleDict(blocks)
@@ -148,8 +148,8 @@ def forward(self, *features):
148148
)
149149
dense_x[f"x_{depth_idx}_{dense_l_i}"] = self.blocks[
150150
f"x_{depth_idx}_{dense_l_i}"
151-
](dense_x[f"x_{depth_idx}_{dense_l_i-1}"], cat_features)
151+
](dense_x[f"x_{depth_idx}_{dense_l_i - 1}"], cat_features)
152152
dense_x[f"x_{0}_{self.depth}"] = self.blocks[f"x_{0}_{self.depth}"](
153-
dense_x[f"x_{0}_{self.depth-1}"]
153+
dense_x[f"x_{0}_{self.depth - 1}"]
154154
)
155155
return dense_x[f"x_{0}_{self.depth}"]

segmentation_models_pytorch/encoders/mix_transformer.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,9 @@ def __init__(
8282
sr_ratio=1,
8383
):
8484
super().__init__()
85-
assert (
86-
dim % num_heads == 0
87-
), f"dim {dim} should be divided by num_heads {num_heads}."
85+
assert dim % num_heads == 0, (
86+
f"dim {dim} should be divided by num_heads {num_heads}."
87+
)
8888

8989
self.dim = dim
9090
self.num_heads = num_heads

segmentation_models_pytorch/encoders/mobileone.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -381,9 +381,7 @@ def _make_stage(
381381
for ix, stride in enumerate(strides):
382382
use_se = False
383383
if num_se_blocks > num_blocks:
384-
raise ValueError(
385-
"Number of SE blocks cannot " "exceed number of layers."
386-
)
384+
raise ValueError("Number of SE blocks cannot exceed number of layers.")
387385
if ix >= (num_blocks - num_se_blocks):
388386
use_se = True
389387

segmentation_models_pytorch/losses/dice.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,9 @@ def __init__(
4444
super(DiceLoss, self).__init__()
4545
self.mode = mode
4646
if classes is not None:
47-
assert (
48-
mode != BINARY_MODE
49-
), "Masking classes is not supported with mode=binary"
47+
assert mode != BINARY_MODE, (
48+
"Masking classes is not supported with mode=binary"
49+
)
5050
classes = to_tensor(classes, dtype=torch.long)
5151

5252
self.classes = classes

segmentation_models_pytorch/losses/jaccard.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,9 @@ def __init__(
4343

4444
self.mode = mode
4545
if classes is not None:
46-
assert (
47-
mode != BINARY_MODE
48-
), "Masking classes is not supported with mode=binary"
46+
assert mode != BINARY_MODE, (
47+
"Masking classes is not supported with mode=binary"
48+
)
4949
classes = to_tensor(classes, dtype=torch.long)
5050

5151
self.classes = classes

tests/encoders/base.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -127,12 +127,12 @@ def test_depth(self):
127127
self.assertEqual(
128128
height_strides,
129129
self.output_strides[: depth + 1],
130-
f"Encoder `{encoder_name}` should have output strides {self.output_strides[:depth + 1]}, but has {height_strides}",
130+
f"Encoder `{encoder_name}` should have output strides {self.output_strides[: depth + 1]}, but has {height_strides}",
131131
)
132132
self.assertEqual(
133133
width_strides,
134134
self.output_strides[: depth + 1],
135-
f"Encoder `{encoder_name}` should have output strides {self.output_strides[:depth + 1]}, but has {width_strides}",
135+
f"Encoder `{encoder_name}` should have output strides {self.output_strides[: depth + 1]}, but has {width_strides}",
136136
)
137137

138138
# check encoder output stride property

0 commit comments

Comments
 (0)