Skip to content

Commit cda896c

Browse files
committed
type hint fixes for adaptive/tests/algorithm_4.py
1 parent cab1aa7 commit cda896c

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

adaptive/tests/algorithm_4.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
from collections import defaultdict
55
from fractions import Fraction
6-
from functools import partial
76
from typing import Callable, List, Tuple, Union
87

98
import numpy as np
@@ -247,7 +246,7 @@ def points(self) -> np.ndarray:
247246

248247
@classmethod
249248
def make_first(
250-
cls, f: Union[partial, Callable], a: int, b: int, depth: int = 2
249+
cls, f: Callable, a: int, b: int, depth: int = 2
251250
) -> Tuple["_Interval", int]:
252251
ival = _Interval(a, b, depth, 1)
253252
fx = f(ival.points())
@@ -269,7 +268,7 @@ def calc_igral_and_err(self, c_old: np.ndarray) -> float:
269268
return c_diff
270269

271270
def split(
272-
self, f: Union[partial, Callable]
271+
self, f: Callable
273272
) -> Union[Tuple[Tuple[float, float, float], int], Tuple[List["_Interval"], int]]:
274273
m = (self.a + self.b) / 2
275274
f_center = self.fx[(len(self.fx) - 1) // 2]
@@ -295,7 +294,7 @@ def split(
295294

296295
return ivals, nr_points
297296

298-
def refine(self, f: Union[partial, Callable]) -> Tuple[np.ndarray, bool, int]:
297+
def refine(self, f: Callable) -> Tuple[np.ndarray, bool, int]:
299298
"""Increase degree of interval."""
300299
self.depth = depth = self.depth + 1
301300
points = self.points()
@@ -308,7 +307,7 @@ def refine(self, f: Union[partial, Callable]) -> Tuple[np.ndarray, bool, int]:
308307

309308

310309
def algorithm_4(
311-
f: Union[partial, Callable], a: int, b: int, tol: float, N_loops: int = int(1e9)
310+
f: Callable, a: int, b: int, tol: float, N_loops: int = int(1e9)
312311
) -> Tuple[float, float, int, List["_Interval"]]:
313312
"""ALGORITHM_4 evaluates an integral using adaptive quadrature. The
314313
algorithm uses Clenshaw-Curtis quadrature rules of increasing

0 commit comments

Comments
 (0)