From 26d2d1d3be3d16b9e7f738dc112a949d5f6a3e8b Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 29 Jan 2024 21:11:28 +0000 Subject: [PATCH] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- adaptive/learner/average_learner1D.py | 5 +++-- adaptive/learner/integrator_learner.py | 1 - adaptive/learner/learner1D.py | 10 ++++++---- adaptive/learner/learnerND.py | 8 +++++--- adaptive/runner.py | 6 +++--- 5 files changed, 17 insertions(+), 13 deletions(-) diff --git a/adaptive/learner/average_learner1D.py b/adaptive/learner/average_learner1D.py index 12c7c9a6c..49e730103 100644 --- a/adaptive/learner/average_learner1D.py +++ b/adaptive/learner/average_learner1D.py @@ -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, diff --git a/adaptive/learner/integrator_learner.py b/adaptive/learner/integrator_learner.py index 74aebe1ca..0fc97df67 100644 --- a/adaptive/learner/integrator_learner.py +++ b/adaptive/learner/integrator_learner.py @@ -71,7 +71,6 @@ class DivergentIntegralError(ValueError): class _Interval: - """ Attributes ---------- diff --git a/adaptive/learner/learner1D.py b/adaptive/learner/learner1D.py index 8385e67b8..a9f96664b 100644 --- a/adaptive/learner/learner1D.py +++ b/adaptive/learner/learner1D.py @@ -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: diff --git a/adaptive/learner/learnerND.py b/adaptive/learner/learnerND.py index edc839d8d..c8eacea2f 100644 --- a/adaptive/learner/learnerND.py +++ b/adaptive/learner/learnerND.py @@ -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) ] diff --git a/adaptive/runner.py b/adaptive/runner.py index 644433516..58abc7139 100644 --- a/adaptive/runner.py +++ b/adaptive/runner.py @@ -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, @@ -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, @@ -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: