Skip to content

Commit 037b2d4

Browse files
committed
fixes
1 parent 8f65fb8 commit 037b2d4

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

adaptive/learner/base_learner.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ def remove_unfinished(self):
124124
"""Remove uncomputed data from the learner."""
125125

126126
@abc.abstractmethod
127-
def loss(self, real: bool = True):
127+
def loss(self, real: bool = True) -> float:
128128
"""Return the loss for the current state of the learner.
129129
130130
Parameters

adaptive/learner/triangulation.py

+11-4
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,17 @@
2828
from numpy.linalg import det as ndet
2929
from numpy.linalg import matrix_rank, norm, slogdet, solve
3030

31-
SimplexPoints = Union[List[Tuple[float, ...]], ndarray]
32-
Simplex = Union[Sequence[numbers.Integral], ndarray]
33-
Point = Union[Tuple[float, ...], ndarray]
34-
Points = Union[Sequence[Tuple[float, ...]], ndarray]
31+
try:
32+
from typing import TypeAlias
33+
except ImportError:
34+
# Remove this when we drop support for Python 3.9
35+
from typing_extensions import TypeAlias
36+
37+
38+
SimplexPoints: TypeAlias = Union[List[Tuple[float, ...]], ndarray]
39+
Simplex: TypeAlias = Union[Sequence[numbers.Integral], ndarray]
40+
Point: TypeAlias = Union[Tuple[float, ...], ndarray]
41+
Points: TypeAlias = Union[Sequence[Tuple[float, ...]], ndarray]
3542

3643

3744
def fast_norm(v: tuple[float, ...] | ndarray) -> float:

0 commit comments

Comments
 (0)