Skip to content

Commit 840823f

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent a56df94 commit 840823f

7 files changed

+11
-21
lines changed

adaptive/learner/average_learner1D.py

+2-4
Original file line numberDiff line numberDiff line change
@@ -500,8 +500,7 @@ def tell_many( # type: ignore[override]
500500
# but ignore it going forward.
501501
if not np.prod([x >= self.bounds[0] and x <= self.bounds[1] for _, x in xs]):
502502
raise ValueError(
503-
"x value out of bounds, "
504-
"remove x or enlarge the bounds of the learner"
503+
"x value out of bounds, remove x or enlarge the bounds of the learner"
505504
)
506505

507506
# Create a mapping of points to a list of samples
@@ -534,8 +533,7 @@ def tell_many_at_point(self, x: Real, seed_y_mapping: dict[int, Real]) -> None:
534533
# Check x is within the bounds
535534
if not np.prod(x >= self.bounds[0] and x <= self.bounds[1]):
536535
raise ValueError(
537-
"x value out of bounds, "
538-
"remove x or enlarge the bounds of the learner"
536+
"x value out of bounds, remove x or enlarge the bounds of the learner"
539537
)
540538

541539
# If x is a new point:

adaptive/learner/balancing_learner.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -116,9 +116,7 @@ def __init__(
116116
self._cdims_default = cdims
117117

118118
if len({learner.__class__ for learner in self.learners}) > 1:
119-
raise TypeError(
120-
"A BalacingLearner can handle only one type" " of learners."
121-
)
119+
raise TypeError("A BalacingLearner can handle only one type of learners.")
122120

123121
self.strategy: STRATEGY_TYPE = strategy
124122

adaptive/learner/learnerND.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -1098,8 +1098,7 @@ def _get_iso(self, level=0.0, which="surface"):
10981098
if which == "surface":
10991099
if self.ndim != 3 or self.vdim != 1:
11001100
raise Exception(
1101-
"Isosurface plotting is only supported"
1102-
" for a 3D input and 1D output"
1101+
"Isosurface plotting is only supported for a 3D input and 1D output"
11031102
)
11041103
get_surface = True
11051104
get_line = False

adaptive/learner/triangulation.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -336,8 +336,7 @@ def __init__(self, coords):
336336
vectors = subtract(coords[1:], coords[0])
337337
if matrix_rank(vectors) < dim:
338338
raise ValueError(
339-
"Initial simplex has zero volumes "
340-
"(the points are linearly dependent)"
339+
"Initial simplex has zero volumes (the points are linearly dependent)"
341340
)
342341

343342
self.vertices = list(coords)

adaptive/notebook_integration.py

+4-7
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@ def notebook_extension(*, _inline_js=True):
1717
"""Enable ipywidgets, holoviews, and asyncio notebook integration."""
1818
if not in_ipynb():
1919
raise RuntimeError(
20-
'"adaptive.notebook_extension()" may only be run '
21-
"from a Jupyter notebook."
20+
'"adaptive.notebook_extension()" may only be run from a Jupyter notebook.'
2221
)
2322

2423
global _async_enabled, _holoviews_enabled, _ipywidgets_enabled
@@ -122,8 +121,7 @@ def live_plot(runner, *, plotter=None, update_interval=2, name=None, normalize=T
122121
"""
123122
if not _holoviews_enabled:
124123
raise RuntimeError(
125-
"Live plotting is not enabled; did you run "
126-
"'adaptive.notebook_extension()'?"
124+
"Live plotting is not enabled; did you run 'adaptive.notebook_extension()'?"
127125
)
128126

129127
import holoviews as hv
@@ -208,8 +206,7 @@ def live_info(runner, *, update_interval=0.5):
208206
"""
209207
if not _holoviews_enabled:
210208
raise RuntimeError(
211-
"Live plotting is not enabled; did you run "
212-
"'adaptive.notebook_extension()'?"
209+
"Live plotting is not enabled; did you run 'adaptive.notebook_extension()'?"
213210
)
214211

215212
import ipywidgets
@@ -274,7 +271,7 @@ def _info_html(runner):
274271
info.append(("# of samples", runner.learner.nsamples))
275272

276273
with suppress(Exception):
277-
info.append(("latest loss", f'{runner.learner._cache["loss"]:.3f}'))
274+
info.append(("latest loss", f"{runner.learner._cache['loss']:.3f}"))
278275

279276
table = "\n".join(_table_row(i, k, v) for i, (k, v) in enumerate(info))
280277

adaptive/runner.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -935,7 +935,7 @@ def _info_text(runner, separator: str = "\n"):
935935
info.append(("# of samples", runner.learner.nsamples))
936936

937937
with suppress(Exception):
938-
info.append(("latest loss", f'{runner.learner._cache["loss"]:.3f}'))
938+
info.append(("latest loss", f"{runner.learner._cache['loss']:.3f}"))
939939

940940
width = 30
941941
formatted_info = [f"{k}: {v}".ljust(width) for i, (k, v) in enumerate(info)]

example-notebook.ipynb

+1-2
Original file line numberDiff line numberDiff line change
@@ -489,8 +489,7 @@
489489
" print(\"WARINING: The runner hasn't reached it goal yet!\")\n",
490490
"\n",
491491
"print(\n",
492-
" f\"The integral value is {learner.igral} \"\n",
493-
" f\"with a corresponding error of {learner.err}\"\n",
492+
" f\"The integral value is {learner.igral} with a corresponding error of {learner.err}\"\n",
494493
")\n",
495494
"learner.plot()"
496495
]

0 commit comments

Comments
 (0)