Skip to content

Commit 08ddfb2

Browse files
committed
Add type-hints to adaptive/learner/sequence_learner.py
1 parent 2b5e0d1 commit 08ddfb2

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

adaptive/learner/sequence_learner.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from __future__ import annotations
22

33
from copy import copy
4-
from typing import Any, Tuple
4+
from typing import Any, Callable, Iterable, Tuple
55

66
import cloudpickle
77
from sortedcontainers import SortedDict, SortedSet
@@ -37,17 +37,17 @@ class _IgnoreFirstArgument:
3737
pickable.
3838
"""
3939

40-
def __init__(self, function):
41-
self.function = function
40+
def __init__(self, function: Callable) -> None:
41+
self.function = function # type: ignore
4242

4343
def __call__(self, index_point: PointType, *args, **kwargs):
4444
index, point = index_point
4545
return self.function(point, *args, **kwargs)
4646

47-
def __getstate__(self):
47+
def __getstate__(self) -> Callable:
4848
return self.function
4949

50-
def __setstate__(self, function):
50+
def __setstate__(self, function: Callable) -> None:
5151
self.__init__(function)
5252

5353

@@ -78,9 +78,9 @@ class SequenceLearner(BaseLearner):
7878
the added benefit of having results in the local kernel already.
7979
"""
8080

81-
def __init__(self, function, sequence):
81+
def __init__(self, function: Callable, sequence: Iterable) -> None:
8282
self._original_function = function
83-
self.function = _IgnoreFirstArgument(function)
83+
self.function = _IgnoreFirstArgument(function) # type: ignore
8484
self._to_do_indices = SortedSet({i for i, _ in enumerate(sequence)})
8585
self._ntotal = len(sequence)
8686
self.sequence = copy(sequence)

0 commit comments

Comments
 (0)