Skip to content

Commit a7f01eb

Browse files
[pre-commit.ci] pre-commit autoupdate (#434)
* [pre-commit.ci] pre-commit autoupdate updates: - [github.com/pre-commit/pre-commit-hooks: v4.4.0 → v4.5.0](pre-commit/pre-commit-hooks@v4.4.0...v4.5.0) - [github.com/psf/black: 23.3.0 → 24.2.0](psf/black@23.3.0...24.2.0) - https://github.com/charliermarsh/ruff-pre-commithttps://github.com/astral-sh/ruff-pre-commit - [github.com/astral-sh/ruff-pre-commit: v0.0.269 → v0.2.1](astral-sh/ruff-pre-commit@v0.0.269...v0.2.1) - [github.com/nbQA-dev/nbQA: 1.7.0 → 1.7.1](nbQA-dev/nbQA@1.7.0...1.7.1) - [github.com/pre-commit/mirrors-mypy: v1.3.0 → v1.8.0](pre-commit/mirrors-mypy@v1.3.0...v1.8.0) * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Pre commit fixes --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Bas Nijholt <[email protected]>
1 parent cfe628a commit a7f01eb

File tree

7 files changed

+30
-24
lines changed

7 files changed

+30
-24
lines changed

.pre-commit-config.yaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
repos:
22
- repo: https://github.com/pre-commit/pre-commit-hooks
3-
rev: v4.4.0
3+
rev: v4.5.0
44
hooks:
55
- id: trailing-whitespace
66
- id: end-of-file-fixer
@@ -9,24 +9,24 @@ repos:
99
- id: debug-statements
1010
- id: check-ast
1111
- repo: https://github.com/psf/black
12-
rev: 23.3.0
12+
rev: 24.2.0
1313
hooks:
1414
- id: black-jupyter
15-
- repo: https://github.com/charliermarsh/ruff-pre-commit
16-
rev: "v0.0.269"
15+
- repo: https://github.com/astral-sh/ruff-pre-commit
16+
rev: "v0.2.1"
1717
hooks:
1818
- id: ruff
1919
args: ["--fix"]
2020
- repo: https://github.com/nbQA-dev/nbQA
21-
rev: 1.7.0
21+
rev: 1.7.1
2222
hooks:
2323
- id: nbqa-black
2424
additional_dependencies: [jupytext, black]
2525
- id: nbqa
2626
args: ["ruff", "--fix", "--ignore=E402,B018,F704"]
2727
additional_dependencies: [jupytext, ruff]
2828
- repo: https://github.com/pre-commit/mirrors-mypy
29-
rev: "v1.3.0"
29+
rev: "v1.8.0"
3030
hooks:
3131
- id: mypy
3232
exclude: ipynb_filter.py|docs/source/conf.py

adaptive/learner/average_learner1D.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,9 @@ def __init__(
7979
self,
8080
function: Callable[[tuple[int, Real]], Real],
8181
bounds: tuple[Real, Real],
82-
loss_per_interval: None
83-
| (Callable[[Sequence[Real], Sequence[Real]], float]) = None,
82+
loss_per_interval: None | (
83+
Callable[[Sequence[Real], Sequence[Real]], float]
84+
) = None,
8485
delta: float = 0.2,
8586
alpha: float = 0.005,
8687
neighbor_sampling: float = 0.3,
@@ -310,7 +311,7 @@ def _ask_for_new_point(self, n: int) -> tuple[Points, list[float]]:
310311
new point, since in general n << min_samples and this point will need
311312
to be resampled many more times"""
312313
points, (loss_improvement,) = self._ask_points_without_adding(1)
313-
seed_points = [(seed, x) for seed, x in zip(range(n), n * points)]
314+
seed_points = list(zip(range(n), n * points))
314315
loss_improvements = [loss_improvement / n] * n
315316
return seed_points, loss_improvements # type: ignore[return-value]
316317

adaptive/learner/integrator_learner.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@ class DivergentIntegralError(ValueError):
7171

7272

7373
class _Interval:
74-
7574
"""
7675
Attributes
7776
----------

adaptive/learner/learner1D.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ def triangle_loss(xs: XsType1, ys: YsType1) -> Float:
135135
pts = [(x, *y) for x, y in zip(xs, ys)] # type: ignore[misc]
136136
vol = simplex_volume_in_embedding
137137
else:
138-
pts = [(x, y) for x, y in zip(xs, ys)]
138+
pts = list(zip(xs, ys))
139139
vol = volume
140140
return sum(vol(pts[i : i + 3]) for i in range(N)) / N
141141

@@ -633,10 +633,12 @@ def tell_pending(self, x: float) -> None:
633633
def tell_many(
634634
self,
635635
xs: Sequence[Float] | np.ndarray,
636-
ys: Sequence[Float]
637-
| Sequence[Sequence[Float]]
638-
| Sequence[np.ndarray]
639-
| np.ndarray,
636+
ys: (
637+
Sequence[Float]
638+
| Sequence[Sequence[Float]]
639+
| Sequence[np.ndarray]
640+
| np.ndarray
641+
),
640642
*,
641643
force: bool = False,
642644
) -> None:

adaptive/learner/learnerND.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -987,9 +987,11 @@ def plot_slice(self, cut_mapping, n=None):
987987
xs = ys = np.linspace(0, 1, n)
988988
xys = [xs[:, None], ys[None, :]]
989989
values = [
990-
cut_mapping[i]
991-
if i in cut_mapping
992-
else xys.pop(0) * (b[1] - b[0]) + b[0]
990+
(
991+
cut_mapping[i]
992+
if i in cut_mapping
993+
else xys.pop(0) * (b[1] - b[0]) + b[0]
994+
)
993995
for i, b in enumerate(self._bbox)
994996
]
995997

adaptive/runner.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -470,7 +470,7 @@ def __init__(
470470
npoints_goal: int | None = None,
471471
end_time_goal: datetime | None = None,
472472
duration_goal: timedelta | int | float | None = None,
473-
executor: (ExecutorTypes | None) = None,
473+
executor: ExecutorTypes | None = None,
474474
ntasks: int | None = None,
475475
log: bool = False,
476476
shutdown_executor: bool = False,
@@ -629,7 +629,7 @@ def __init__(
629629
npoints_goal: int | None = None,
630630
end_time_goal: datetime | None = None,
631631
duration_goal: timedelta | int | float | None = None,
632-
executor: (ExecutorTypes | None) = None,
632+
executor: ExecutorTypes | None = None,
633633
ntasks: int | None = None,
634634
log: bool = False,
635635
shutdown_executor: bool = False,
@@ -956,7 +956,7 @@ def _ensure_executor(executor: ExecutorTypes | None) -> concurrent.Executor:
956956

957957

958958
def _get_ncores(
959-
ex: (ExecutorTypes),
959+
ex: ExecutorTypes,
960960
) -> int:
961961
"""Return the maximum number of cores that an executor can use."""
962962
if with_ipyparallel:

pyproject.toml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,8 @@ python_version = "3.9"
9797
[tool.ruff]
9898
line-length = 150
9999
target-version = "py39"
100+
101+
[tool.ruff.lint]
100102
select = ["B", "C", "E", "F", "W", "T", "B9", "I", "UP"]
101103
ignore = [
102104
"T20", # flake8-print
@@ -109,14 +111,14 @@ ignore = [
109111
"D401", # First line of docstring should be in imperative mood
110112
]
111113

114+
[tool.ruff.lint.mccabe]
115+
max-complexity = 18
116+
112117
[tool.ruff.per-file-ignores]
113118
"tests/*" = ["SLF001"]
114119
"ci/*" = ["INP001"]
115120
"tests/test_examples.py" = ["E501"]
116121

117-
[tool.ruff.mccabe]
118-
max-complexity = 18
119-
120122
[tool.versioningit]
121123

122124
[tool.versioningit.vcs]

0 commit comments

Comments
 (0)