Skip to content

Commit 64b721b

Browse files
jorenhamcharris
authored andcommitted
TYP: polynomial: accept scalar coef in the poly constructors (#32931)
1 parent 06b7ad2 commit 64b721b

2 files changed

Lines changed: 5 additions & 1 deletion

File tree

‎numpy/polynomial/_polybase.pyi‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ class ABCPolyBase(Generic[_NameT_co], abc.ABC): # noqa: UP046
6161
def __init__(
6262
self,
6363
/,
64-
coef: _SeriesLikeCoef_co,
64+
coef: _SeriesLikeCoef_co | _CoefLike_co,
6565
domain: _SeriesLikeCoef_co | None = None,
6666
window: _SeriesLikeCoef_co | None = None,
6767
symbol: str = "x",

‎numpy/typing/tests/data/reveal/polynomial_polybase.pyi‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,10 @@ PS_all: (
6161
| npp.Legendre
6262
)
6363

64+
# constructor
65+
66+
assert_type(npp.Polynomial(SC_f), npp.Polynomial)
67+
6468
# static- and classmethods
6569

6670
assert_type(type(PS_poly).basis_name, None)

0 commit comments

Comments
 (0)