🌐 AI搜索 & 代理 主页
Skip to content

Commit fe3a74c

Browse files
jorenhamcharris
authored andcommitted
TYP: Fix incompatible defaults in polyfit, histogram, and histogramdd (#29847)
The default values weren't assignable to the types of the parameters.
1 parent 2342cb0 commit fe3a74c

File tree

2 files changed

+18
-16
lines changed

2 files changed

+18
-16
lines changed

numpy/lib/_histograms_impl.pyi

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,16 +35,16 @@ def histogram_bin_edges(
3535

3636
def histogram(
3737
a: ArrayLike,
38-
bins: _BinKind | SupportsIndex | ArrayLike = ...,
39-
range: tuple[float, float] | None = ...,
40-
density: bool = ...,
41-
weights: ArrayLike | None = ...,
38+
bins: _BinKind | SupportsIndex | ArrayLike = 10,
39+
range: tuple[float, float] | None = None,
40+
density: bool | None = None,
41+
weights: ArrayLike | None = None,
4242
) -> tuple[NDArray[Any], NDArray[Any]]: ...
4343

4444
def histogramdd(
4545
sample: ArrayLike,
46-
bins: SupportsIndex | ArrayLike = ...,
47-
range: Sequence[tuple[float, float]] = ...,
48-
density: bool | None = ...,
49-
weights: ArrayLike | None = ...,
46+
bins: SupportsIndex | ArrayLike = 10,
47+
range: Sequence[tuple[float, float]] | None = None,
48+
density: bool | None = None,
49+
weights: ArrayLike | None = None,
5050
) -> tuple[NDArray[Any], tuple[NDArray[Any], ...]]: ...

numpy/lib/_polynomial_impl.pyi

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -137,20 +137,22 @@ def polyfit(
137137
x: _ArrayLikeFloat_co,
138138
y: _ArrayLikeFloat_co,
139139
deg: SupportsIndex | SupportsInt,
140-
rcond: float | None = ...,
141-
full: L[False] = ...,
142-
w: _ArrayLikeFloat_co | None = ...,
143-
cov: L[True, "unscaled"] = ...,
140+
rcond: float | None = None,
141+
full: L[False] = False,
142+
w: _ArrayLikeFloat_co | None = None,
143+
*,
144+
cov: L[True, "unscaled"],
144145
) -> _2Tup[NDArray[float64]]: ...
145146
@overload
146147
def polyfit(
147148
x: _ArrayLikeComplex_co,
148149
y: _ArrayLikeComplex_co,
149150
deg: SupportsIndex | SupportsInt,
150-
rcond: float | None = ...,
151-
full: L[False] = ...,
152-
w: _ArrayLikeFloat_co | None = ...,
153-
cov: L[True, "unscaled"] = ...,
151+
rcond: float | None = None,
152+
full: L[False] = False,
153+
w: _ArrayLikeFloat_co | None = None,
154+
*,
155+
cov: L[True, "unscaled"],
154156
) -> _2Tup[NDArray[complex128]]: ...
155157
@overload
156158
def polyfit(

0 commit comments

Comments
 (0)