Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pre-commit.ci] pre-commit autoupdate #455

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
rev: v5.0.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
Expand All @@ -9,21 +9,21 @@ repos:
- id: debug-statements
- id: check-ast
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: "v0.3.5"
rev: "v0.9.1"
hooks:
- id: ruff
args: ["--fix"]
- id: ruff-format
- repo: https://github.com/nbQA-dev/nbQA
rev: 1.8.5
rev: 1.9.1
hooks:
- id: nbqa-black
additional_dependencies: [jupytext, black]
- id: nbqa
args: ["ruff", "--fix", "--ignore=E402,B018,F704"]
additional_dependencies: [jupytext, ruff]
- repo: https://github.com/pre-commit/mirrors-mypy
rev: "v1.9.0"
rev: "v1.14.1"
hooks:
- id: mypy
exclude: ipynb_filter.py|docs/source/conf.py
6 changes: 2 additions & 4 deletions adaptive/learner/average_learner1D.py
Original file line number Diff line number Diff line change
Expand Up @@ -500,8 +500,7 @@ def tell_many( # type: ignore[override]
# but ignore it going forward.
if not np.prod([x >= self.bounds[0] and x <= self.bounds[1] for _, x in xs]):
raise ValueError(
"x value out of bounds, "
"remove x or enlarge the bounds of the learner"
"x value out of bounds, remove x or enlarge the bounds of the learner"
)

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

# If x is a new point:
Expand Down
4 changes: 1 addition & 3 deletions adaptive/learner/balancing_learner.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,7 @@ def __init__(
self._cdims_default = cdims

if len({learner.__class__ for learner in self.learners}) > 1:
raise TypeError(
"A BalacingLearner can handle only one type" " of learners."
)
raise TypeError("A BalacingLearner can handle only one type of learners.")

self.strategy: STRATEGY_TYPE = strategy

Expand Down
3 changes: 1 addition & 2 deletions adaptive/learner/learnerND.py
Original file line number Diff line number Diff line change
Expand Up @@ -1098,8 +1098,7 @@ def _get_iso(self, level=0.0, which="surface"):
if which == "surface":
if self.ndim != 3 or self.vdim != 1:
raise Exception(
"Isosurface plotting is only supported"
" for a 3D input and 1D output"
"Isosurface plotting is only supported for a 3D input and 1D output"
)
get_surface = True
get_line = False
Expand Down
3 changes: 1 addition & 2 deletions adaptive/learner/triangulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -336,8 +336,7 @@ def __init__(self, coords):
vectors = subtract(coords[1:], coords[0])
if matrix_rank(vectors) < dim:
raise ValueError(
"Initial simplex has zero volumes "
"(the points are linearly dependent)"
"Initial simplex has zero volumes (the points are linearly dependent)"
)

self.vertices = list(coords)
Expand Down
11 changes: 4 additions & 7 deletions adaptive/notebook_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ def notebook_extension(*, _inline_js=True):
"""Enable ipywidgets, holoviews, and asyncio notebook integration."""
if not in_ipynb():
raise RuntimeError(
'"adaptive.notebook_extension()" may only be run '
"from a Jupyter notebook."
'"adaptive.notebook_extension()" may only be run from a Jupyter notebook.'
)

global _async_enabled, _holoviews_enabled, _ipywidgets_enabled
Expand Down Expand Up @@ -122,8 +121,7 @@ def live_plot(runner, *, plotter=None, update_interval=2, name=None, normalize=T
"""
if not _holoviews_enabled:
raise RuntimeError(
"Live plotting is not enabled; did you run "
"'adaptive.notebook_extension()'?"
"Live plotting is not enabled; did you run 'adaptive.notebook_extension()'?"
)

import holoviews as hv
Expand Down Expand Up @@ -208,8 +206,7 @@ def live_info(runner, *, update_interval=0.5):
"""
if not _holoviews_enabled:
raise RuntimeError(
"Live plotting is not enabled; did you run "
"'adaptive.notebook_extension()'?"
"Live plotting is not enabled; did you run 'adaptive.notebook_extension()'?"
)

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

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

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

Expand Down
2 changes: 1 addition & 1 deletion adaptive/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -935,7 +935,7 @@ def _info_text(runner, separator: str = "\n"):
info.append(("# of samples", runner.learner.nsamples))

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

width = 30
formatted_info = [f"{k}: {v}".ljust(width) for i, (k, v) in enumerate(info)]
Expand Down
3 changes: 1 addition & 2 deletions example-notebook.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -489,8 +489,7 @@
" print(\"WARINING: The runner hasn't reached it goal yet!\")\n",
"\n",
"print(\n",
" f\"The integral value is {learner.igral} \"\n",
" f\"with a corresponding error of {learner.err}\"\n",
" f\"The integral value is {learner.igral} with a corresponding error of {learner.err}\"\n",
")\n",
"learner.plot()"
]
Expand Down
Loading