1
+ # ruff: noqa: I001
1
2
import builtins
2
3
import sys
3
4
import mmap
@@ -206,17 +207,19 @@ else:
206
207
)
207
208
208
209
from typing import (
209
- Literal as L ,
210
210
Any ,
211
+ ClassVar ,
212
+ Final ,
213
+ Generic ,
214
+ Literal as L ,
211
215
NoReturn ,
212
216
SupportsComplex ,
213
217
SupportsFloat ,
214
218
SupportsInt ,
215
219
SupportsIndex ,
216
- Final ,
217
- final ,
218
- ClassVar ,
219
220
TypeAlias ,
221
+ TypedDict ,
222
+ final ,
220
223
type_check_only ,
221
224
)
222
225
@@ -225,11 +228,13 @@ from typing import (
225
228
# library include `typing_extensions` stubs:
226
229
# https://github.com/python/typeshed/blob/main/stdlib/typing_extensions.pyi
227
230
from _typeshed import StrOrBytesPath , SupportsFlush , SupportsLenAndGetItem , SupportsWrite
228
- from typing_extensions import CapsuleType , Generic , LiteralString , Never , Protocol , Self , TypeVar , Unpack , deprecated , overload
231
+ from typing_extensions import CapsuleType , LiteralString , Never , Protocol , Self , TypeVar , Unpack , deprecated , overload
229
232
230
233
from numpy import (
234
+ char ,
231
235
core ,
232
236
ctypeslib ,
237
+ dtypes ,
233
238
exceptions ,
234
239
f2py ,
235
240
fft ,
@@ -238,15 +243,22 @@ from numpy import (
238
243
ma ,
239
244
polynomial ,
240
245
random ,
241
- testing ,
242
- typing ,
243
- version ,
244
- dtypes ,
245
246
rec ,
246
- char ,
247
247
strings ,
248
+ testing ,
249
+ typing ,
248
250
)
249
251
252
+ # available through `__getattr__`, but not in `__all__` or `__dir__`
253
+ from numpy import (
254
+ __config__ as __config__ ,
255
+ matlib as matlib ,
256
+ matrixlib as matrixlib ,
257
+ version as version ,
258
+ )
259
+ if sys .version_info < (3 , 12 ):
260
+ from numpy import distutils as distutils
261
+
250
262
from numpy ._core .records import (
251
263
record ,
252
264
recarray ,
@@ -440,6 +452,7 @@ from numpy.lib._arraypad_impl import (
440
452
441
453
from numpy .lib ._arraysetops_impl import (
442
454
ediff1d ,
455
+ in1d ,
443
456
intersect1d ,
444
457
isin ,
445
458
setdiff1d ,
@@ -481,14 +494,15 @@ from numpy.lib._function_base_impl import (
481
494
bartlett ,
482
495
blackman ,
483
496
kaiser ,
497
+ trapezoid ,
498
+ trapz ,
484
499
i0 ,
485
500
meshgrid ,
486
501
delete ,
487
502
insert ,
488
503
append ,
489
504
interp ,
490
505
quantile ,
491
- trapezoid ,
492
506
)
493
507
494
508
from numpy .lib ._histograms_impl import (
@@ -627,13 +641,10 @@ from numpy.matrixlib import (
627
641
bmat ,
628
642
)
629
643
630
- __all__ = [
631
- "emath" , "show_config" , "version" , "__version__" , "__array_namespace_info__" ,
632
-
644
+ __all__ = [ # noqa: RUF022
633
645
# __numpy_submodules__
634
- "linalg" , "fft" , "dtypes" , "random" , "polynomial" , "ma" , "exceptions" , "lib" ,
635
- "ctypeslib" , "testing" , "test" , "rec" , "char" , "strings" ,
636
- "core" , "typing" , "f2py" ,
646
+ "char" , "core" , "ctypeslib" , "dtypes" , "exceptions" , "f2py" , "fft" , "lib" , "linalg" ,
647
+ "ma" , "polynomial" , "random" , "rec" , "strings" , "test" , "testing" , "typing" ,
637
648
638
649
# _core.__all__
639
650
"abs" , "acos" , "acosh" , "asin" , "asinh" , "atan" , "atanh" , "atan2" , "bitwise_invert" ,
@@ -651,8 +662,8 @@ __all__ = [
651
662
"tensordot" , "little_endian" , "fromiter" , "array_equal" , "array_equiv" , "indices" ,
652
663
"fromfunction" , "isclose" , "isscalar" , "binary_repr" , "base_repr" , "ones" ,
653
664
"identity" , "allclose" , "putmask" , "flatnonzero" , "inf" , "nan" , "False_" , "True_" ,
654
- "bitwise_not" , "full" , "full_like" , "matmul" , "vecdot" , "shares_memory " ,
655
- "may_share_memory " , "_get_promotion_state" , "_set_promotion_state " ,
665
+ "bitwise_not" , "full" , "full_like" , "matmul" , "vecdot" , "vecmat " ,
666
+ "shares_memory " , "may_share_memory " ,
656
667
"all" , "amax" , "amin" , "any" , "argmax" , "argmin" , "argpartition" , "argsort" ,
657
668
"around" , "choose" , "clip" , "compress" , "cumprod" , "cumsum" , "cumulative_prod" ,
658
669
"cumulative_sum" , "diagonal" , "mean" , "max" , "min" , "matrix_transpose" , "ndim" ,
@@ -667,7 +678,7 @@ __all__ = [
667
678
"frompyfunc" , "gcd" , "greater" , "greater_equal" , "heaviside" , "hypot" , "invert" ,
668
679
"isfinite" , "isinf" , "isnan" , "isnat" , "lcm" , "ldexp" , "left_shift" , "less" ,
669
680
"less_equal" , "log" , "log10" , "log1p" , "log2" , "logaddexp" , "logaddexp2" ,
670
- "logical_and" , "logical_not" , "logical_or" , "logical_xor" , "maximum" , "minimum" ,
681
+ "logical_and" , "logical_not" , "logical_or" , "logical_xor" , "matvec" , " maximum" , "minimum" ,
671
682
"mod" , "modf" , "multiply" , "negative" , "nextafter" , "not_equal" , "pi" , "positive" ,
672
683
"power" , "rad2deg" , "radians" , "reciprocal" , "remainder" , "right_shift" , "rint" ,
673
684
"sign" , "signbit" , "sin" , "sinh" , "spacing" , "sqrt" , "square" , "subtract" , "tan" ,
@@ -686,7 +697,7 @@ __all__ = [
686
697
"array2string" , "array_str" , "array_repr" , "set_printoptions" , "get_printoptions" ,
687
698
"printoptions" , "format_float_positional" , "format_float_scientific" , "require" ,
688
699
"seterr" , "geterr" , "setbufsize" , "getbufsize" , "seterrcall" , "geterrcall" ,
689
- "errstate" , "_no_nep50_warning" ,
700
+ "errstate" ,
690
701
# _core.function_base.__all__
691
702
"logspace" , "linspace" , "geomspace" ,
692
703
# _core.getlimits.__all__
@@ -696,21 +707,21 @@ __all__ = [
696
707
"vstack" ,
697
708
# _core.einsumfunc.__all__
698
709
"einsum" , "einsum_path" ,
699
-
710
+ # matrixlib.__all__
711
+ "matrix" , "bmat" , "asmatrix" ,
700
712
# lib._histograms_impl.__all__
701
713
"histogram" , "histogramdd" , "histogram_bin_edges" ,
702
714
# lib._nanfunctions_impl.__all__
703
715
"nansum" , "nanmax" , "nanmin" , "nanargmax" , "nanargmin" , "nanmean" , "nanmedian" ,
704
716
"nanpercentile" , "nanvar" , "nanstd" , "nanprod" , "nancumsum" , "nancumprod" ,
705
717
"nanquantile" ,
706
718
# lib._function_base_impl.__all__
707
- # NOTE: `trapz` is omitted because it is deprecated
708
719
"select" , "piecewise" , "trim_zeros" , "copy" , "iterable" , "percentile" , "diff" ,
709
720
"gradient" , "angle" , "unwrap" , "sort_complex" , "flip" , "rot90" , "extract" , "place" ,
710
721
"vectorize" , "asarray_chkfinite" , "average" , "bincount" , "digitize" , "cov" ,
711
722
"corrcoef" , "median" , "sinc" , "hamming" , "hanning" , "bartlett" , "blackman" ,
712
- "kaiser" , "i0 " , "meshgrid " , "delete " , "insert " , "append " , "interp " , "quantile " ,
713
- "trapezoid " ,
723
+ "kaiser" , "trapezoid " , "trapz " , "i0 " , "meshgrid " , "delete " , "insert " , "append " ,
724
+ "interp" , "quantile " ,
714
725
# lib._twodim_base_impl.__all__
715
726
"diag" , "diagflat" , "eye" , "fliplr" , "flipud" , "tri" , "triu" , "tril" , "vander" ,
716
727
"histogram2d" , "mask_indices" , "tril_indices" , "tril_indices_from" , "triu_indices" ,
@@ -724,9 +735,8 @@ __all__ = [
724
735
"iscomplexobj" , "isrealobj" , "imag" , "iscomplex" , "isreal" , "nan_to_num" , "real" ,
725
736
"real_if_close" , "typename" , "mintypecode" , "common_type" ,
726
737
# lib._arraysetops_impl.__all__
727
- # NOTE: `in1d` is omitted because it is deprecated
728
- "ediff1d" , "intersect1d" , "isin" , "setdiff1d" , "setxor1d" , "union1d" , "unique" ,
729
- "unique_all" , "unique_counts" , "unique_inverse" , "unique_values" ,
738
+ "ediff1d" , "in1d" , "intersect1d" , "isin" , "setdiff1d" , "setxor1d" , "union1d" ,
739
+ "unique" , "unique_all" , "unique_counts" , "unique_inverse" , "unique_values" ,
730
740
# lib._ufunclike_impl.__all__
731
741
"fix" , "isneginf" , "isposinf" ,
732
742
# lib._arraypad_impl.__all__
@@ -746,9 +756,9 @@ __all__ = [
746
756
"index_exp" , "ix_" , "ndenumerate" , "ndindex" , "fill_diagonal" , "diag_indices" ,
747
757
"diag_indices_from" ,
748
758
749
- # matrixlib .__all__
750
- "matrix " , "bmat " , "asmatrix " ,
751
- ]
759
+ # __init__ .__all__
760
+ "emath " , "show_config " , "__version__" , "__array_namespace_info__ " ,
761
+ ] # fmt: skip
752
762
753
763
### Constrained types (for internal use only)
754
764
# Only use these for functions; never as generic type parameter.
@@ -1047,6 +1057,16 @@ _IntTD64Unit: TypeAlias = L[_MonthUnit, _IntTimeUnit]
1047
1057
_TD64Unit : TypeAlias = L [_DateUnit , _TimeUnit ]
1048
1058
_TimeUnitSpec : TypeAlias = _TD64UnitT | tuple [_TD64UnitT , SupportsIndex ]
1049
1059
1060
+ ### TypedDict's (for internal use only)
1061
+
1062
+ @type_check_only
1063
+ class _FormerAttrsDict (TypedDict ):
1064
+ object : LiteralString
1065
+ float : LiteralString
1066
+ complex : LiteralString
1067
+ str : LiteralString
1068
+ int : LiteralString
1069
+
1050
1070
### Protocols (for internal use only)
1051
1071
1052
1072
@type_check_only
@@ -1147,22 +1167,26 @@ class _IntegralMixin(_RealMixin):
1147
1167
### Public API
1148
1168
1149
1169
__version__ : Final [LiteralString ] = ...
1150
- __array_api_version__ : Final = "2023.12"
1151
- test : Final [PytestTester ] = ...
1152
1170
1153
1171
e : Final [float ] = ...
1154
1172
euler_gamma : Final [float ] = ...
1173
+ pi : Final [float ] = ...
1155
1174
inf : Final [float ] = ...
1156
1175
nan : Final [float ] = ...
1157
- pi : Final [float ] = ...
1158
-
1159
1176
little_endian : Final [builtins .bool ] = ...
1160
-
1161
1177
False_ : Final [np .bool [L [False ]]] = ...
1162
1178
True_ : Final [np .bool [L [True ]]] = ...
1163
-
1164
1179
newaxis : Final [None ] = None
1165
1180
1181
+ # not in __all__
1182
+ __NUMPY_SETUP__ : Final [L [False ]] = False
1183
+ __numpy_submodules__ : Final [set [LiteralString ]] = ...
1184
+ __expired_attributes__ : Final [dict [LiteralString , LiteralString ]]
1185
+ __former_attrs__ : Final [_FormerAttrsDict ] = ...
1186
+ __future_scalars__ : Final [set [L ["bytes" , "str" , "object" ]]] = ...
1187
+ __array_api_version__ : Final [L ["2023.12" ]] = "2023.12"
1188
+ test : Final [PytestTester ] = ...
1189
+
1166
1190
@final
1167
1191
class dtype (Generic [_SCT_co ]):
1168
1192
names : None | tuple [builtins .str , ...]
0 commit comments