Skip to content

Commit 57a971c

Browse files
committed
Several fixes
1 parent 52710be commit 57a971c

3 files changed

Lines changed: 10 additions & 9 deletions

File tree

adaptive/_types.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# Only used for static type checkers, should only be imported in `if TYPE_CHECKING` block
22
# Workaround described in https://github.com/agronholm/typeguard/issues/456
3+
34
import concurrent.futures as concurrent
45
from typing import TypeAlias
56

adaptive/learner/learner1D.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -106,18 +106,18 @@ def abs_min_log_loss(xs: XsType0, ys: YsType0) -> Float:
106106
@uses_nth_neighbors(1)
107107
def triangle_loss(xs: XsType1, ys: YsType1) -> Float:
108108
assert len(xs) == 4
109-
xs = [x for x in xs if x is not None] # type: ignore[assignment]
110-
ys = [y for y in ys if y is not None] # type: ignore[assignment]
109+
x = [x for x in xs if x is not None]
110+
y = [y for y in ys if y is not None]
111111

112-
if len(xs) == 2: # we do not have enough points for a triangle
113-
return xs[1] - xs[0] # type: ignore[operator]
112+
if len(x) == 2: # we do not have enough points for a triangle
113+
return x[1] - x[0] # type: ignore[operator]
114114

115-
N = len(xs) - 2 # number of constructed triangles
116-
if isinstance(ys[0], collections.abc.Iterable):
117-
pts = [(x, *y) for x, y in zip(xs, ys)] # type: ignore[misc]
115+
N = len(x) - 2 # number of constructed triangles
116+
if isinstance(y[0], collections.abc.Iterable):
117+
pts = [(x, *y) for x, y in zip(x, y)] # type: ignore[misc]
118118
vol = simplex_volume_in_embedding
119119
else:
120-
pts = list(zip(xs, ys))
120+
pts = list(zip(x, y))
121121
vol = volume
122122
return sum(vol(pts[i : i + 3]) for i in range(N)) / N
123123

adaptive/learner/sequence_learner.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ def remove_unfinished(self) -> None:
134134
self.pending_points = set()
135135

136136
def tell(self, point: PointType, value: Any) -> None:
137-
index, point = point
137+
index, _ = point
138138
self.data[index] = value
139139
self.pending_points.discard(index)
140140
self._to_do_indices.discard(index)

0 commit comments

Comments
 (0)