-
Notifications
You must be signed in to change notification settings - Fork 62
/
Copy path_base.py
54 lines (39 loc) · 1.2 KB
/
_base.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
"""Common types."""
from typing import Optional, Sequence, Tuple, TypeVar, Union
import numpy as np
from typing_extensions import Protocol
from ._numpy import ArrayLike, NDArrayFloat
VectorType = TypeVar("VectorType")
DomainRange = Tuple[Tuple[float, float], ...]
DomainRangeLike = Union[
DomainRange,
Sequence[float],
Sequence[Sequence[float]],
]
LabelTuple = Tuple[Optional[str], ...]
LabelTupleLike = Sequence[Optional[str]]
GridPoints = Tuple[NDArrayFloat, ...]
GridPointsLike = Union[ArrayLike, Sequence[ArrayLike]]
EvaluationPoints = NDArrayFloat
RandomStateLike = Union[int, np.random.RandomState, np.random.Generator, None]
RandomState = Union[np.random.RandomState, np.random.Generator]
class Vector(Protocol):
"""
Protocol representing a generic vector.
It should accept numpy arrays and FData, among other things.
"""
def __add__(
self: VectorType,
__other: VectorType, # noqa: WPS112
) -> VectorType:
pass
def __sub__(
self: VectorType,
__other: VectorType, # noqa: WPS112
) -> VectorType:
pass
def __mul__(
self: VectorType,
__other: float, # noqa: WPS112
) -> VectorType:
pass