Skip to content

Commit c753b23

Browse files
authored
Merge pull request numpy#18909 from BvB93/placeholder_main3
ENH: Improve the placeholder annotations within sub-modules (part 3)
2 parents f693864 + 695df25 commit c753b23

File tree

13 files changed

+1237
-232
lines changed

13 files changed

+1237
-232
lines changed

numpy/ma/__init__.pyi

Lines changed: 227 additions & 224 deletions
Large diffs are not rendered by default.

numpy/ma/core.pyi

Lines changed: 468 additions & 0 deletions
Large diffs are not rendered by default.

numpy/ma/extras.pyi

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
from typing import Any, List
2+
from numpy.lib.index_tricks import AxisConcatenator
3+
4+
from numpy.ma.core import (
5+
dot as dot,
6+
mask_rowcols as mask_rowcols,
7+
)
8+
9+
__all__: List[str]
10+
11+
def count_masked(arr, axis=...): ...
12+
def masked_all(shape, dtype = ...): ...
13+
def masked_all_like(arr): ...
14+
15+
class _fromnxfunction:
16+
__name__: Any
17+
__doc__: Any
18+
def __init__(self, funcname): ...
19+
def getdoc(self): ...
20+
def __call__(self, *args, **params): ...
21+
22+
class _fromnxfunction_single(_fromnxfunction):
23+
def __call__(self, x, *args, **params): ...
24+
25+
class _fromnxfunction_seq(_fromnxfunction):
26+
def __call__(self, x, *args, **params): ...
27+
28+
class _fromnxfunction_allargs(_fromnxfunction):
29+
def __call__(self, *args, **params): ...
30+
31+
atleast_1d: _fromnxfunction_allargs
32+
atleast_2d: _fromnxfunction_allargs
33+
atleast_3d: _fromnxfunction_allargs
34+
35+
vstack: _fromnxfunction_seq
36+
row_stack: _fromnxfunction_seq
37+
hstack: _fromnxfunction_seq
38+
column_stack: _fromnxfunction_seq
39+
dstack: _fromnxfunction_seq
40+
stack: _fromnxfunction_seq
41+
42+
hsplit: _fromnxfunction_single
43+
diagflat: _fromnxfunction_single
44+
45+
def apply_along_axis(func1d, axis, arr, *args, **kwargs): ...
46+
def apply_over_axes(func, a, axes): ...
47+
def average(a, axis=..., weights=..., returned=...): ...
48+
def median(a, axis=..., out=..., overwrite_input=..., keepdims=...): ...
49+
def compress_nd(x, axis=...): ...
50+
def compress_rowcols(x, axis=...): ...
51+
def compress_rows(a): ...
52+
def compress_cols(a): ...
53+
def mask_rows(a, axis = ...): ...
54+
def mask_cols(a, axis = ...): ...
55+
def ediff1d(arr, to_end=..., to_begin=...): ...
56+
def unique(ar1, return_index=..., return_inverse=...): ...
57+
def intersect1d(ar1, ar2, assume_unique=...): ...
58+
def setxor1d(ar1, ar2, assume_unique=...): ...
59+
def in1d(ar1, ar2, assume_unique=..., invert=...): ...
60+
def isin(element, test_elements, assume_unique=..., invert=...): ...
61+
def union1d(ar1, ar2): ...
62+
def setdiff1d(ar1, ar2, assume_unique=...): ...
63+
def cov(x, y=..., rowvar=..., bias=..., allow_masked=..., ddof=...): ...
64+
def corrcoef(x, y=..., rowvar=..., bias = ..., allow_masked=..., ddof = ...): ...
65+
66+
class MAxisConcatenator(AxisConcatenator):
67+
concatenate: Any
68+
@classmethod
69+
def makemat(cls, arr): ...
70+
def __getitem__(self, key): ...
71+
72+
class mr_class(MAxisConcatenator):
73+
def __init__(self): ...
74+
75+
mr_: mr_class
76+
77+
def flatnotmasked_edges(a): ...
78+
def notmasked_edges(a, axis=...): ...
79+
def flatnotmasked_contiguous(a): ...
80+
def notmasked_contiguous(a, axis=...): ...
81+
def clump_unmasked(a): ...
82+
def clump_masked(a): ...
83+
def vander(x, n=...): ...
84+
def polyfit(x, y, deg, rcond=..., full=..., w=..., cov=...): ...

