Skip to content

Commit 8a74946

Browse files
committed
adaptation to new ruff version
1 parent c14eaa0 commit 8a74946

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

moptipy/algorithms/so/ea.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -184,32 +184,32 @@ def __init__(self, op0: Op0,
184184
op1 = Op1()
185185
if br is None:
186186
br = 1.0
187-
elif br != 1.0:
187+
elif br != 1.0: # noqa: RUF069
188188
raise ValueError(
189189
f"if op1==None, br must be None or 1.0, but is {br}.")
190190
elif op1.__class__ is Op1:
191191
if br is None:
192192
br = 1.0
193-
elif br != 1.0:
193+
elif br != 1.0: # noqa: RUF069
194194
raise ValueError(
195195
f"if op1 is Op1, br must be None or 1.0, but is {br}.")
196-
elif (br is not None) and (br == 1.0):
196+
elif (br is not None) and (br == 1.0): # noqa: RUF069
197197
op1 = Op1()
198198

199199
if op2 is None:
200200
op2 = Op2()
201201
if br is None:
202202
br = 0.0
203-
elif br != 0.0:
203+
elif br != 0.0: # noqa: RUF069
204204
raise ValueError(
205205
f"if op2==None, br must be None or 0.0, but is {br}.")
206206
elif op2.__class__ is Op2:
207207
if br is None:
208208
br = 0.0
209-
elif br != 0.0:
209+
elif br != 0.0: # noqa: RUF069
210210
raise ValueError(
211211
f"if op2 is Op2, br must be None or 0.0, but is {br}.")
212-
elif (br is not None) and (br == 0.0):
212+
elif (br is not None) and (br == 0.0): # noqa: RUF069
213213
op2 = Op2()
214214
elif (mu == 1) and (br is None):
215215
br = 0.0

moptipy/algorithms/so/ppa.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ def __init__(self, op0: Op0, op1: Op1WithStepSize, m: int = 30,
305305
self.max_step: Final[float] = max_step
306306

307307
name = f"{name}{PART_SEPARATOR}{m}{PART_SEPARATOR}{nmax}"
308-
if max_step != 1.0:
308+
if max_step != 1.0: # noqa: RUF069
309309
name = f"{name}{PART_SEPARATOR}{num_to_str_for_name(max_step)}"
310310
super().__init__(name, op0, op1)
311311

tests/spaces/test_vectorspace.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ def test_vector_space_1() -> None:
2020
assert str(space) == "r12d"
2121
assert space.lower_bound_all_same
2222
assert space.upper_bound_all_same
23-
assert all(space.lower_bound == 0.0)
24-
assert all(space.upper_bound == 1.0)
23+
assert all(space.lower_bound == 0.0) # noqa: RUF069
24+
assert all(space.upper_bound == 1.0) # noqa: RUF069
2525

2626
a = space.create()
2727
assert isinstance(a, np.ndarray)
@@ -79,7 +79,7 @@ def test_vector_space_2() -> None:
7979
assert str(space) == "r3d"
8080
assert not space.lower_bound_all_same
8181
assert space.upper_bound_all_same
82-
assert all(space.upper_bound == 4.0)
82+
assert all(space.upper_bound == 4.0) # noqa: RUF069
8383
assert all(space.lower_bound == np.array([1.0, 2.0, 3.0]))
8484

8585
a = space.create()
@@ -139,7 +139,7 @@ def test_vector_space_3() -> None:
139139
assert str(space) == "r3d"
140140
assert space.lower_bound_all_same
141141
assert not space.upper_bound_all_same
142-
assert all(space.lower_bound == -1.0)
142+
assert all(space.lower_bound == -1.0) # noqa: RUF069
143143
assert all(space.upper_bound == np.array([4.0, 2.3, 7.0]))
144144

145145
a = space.create()

0 commit comments

Comments
 (0)