Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e20317a

Browse files
authored
Merge pull request #28327 from Andrej730/fix_typing_arguments
TYP: fix positional- and keyword-only params in ``astype``, ``cross`` and ``linalg``
2 parents ec2f718 + 2f53d8b commit e20317a

File tree

2 files changed

+49
-25
lines changed

2 files changed

+49
-25
lines changed

numpy/_core/numeric.pyi

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -699,62 +699,62 @@ def moveaxis(
699699

700700
@overload
701701
def cross(
702-
x1: _ArrayLikeUnknown,
703-
x2: _ArrayLikeUnknown,
702+
a: _ArrayLikeUnknown,
703+
b: _ArrayLikeUnknown,
704704
axisa: int = ...,
705705
axisb: int = ...,
706706
axisc: int = ...,
707707
axis: None | int = ...,
708708
) -> NDArray[Any]: ...
709709
@overload
710710
def cross(
711-
x1: _ArrayLikeBool_co,
712-
x2: _ArrayLikeBool_co,
711+
a: _ArrayLikeBool_co,
712+
b: _ArrayLikeBool_co,
713713
axisa: int = ...,
714714
axisb: int = ...,
715715
axisc: int = ...,
716716
axis: None | int = ...,
717717
) -> NoReturn: ...
718718
@overload
719719
def cross(
720-
x1: _ArrayLikeUInt_co,
721-
x2: _ArrayLikeUInt_co,
720+
a: _ArrayLikeUInt_co,
721+
b: _ArrayLikeUInt_co,
722722
axisa: int = ...,
723723
axisb: int = ...,
724724
axisc: int = ...,
725725
axis: None | int = ...,
726726
) -> NDArray[unsignedinteger[Any]]: ...
727727
@overload
728728
def cross(
729-
x1: _ArrayLikeInt_co,
730-
x2: _ArrayLikeInt_co,
729+
a: _ArrayLikeInt_co,
730+
b: _ArrayLikeInt_co,
731731
axisa: int = ...,
732732
axisb: int = ...,
733733
axisc: int = ...,
734734
axis: None | int = ...,
735735
) -> NDArray[signedinteger[Any]]: ...
736736
@overload
737737
def cross(
738-
x1: _ArrayLikeFloat_co,
739-
x2: _ArrayLikeFloat_co,
738+
a: _ArrayLikeFloat_co,
739+
b: _ArrayLikeFloat_co,
740740
axisa: int = ...,
741741
axisb: int = ...,
742742
axisc: int = ...,
743743
axis: None | int = ...,
744744
) -> NDArray[floating[Any]]: ...
745745
@overload
746746
def cross(
747-
x1: _ArrayLikeComplex_co,
748-
x2: _ArrayLikeComplex_co,
747+
a: _ArrayLikeComplex_co,
748+
b: _ArrayLikeComplex_co,
749749
axisa: int = ...,
750750
axisb: int = ...,
751751
axisc: int = ...,
752752
axis: None | int = ...,
753753
) -> NDArray[complexfloating[Any, Any]]: ...
754754
@overload
755755
def cross(
756-
x1: _ArrayLikeObject_co,
757-
x2: _ArrayLikeObject_co,
756+
a: _ArrayLikeObject_co,
757+
b: _ArrayLikeObject_co,
758758
axisa: int = ...,
759759
axisb: int = ...,
760760
axisc: int = ...,
@@ -874,13 +874,17 @@ def array_equiv(a1: ArrayLike, a2: ArrayLike) -> bool: ...
874874
def astype(
875875
x: ndarray[_ShapeType, dtype[Any]],
876876
dtype: _DTypeLike[_SCT],
877+
/,
878+
*,
877879
copy: bool = ...,
878880
device: None | L["cpu"] = ...,
879881
) -> ndarray[_ShapeType, dtype[_SCT]]: ...
880882
@overload
881883
def astype(
882884
x: ndarray[_ShapeType, dtype[Any]],
883885
dtype: DTypeLike,
886+
/,
887+
*,
884888
copy: bool = ...,
885889
device: None | L["cpu"] = ...,
886890
) -> ndarray[_ShapeType, dtype[Any]]: ...

numpy/linalg/_linalg.pyi

Lines changed: 31 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -175,11 +175,11 @@ def matrix_power(
175175
) -> NDArray[Any]: ...
176176

177177
@overload
178-
def cholesky(a: _ArrayLikeInt_co) -> NDArray[float64]: ...
178+
def cholesky(a: _ArrayLikeInt_co, /, *, upper: bool = False) -> NDArray[float64]: ...
179179
@overload
180-
def cholesky(a: _ArrayLikeFloat_co) -> NDArray[floating[Any]]: ...
180+
def cholesky(a: _ArrayLikeFloat_co, /, *, upper: bool = False) -> NDArray[floating[Any]]: ...
181181
@overload
182-
def cholesky(a: _ArrayLikeComplex_co) -> NDArray[complexfloating[Any, Any]]: ...
182+
def cholesky(a: _ArrayLikeComplex_co, /, *, upper: bool = False) -> NDArray[complexfloating[Any, Any]]: ...
183183

184184
@overload
185185
def outer(x1: _ArrayLikeUnknown, x2: _ArrayLikeUnknown) -> NDArray[Any]: ...
@@ -372,26 +372,34 @@ def norm(
372372
@overload
373373
def matrix_norm(
374374
x: ArrayLike,
375+
/,
376+
*,
375377
ord: None | float | L["fro", "nuc"] = ...,
376378
keepdims: bool = ...,
377379
) -> floating[Any]: ...
378380
@overload
379381
def matrix_norm(
380382
x: ArrayLike,
383+
/,
384+
*,
381385
ord: None | float | L["fro", "nuc"] = ...,
382386
keepdims: bool = ...,
383387
) -> Any: ...
384388

385389
@overload
386390
def vector_norm(
387391
x: ArrayLike,
392+
/,
393+
*,
388394
axis: None = ...,
389395
ord: None | float = ...,
390396
keepdims: bool = ...,
391397
) -> floating[Any]: ...
392398
@overload
393399
def vector_norm(
394400
x: ArrayLike,
401+
/,
402+
*,
395403
axis: SupportsInt | SupportsIndex | tuple[int, ...] = ...,
396404
ord: None | float = ...,
397405
keepdims: bool = ...,
@@ -406,37 +414,49 @@ def multi_dot(
406414

407415
def diagonal(
408416
x: ArrayLike, # >= 2D array
417+
/,
418+
*,
409419
offset: SupportsIndex = ...,
410420
) -> NDArray[Any]: ...
411421

412422
def trace(
413423
x: ArrayLike, # >= 2D array
424+
/,
425+
*,
414426
offset: SupportsIndex = ...,
415427
dtype: DTypeLike = ...,
416428
) -> Any: ...
417429

418430
@overload
419431
def cross(
420-
a: _ArrayLikeUInt_co,
421-
b: _ArrayLikeUInt_co,
432+
x1: _ArrayLikeUInt_co,
433+
x2: _ArrayLikeUInt_co,
434+
/,
435+
*,
422436
axis: int = ...,
423437
) -> NDArray[unsignedinteger[Any]]: ...
424438
@overload
425439
def cross(
426-
a: _ArrayLikeInt_co,
427-
b: _ArrayLikeInt_co,
440+
x1: _ArrayLikeInt_co,
441+
x2: _ArrayLikeInt_co,
442+
/,
443+
*,
428444
axis: int = ...,
429445
) -> NDArray[signedinteger[Any]]: ...
430446
@overload
431447
def cross(
432-
a: _ArrayLikeFloat_co,
433-
b: _ArrayLikeFloat_co,
448+
x1: _ArrayLikeFloat_co,
449+
x2: _ArrayLikeFloat_co,
450+
/,
451+
*,
434452
axis: int = ...,
435453
) -> NDArray[floating[Any]]: ...
436454
@overload
437455
def cross(
438-
a: _ArrayLikeComplex_co,
439-
b: _ArrayLikeComplex_co,
456+
x1: _ArrayLikeComplex_co,
457+
x2: _ArrayLikeComplex_co,
458+
/,
459+
*,
440460
axis: int = ...,
441461
) -> NDArray[complexfloating[Any, Any]]: ...
442462

0 commit comments

Comments
 (0)