numpy/ma/mrecords.pyi

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
from typing import List, Any, TypeVar
2+
3+
from numpy import dtype
4+
from numpy.ma import MaskedArray
5+
6+
__all__: List[str]
7+
8+
# TODO: Set the `bound` to something more suitable once we
9+
# have proper shape support
10+
_ShapeType = TypeVar("_ShapeType", bound=Any)
11+
_DType_co = TypeVar("_DType_co", bound=dtype[Any], covariant=True)
12+
13+
class MaskedRecords(MaskedArray[_ShapeType, _DType_co]):
14+
def __new__(
15+
cls,
16+
shape,
17+
dtype=...,
18+
buf=...,
19+
offset=...,
20+
strides=...,
21+
formats=...,
22+
names=...,
23+
titles=...,
24+
byteorder=...,
25+
aligned=...,
26+
mask=...,
27+
hard_mask=...,
28+
fill_value=...,
29+
keep_mask=...,
30+
copy=...,
31+
**options,
32+
): ...
33+
_mask: Any
34+
_fill_value: Any
35+
@property
36+
def _data(self): ...
37+
@property
38+
def _fieldmask(self): ...
39+
def __array_finalize__(self, obj): ...
40+
def __len__(self): ...
41+
def __getattribute__(self, attr): ...
42+
def __setattr__(self, attr, val): ...
43+
def __getitem__(self, indx): ...
44+
def __setitem__(self, indx, value): ...
45+
def view(self, dtype=..., type=...): ...
46+
def harden_mask(self): ...
47+
def soften_mask(self): ...
48+
def copy(self): ...
49+
def tolist(self, fill_value=...): ...
50+
def __reduce__(self): ...
51+
52+
mrecarray = MaskedRecords
53+
54+
def fromarrays(
55+
arraylist,
56+
dtype=...,
57+
shape=...,
58+
formats=...,
59+
names=...,
60+
titles=...,
61+
aligned=...,
62+
byteorder=...,
63+
fill_value=...,
64+
): ...
65+
66+
def fromrecords(
67+
reclist,
68+
dtype=...,
69+
shape=...,
70+
formats=...,
71+
names=...,
72+
titles=...,
73+
aligned=...,
74+
byteorder=...,
75+
fill_value=...,
76+
mask=...,
77+
): ...
78+
79+
def fromtextfile(
80+
fname,
81+
delimitor=...,
82+
commentchar=...,
83+
missingchar=...,
84+
varnames=...,
85+
vartypes=...,
86+
): ...
87+
88+
def addfield(mrecord, newfield, newfieldname=...): ...

numpy/polynomial/__init__.pyi

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from typing import Any, List
1+
from typing import List
22

