Skip to content

Commit 73ba3ae

Browse files
committed
Appease the new version of ruff
1 parent 41c98e5 commit 73ba3ae

File tree

5 files changed

+8
-8
lines changed

5 files changed

+8
-8
lines changed

bayes_opt/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@
1515

1616

1717
__all__ = [
18-
"acquisition",
1918
"BayesianOptimization",
20-
"TargetSpace",
2119
"ConstraintModel",
2220
"ScreenLogger",
2321
"SequentialDomainReductionTransformer",
22+
"TargetSpace",
23+
"acquisition",
2424
]

bayes_opt/constraint.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ def approx(self, X: NDArray[Float]) -> NDArray[Float]:
240240
return self._model[0].predict(X).reshape(X_shape[:-1])
241241

242242
result = np.column_stack([gp.predict(X) for gp in self._model])
243-
return result.reshape(X_shape[:-1] + (len(self._lb),))
243+
return result.reshape(*X_shape[:-1], len(self._lb))
244244

245245
def allowed(self, constraint_values: NDArray[Float]) -> NDArray[np.bool_]:
246246
"""Check whether `constraint_values` fulfills the specified limits.

bayes_opt/exception.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44

55
__all__ = [
66
"BayesianOptimizationError",
7-
"NotUniqueError",
87
"ConstraintNotSupportedError",
98
"NoValidPointRegisteredError",
9+
"NotUniqueError",
1010
"TargetSpaceEmptyError",
1111
]
1212

tests/test_seq_domain_red.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,14 +156,14 @@ def verify_bounds_in_range(new_bounds, global_bounds):
156156

157157
# test if both (upper/lower) bounds for a parameter exceed the global bounds
158158
new_bounds = np.array([[-50, -20], [20, 50]])
159-
with pytest.warns(UserWarning):
159+
with pytest.warns(UserWarning, match="A parameter's lower bound is greater than the global upper bound"):
160160
trimmed_bounds = bounds_transformer._trim(new_bounds, global_bounds)
161161
assert verify_bounds_in_range(trimmed_bounds, global_bounds)
162162

163163
# test if both (upper/lower) bounds for a parameter exceed the global bounds
164164
# while they are out of order
165165
new_bounds = np.array([[-20, -50], [-10, 10]])
166-
with pytest.warns(UserWarning):
166+
with pytest.warns(UserWarning, match="A parameter's lower bound is greater than the global upper bound"):
167167
trimmed_bounds = bounds_transformer._trim(new_bounds, global_bounds)
168168
assert verify_bounds_in_range(trimmed_bounds, global_bounds)
169169

tests/test_target_space.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ def test_register_point_beyond_bounds():
125125
PBOUNDS = {"p1": (0, 1), "p2": (1, 10)}
126126
space = TargetSpace(target_func, PBOUNDS)
127127

128-
with pytest.warns(UserWarning):
128+
with pytest.warns(UserWarning, match="is outside the bounds of the parameter"):
129129
space.register(params={"p1": 0.5, "p2": 20}, target=2.5)
130130

131131

@@ -209,7 +209,7 @@ def test_y_max_within_pbounds():
209209
assert space._target_max() is None
210210
space.probe(params={"p1": 1, "p2": 2})
211211
space.probe(params={"p1": 0, "p2": 1})
212-
with pytest.warns(UserWarning):
212+
with pytest.warns(UserWarning, match="is outside the bounds of the parameter"):
213213
space.probe(params={"p1": 5, "p2": 1})
214214
assert space._target_max() == 3
215215

0 commit comments

Comments
 (0)