Skip to content

Commit

Permalink
[pre-commit.ci] pre-commit autoupdate (#434)
Browse files Browse the repository at this point in the history
* [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]>
  • Loading branch information
pre-commit-ci[bot] and basnijholt authored Feb 13, 2024
1 parent cfe628a commit a7f01eb
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 24 deletions.
12 changes: 6 additions & 6 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.4.0
rev: v4.5.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
Expand All @@ -9,24 +9,24 @@ repos:
- id: debug-statements
- id: check-ast
- repo: https://github.com/psf/black
rev: 23.3.0
rev: 24.2.0
hooks:
- id: black-jupyter
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: "v0.0.269"
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: "v0.2.1"
hooks:
- id: ruff
args: ["--fix"]
- repo: https://github.com/nbQA-dev/nbQA
rev: 1.7.0
rev: 1.7.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.3.0"
rev: "v1.8.0"
hooks:
- id: mypy
exclude: ipynb_filter.py|docs/source/conf.py
7 changes: 4 additions & 3 deletions adaptive/learner/average_learner1D.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,9 @@ def __init__(
self,
function: Callable[[tuple[int, Real]], Real],
bounds: tuple[Real, Real],
loss_per_interval: None
| (Callable[[Sequence[Real], Sequence[Real]], float]) = None,
loss_per_interval: None | (
Callable[[Sequence[Real], Sequence[Real]], float]
) = None,
delta: float = 0.2,
alpha: float = 0.005,
neighbor_sampling: float = 0.3,
Expand Down Expand Up @@ -310,7 +311,7 @@ def _ask_for_new_point(self, n: int) -> tuple[Points, list[float]]:
new point, since in general n << min_samples and this point will need
to be resampled many more times"""
points, (loss_improvement,) = self._ask_points_without_adding(1)
seed_points = [(seed, x) for seed, x in zip(range(n), n * points)]
seed_points = list(zip(range(n), n * points))
loss_improvements = [loss_improvement / n] * n
return seed_points, loss_improvements # type: ignore[return-value]

Expand Down
1 change: 0 additions & 1 deletion adaptive/learner/integrator_learner.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ class DivergentIntegralError(ValueError):


class _Interval:

"""
Attributes
----------
Expand Down
12 changes: 7 additions & 5 deletions adaptive/learner/learner1D.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ def triangle_loss(xs: XsType1, ys: YsType1) -> Float:
pts = [(x, *y) for x, y in zip(xs, ys)] # type: ignore[misc]
vol = simplex_volume_in_embedding
else:
pts = [(x, y) for x, y in zip(xs, ys)]
pts = list(zip(xs, ys))
vol = volume
return sum(vol(pts[i : i + 3]) for i in range(N)) / N

Expand Down Expand Up @@ -633,10 +633,12 @@ def tell_pending(self, x: float) -> None:
def tell_many(
self,
xs: Sequence[Float] | np.ndarray,
ys: Sequence[Float]
| Sequence[Sequence[Float]]
| Sequence[np.ndarray]
| np.ndarray,
ys: (
Sequence[Float]
| Sequence[Sequence[Float]]
| Sequence[np.ndarray]
| np.ndarray
),
*,
force: bool = False,
) -> None:
Expand Down
8 changes: 5 additions & 3 deletions adaptive/learner/learnerND.py
Original file line number Diff line number Diff line change
Expand Up @@ -987,9 +987,11 @@ def plot_slice(self, cut_mapping, n=None):
xs = ys = np.linspace(0, 1, n)
xys = [xs[:, None], ys[None, :]]
values = [
cut_mapping[i]
if i in cut_mapping
else xys.pop(0) * (b[1] - b[0]) + b[0]
(
cut_mapping[i]
if i in cut_mapping
else xys.pop(0) * (b[1] - b[0]) + b[0]
)
for i, b in enumerate(self._bbox)
]

Expand Down
6 changes: 3 additions & 3 deletions adaptive/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,7 @@ def __init__(
npoints_goal: int | None = None,
end_time_goal: datetime | None = None,
duration_goal: timedelta | int | float | None = None,
executor: (ExecutorTypes | None) = None,
executor: ExecutorTypes | None = None,
ntasks: int | None = None,
log: bool = False,
shutdown_executor: bool = False,
Expand Down Expand Up @@ -629,7 +629,7 @@ def __init__(
npoints_goal: int | None = None,
end_time_goal: datetime | None = None,
duration_goal: timedelta | int | float | None = None,
executor: (ExecutorTypes | None) = None,
executor: ExecutorTypes | None = None,
ntasks: int | None = None,
log: bool = False,
shutdown_executor: bool = False,
Expand Down Expand Up @@ -956,7 +956,7 @@ def _ensure_executor(executor: ExecutorTypes | None) -> concurrent.Executor:


def _get_ncores(
ex: (ExecutorTypes),
ex: ExecutorTypes,
) -> int:
"""Return the maximum number of cores that an executor can use."""
if with_ipyparallel:
Expand Down
8 changes: 5 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ python_version = "3.9"
[tool.ruff]
line-length = 150
target-version = "py39"

[tool.ruff.lint]
select = ["B", "C", "E", "F", "W", "T", "B9", "I", "UP"]
ignore = [
"T20", # flake8-print
Expand All @@ -109,14 +111,14 @@ ignore = [
"D401", # First line of docstring should be in imperative mood
]

[tool.ruff.lint.mccabe]
max-complexity = 18

[tool.ruff.per-file-ignores]
"tests/*" = ["SLF001"]
"ci/*" = ["INP001"]
"tests/test_examples.py" = ["E501"]

[tool.ruff.mccabe]
max-complexity = 18

[tool.versioningit]

[tool.versioningit.vcs]
Expand Down

0 comments on commit a7f01eb

Please sign in to comment.