33
from numpy.polynomial import (
44
chebyshev as chebyshev,
@@ -8,13 +8,13 @@ from numpy.polynomial import (
88
legendre as legendre,
99
polynomial as polynomial,
1010
)
11+
from numpy.polynomial.chebyshev import Chebyshev as Chebyshev
12+
from numpy.polynomial.hermite import Hermite as Hermite
13+
from numpy.polynomial.hermite_e import HermiteE as HermiteE
14+
from numpy.polynomial.laguerre import Laguerre as Laguerre
15+
from numpy.polynomial.legendre import Legendre as Legendre
16+
from numpy.polynomial.polynomial import Polynomial as Polynomial
1117

1218
__all__: List[str]
1319

14-
Polynomial: Any
15-
Chebyshev: Any
16-
Legendre: Any
17-
Hermite: Any
18-
HermiteE: Any
19-
Laguerre: Any
20-
set_default_printstyle: Any
20+
def set_default_printstyle(style): ...

numpy/polynomial/_polybase.pyi

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
import abc
2+
from typing import Any, List, ClassVar
3+
4+
__all__: List[str]
5+
6+
class ABCPolyBase(abc.ABC):
7+
__hash__: ClassVar[None] # type: ignore[assignment]
8+
__array_ufunc__: ClassVar[None]
9+
maxpower: ClassVar[int]
10+
coef: Any
11+
@property
12+
@abc.abstractmethod
13+
def domain(self): ...
14+
@property
15+
@abc.abstractmethod
16+
def window(self): ...
17+
@property
18+
@abc.abstractmethod
19+
def basis_name(self): ...
20+
def has_samecoef(self, other): ...
21+
def has_samedomain(self, other): ...
22+
def has_samewindow(self, other): ...
23+
def has_sametype(self, other): ...
24+
def __init__(self, coef, domain=..., window=...): ...
25+
def __format__(self, fmt_str): ...
26+
def __call__(self, arg): ...
27+
def __iter__(self): ...
28+
def __len__(self): ...
29+
def __neg__(self): ...
30+
def __pos__(self): ...
31+
def __add__(self, other): ...
32+
def __sub__(self, other): ...
33+
def __mul__(self, other): ...
34+
def __truediv__(self, other): ...
35+
def __floordiv__(self, other): ...
36+
def __mod__(self, other): ...
37+
def __divmod__(self, other): ...
38+
def __pow__(self, other): ...
39+
def __radd__(self, other): ...
40+
def __rsub__(self, other): ...
41+
def __rmul__(self, other): ...
42+
def __rdiv__(self, other): ...
43+
def __rtruediv__(self, other): ...
44+
def __rfloordiv__(self, other): ...
45+
def __rmod__(self, other): ...
46+
def __rdivmod__(self, other): ...
47+
def __eq__(self, other): ...
48+
def __ne__(self, other): ...
49+
def copy(self): ...
50+
def degree(self): ...
51+
def cutdeg(self, deg): ...
52+
def trim(self, tol=...): ...
53+
def truncate(self, size): ...
54+
def convert(self, domain=..., kind=..., window=...): ...
55+
def mapparms(self): ...
56+
def integ(self, m=..., k = ..., lbnd=...): ...
57+
def deriv(self, m=...): ...
58+
def roots(self): ...
59+
def linspace(self, n=..., domain=...): ...
60+
@classmethod
61+
def fit(cls, x, y, deg, domain=..., rcond=..., full=..., w=..., window=...): ...
62+
@classmethod
63+
def fromroots(cls, roots, domain = ..., window=...): ...
64+
@classmethod
65+
def identity(cls, domain=..., window=...): ...
66+
@classmethod
67+
def basis(cls, deg, domain=..., window=...): ...
68+
@classmethod
69+
def cast(cls, series, domain=..., window=...): ...

numpy/polynomial/chebyshev.pyi

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
from typing import Any, List
2+
3+
from numpy import ndarray, dtype, int_
4+
from numpy.polynomial._polybase import ABCPolyBase
5+
from numpy.polynomial.polyutils import trimcoef
6+
7+
__all__: List[str]
8+
9+
chebtrim = trimcoef
10+
11+
def poly2cheb(pol): ...
12+
def cheb2poly(c): ...
13+
14+
chebdomain: ndarray[Any, dtype[int_]]
15+
chebzero: ndarray[Any, dtype[int_]]
16+
chebone: ndarray[Any, dtype[int_]]
17+
chebx: ndarray[Any, dtype[int_]]
18+
19+
def chebline(off, scl): ...
20+
def chebfromroots(roots): ...
21+
def chebadd(c1, c2): ...
22+
def chebsub(c1, c2): ...
23+
def chebmulx(c): ...
24+
def chebmul(c1, c2): ...
25+
def chebdiv(c1, c2): ...
26+
def chebpow(c, pow, maxpower=...): ...
27+
def chebder(c, m=..., scl=..., axis=...): ...
28+
def chebint(c, m=..., k = ..., lbnd=..., scl=..., axis=...): ...
29+
def chebval(x, c, tensor=...): ...
30+
def chebval2d(x, y, c): ...
31+
def chebgrid2d(x, y, c): ...
32+
def chebval3d(x, y, z, c): ...
33+
def chebgrid3d(x, y, z, c): ...
34+
def chebvander(x, deg): ...
35+
def chebvander2d(x, y, deg): ...
36+
def chebvander3d(x, y, z, deg): ...
37+
def chebfit(x, y, deg, rcond=..., full=..., w=...): ...
38+
def chebcompanion(c): ...
39+
def chebroots(c): ...
40+
def chebinterpolate(func, deg, args = ...): ...
41+
def chebgauss(deg): ...
42+
def chebweight(x): ...
43+
def chebpts1(npts): ...
44+
def chebpts2(npts): ...
45+
46+
class Chebyshev(ABCPolyBase):
47+
@classmethod
48+
def interpolate(cls, func, deg, domain=..., args = ...): ...
49+
domain: Any
50+
window: Any
51+
basis_name: Any

numpy/polynomial/hermite.pyi

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
from typing import Any, List
2+
3+
from numpy import ndarray, dtype, int_, float_
4+
from numpy.polynomial._polybase import ABCPolyBase
5+
from numpy.polynomial.polyutils import trimcoef
6+
7+
__all__: list[str]
8+
9+
hermtrim = trimcoef
10+
11+
def poly2herm(pol): ...
12+
def herm2poly(c): ...
13+
14+
hermdomain: ndarray[Any, dtype[int_]]
15+
hermzero: ndarray[Any, dtype[int_]]
16+
hermone: ndarray[Any, dtype[int_]]
17+
hermx: ndarray[Any, dtype[float_]]
18+
19+
def hermline(off, scl): ...
20+
def hermfromroots(roots): ...
21+
def hermadd(c1, c2): ...
22+
def hermsub(c1, c2): ...
23+
def hermmulx(c): ...
24+
def hermmul(c1, c2): ...
25+
def hermdiv(c1, c2): ...
26+
def hermpow(c, pow, maxpower=...): ...
27+
def hermder(c, m=..., scl=..., axis=...): ...
28+
def hermint(c, m=..., k = ..., lbnd=..., scl=..., axis=...): ...
29+
def hermval(x, c, tensor=...): ...
30+
def hermval2d(x, y, c): ...
31+
def hermgrid2d(x, y, c): ...
32+
def hermval3d(x, y, z, c): ...
33+
def hermgrid3d(x, y, z, c): ...
34+
def hermvander(x, deg): ...
35+
def hermvander2d(x, y, deg): ...
36+
def hermvander3d(x, y, z, deg): ...
37+
def hermfit(x, y, deg, rcond=..., full=..., w=...): ...
38+
def hermcompanion(c): ...
39+
def hermroots(c): ...
40+
def hermgauss(deg): ...
41+
def hermweight(x): ...
42+
43+
class Hermite(ABCPolyBase):
44+
domain: Any
45+
window: Any
46+
basis_name: Any

0 commit comments

Comments
 (0)