Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 85dd772

Browse filesBrowse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent c4ba482 commit 85dd772
Copy full SHA for 85dd772

8 files changed

+12
-22
lines changed

‎adaptive/learner/average_learner1D.py

Copy file name to clipboardExpand all lines: 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

Copy file name to clipboardExpand all lines: 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/learner2D.py

Copy file name to clipboardExpand all lines: adaptive/learner/learner2D.py
+1-1
Original file line numberDiff line numberDiff line change
@@ -451,7 +451,7 @@ def __init__(
451451
self.aspect_ratio = 1
452452

453453
self._bounds_points = list(itertools.product(*bounds))
454-
self._stack.update({p: np.inf for p in self._bounds_points})
454+
self._stack.update(dict.fromkeys(self._bounds_points, np.inf))
455455
self.function = function # type: ignore
456456
self._ip = self._ip_combined = None
457457

‎adaptive/learner/learnerND.py

Copy file name to clipboardExpand all lines: 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

Copy file name to clipboardExpand all lines: 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

Copy file name to clipboardExpand all lines: adaptive/notebook_integration.py
+4-7
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@ def notebook_extension(*, _inline_js=True):
1616
"""Enable ipywidgets, holoviews, and asyncio notebook integration."""
1717
if not in_ipynb():
1818
raise RuntimeError(
19-
'"adaptive.notebook_extension()" may only be run '
20-
"from a Jupyter notebook."
19+
'"adaptive.notebook_extension()" may only be run from a Jupyter notebook.'
2120
)
2221

2322
global _holoviews_enabled, _ipywidgets_enabled
@@ -116,8 +115,7 @@ def live_plot(runner, *, plotter=None, update_interval=2, name=None, normalize=T
116115
"""
117116
if not _holoviews_enabled:
118117
raise RuntimeError(
119-
"Live plotting is not enabled; did you run "
120-
"'adaptive.notebook_extension()'?"
118+
"Live plotting is not enabled; did you run 'adaptive.notebook_extension()'?"
121119
)
122120

123121
import holoviews as hv
@@ -202,8 +200,7 @@ def live_info(runner, *, update_interval=0.5):
202200
"""
203201
if not _holoviews_enabled:
204202
raise RuntimeError(
205-
"Live plotting is not enabled; did you run "
206-
"'adaptive.notebook_extension()'?"
203+
"Live plotting is not enabled; did you run 'adaptive.notebook_extension()'?"
207204
)
208205

209206
import ipywidgets
@@ -268,7 +265,7 @@ def _info_html(runner):
268265
info.append(("# of samples", runner.learner.nsamples))
269266

270267
with suppress(Exception):
271-
info.append(("latest loss", f'{runner.learner._cache["loss"]:.3f}'))
268+
info.append(("latest loss", f"{runner.learner._cache['loss']:.3f}"))
272269

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

‎adaptive/runner.py

Copy file name to clipboardExpand all lines: 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

Copy file name to clipboardExpand all lines: 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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.