@@ -205,13 +205,13 @@ from numpy import (
205
205
matrixlib as matrixlib ,
206
206
polynomial as polynomial ,
207
207
random as random ,
208
- rec as rec ,
209
208
testing as testing ,
210
209
version as version ,
211
210
)
212
211
213
- from numpy .core import defchararray
212
+ from numpy .core import defchararray , records
214
213
char = defchararray
214
+ rec = records
215
215
216
216
from numpy .core .function_base import (
217
217
linspace as linspace ,
@@ -706,16 +706,6 @@ class chararray(ndarray[_ShapeType, _DType_co]):
706
706
def isnumeric (self ): ...
707
707
def isdecimal (self ): ...
708
708
709
- class format_parser :
710
- def __init__ (
711
- self ,
712
- formats : Any ,
713
- names : Any ,
714
- titles : Any ,
715
- aligned : Any = ...,
716
- byteorder : Any = ...,
717
- ) -> None : ...
718
-
719
709
class matrix (ndarray [_ShapeType , _DType_co ]):
720
710
def __new__ (
721
711
subtype ,
@@ -804,7 +794,6 @@ class nditer:
804
794
def __setitem__ (self , index : SupportsIndex | slice , value : Any ) -> None : ...
805
795
def __delitem__ (self , key : SupportsIndex | slice ) -> None : ...
806
796
807
-
808
797
class poly1d :
809
798
def __init__ (
810
799
self ,
@@ -863,33 +852,6 @@ class poly1d:
863
852
def integ (self , m = ..., k = ...): ...
864
853
def deriv (self , m = ...): ...
865
854
866
- class recarray (ndarray [_ShapeType , _DType_co ]):
867
- def __new__ (
868
- subtype ,
869
- shape : Any ,
870
- dtype : Any = ...,
871
- buf : Any = ...,
872
- offset : Any = ...,
873
- strides : Any = ...,
874
- formats : Any = ...,
875
- names : Any = ...,
876
- titles : Any = ...,
877
- byteorder : Any = ...,
878
- aligned : Any = ...,
879
- order : Any = ...,
880
- ) -> Any : ...
881
- def __array_finalize__ (self , obj ): ...
882
- def __getattribute__ (self , attr ): ...
883
- def __setattr__ (self , attr , val ): ...
884
- def __getitem__ (self , indx ): ...
885
- def field (self , attr , val = ...): ...
886
-
887
- class record (void ):
888
- def __getattribute__ (self , attr ): ...
889
- def __setattr__ (self , attr , val ): ...
890
- def __getitem__ (self , indx ): ...
891
- def pprint (self ): ...
892
-
893
855
class vectorize :
894
856
pyfunc : Any
895
857
cache : Any
@@ -1694,9 +1656,9 @@ class ndarray(_ArrayOrScalarCommon, Generic[_ShapeType, _DType_co]):
1694
1656
cls : Type [_ArraySelf ],
1695
1657
shape : _ShapeLike ,
1696
1658
dtype : DTypeLike = ...,
1697
- buffer : _SupportsBuffer = ...,
1698
- offset : int = ...,
1699
- strides : _ShapeLike = ...,
1659
+ buffer : None | _SupportsBuffer = ...,
1660
+ offset : SupportsIndex = ...,
1661
+ strides : None | _ShapeLike = ...,
1700
1662
order : _OrderKACF = ...,
1701
1663
) -> _ArraySelf : ...
1702
1664
@overload
@@ -3292,8 +3254,15 @@ class void(flexible):
3292
3254
def setfield (
3293
3255
self , val : ArrayLike , dtype : DTypeLike , offset : int = ...
3294
3256
) -> None : ...
3295
- def __getitem__ (self , key : SupportsIndex ) -> Any : ...
3296
- def __setitem__ (self , key : SupportsIndex , value : ArrayLike ) -> None : ...
3257
+ @overload
3258
+ def __getitem__ (self , key : str | SupportsIndex ) -> Any : ...
3259
+ @overload
3260
+ def __getitem__ (self , key : list [str ]) -> void : ...
3261
+ def __setitem__ (
3262
+ self ,
3263
+ key : str | List [str ] | SupportsIndex ,
3264
+ value : ArrayLike ,
3265
+ ) -> None : ...
3297
3266
3298
3267
void0 = void
3299
3268
@@ -3704,3 +3673,69 @@ class iinfo(Generic[_IntType]):
3704
3673
def __new__ (cls , dtype : int | Type [int ]) -> iinfo [int_ ]: ...
3705
3674
@overload
3706
3675
def __new__ (cls , dtype : str ) -> iinfo [Any ]: ...
3676
+
3677
+ class format_parser :
3678
+ dtype : dtype [void ]
3679
+ def __init__ (
3680
+ self ,
3681
+ formats : DTypeLike ,
3682
+ names : None | str | Sequence [str ],
3683
+ titles : None | str | Sequence [str ],
3684
+ aligned : bool = ...,
3685
+ byteorder : None | _ByteOrder = ...,
3686
+ ) -> None : ...
3687
+
3688
+ # TODO: field-lookup returns either a `recarray` or a `ndarray`
3689
+ # depending on the field dtype
3690
+ class recarray (ndarray [_ShapeType , _DType_co ]):
3691
+ # NOTE: While not strictly mandatory, we're demanding here that arguments
3692
+ # for the `format_parser`- and `dtype`-based dtype constructors are
3693
+ # mutually exclusive
3694
+ @overload
3695
+ def __new__ (
3696
+ subtype ,
3697
+ shape : _ShapeLike ,
3698
+ dtype : None = ...,
3699
+ buf : None | _SupportsBuffer = ...,
3700
+ offset : SupportsIndex = ...,
3701
+ strides : None | _ShapeLike = ...,
3702
+ * ,
3703
+ formats : DTypeLike ,
3704
+ names : None | str | Sequence [str ] = ...,
3705
+ titles : None | str | Sequence [str ] = ...,
3706
+ byteorder : None | _ByteOrder = ...,
3707
+ aligned : bool = ...,
3708
+ order : _OrderKACF = ...,
3709
+ ) -> recarray [Any , dtype [record ]]: ...
3710
+ @overload
3711
+ def __new__ (
3712
+ subtype ,
3713
+ shape : _ShapeLike ,
3714
+ dtype : DTypeLike ,
3715
+ buf : None | _SupportsBuffer = ...,
3716
+ offset : SupportsIndex = ...,
3717
+ strides : None | _ShapeLike = ...,
3718
+ formats : None = ...,
3719
+ names : None = ...,
3720
+ titles : None = ...,
3721
+ byteorder : None = ...,
3722
+ aligned : L [False ] = ...,
3723
+ order : _OrderKACF = ...,
3724
+ ) -> recarray [Any , dtype [Any ]]: ...
3725
+ def __array_finalize__ (self , obj : object ) -> None : ...
3726
+ def __getattribute__ (self , attr : str ) -> Any : ...
3727
+ def __setattr__ (self , attr : str , val : ArrayLike ) -> None : ...
3728
+ def __getitem__ (self , indx ): ... # TODO
3729
+ @overload
3730
+ def field (self , attr : int | str , val : None = ...) -> Any : ...
3731
+ @overload
3732
+ def field (self , attr : int | str , val : ArrayLike ) -> None : ...
3733
+
3734
+ class record (void ):
3735
+ def __getattribute__ (self , attr : str ) -> Any : ...
3736
+ def __setattr__ (self , attr : str , val : ArrayLike ) -> None : ...
3737
+ def pprint (self ) -> str : ...
3738
+ @overload
3739
+ def __getitem__ (self , key : str | SupportsIndex ) -> Any : ...
3740
+ @overload
3741
+ def __getitem__ (self , key : list [str ]) -> record : ...
0 commit comments