m2m模型翻译
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

3829 lines
131 KiB

6 months ago
  1. import builtins
  2. import os
  3. import sys
  4. import mmap
  5. import ctypes as ct
  6. import array as _array
  7. import datetime as dt
  8. from abc import abstractmethod
  9. from types import TracebackType
  10. from contextlib import ContextDecorator
  11. from numpy.core._internal import _ctypes
  12. from numpy.typing import (
  13. # Arrays
  14. ArrayLike,
  15. NDArray,
  16. _SupportsArray,
  17. _NestedSequence,
  18. _RecursiveSequence,
  19. _SupportsArray,
  20. _ArrayLikeBool_co,
  21. _ArrayLikeUInt_co,
  22. _ArrayLikeInt_co,
  23. _ArrayLikeFloat_co,
  24. _ArrayLikeComplex_co,
  25. _ArrayLikeNumber_co,
  26. _ArrayLikeTD64_co,
  27. _ArrayLikeDT64_co,
  28. _ArrayLikeObject_co,
  29. # DTypes
  30. DTypeLike,
  31. _SupportsDType,
  32. _VoidDTypeLike,
  33. # Shapes
  34. _Shape,
  35. _ShapeLike,
  36. # Scalars
  37. _CharLike_co,
  38. _BoolLike_co,
  39. _IntLike_co,
  40. _FloatLike_co,
  41. _ComplexLike_co,
  42. _TD64Like_co,
  43. _NumberLike_co,
  44. _ScalarLike_co,
  45. # `number` precision
  46. NBitBase,
  47. _256Bit,
  48. _128Bit,
  49. _96Bit,
  50. _80Bit,
  51. _64Bit,
  52. _32Bit,
  53. _16Bit,
  54. _8Bit,
  55. _NBitByte,
  56. _NBitShort,
  57. _NBitIntC,
  58. _NBitIntP,
  59. _NBitInt,
  60. _NBitLongLong,
  61. _NBitHalf,
  62. _NBitSingle,
  63. _NBitDouble,
  64. _NBitLongDouble,
  65. # Character codes
  66. _BoolCodes,
  67. _UInt8Codes,
  68. _UInt16Codes,
  69. _UInt32Codes,
  70. _UInt64Codes,
  71. _Int8Codes,
  72. _Int16Codes,
  73. _Int32Codes,
  74. _Int64Codes,
  75. _Float16Codes,
  76. _Float32Codes,
  77. _Float64Codes,
  78. _Complex64Codes,
  79. _Complex128Codes,
  80. _ByteCodes,
  81. _ShortCodes,
  82. _IntCCodes,
  83. _IntPCodes,
  84. _IntCodes,
  85. _LongLongCodes,
  86. _UByteCodes,
  87. _UShortCodes,
  88. _UIntCCodes,
  89. _UIntPCodes,
  90. _UIntCodes,
  91. _ULongLongCodes,
  92. _HalfCodes,
  93. _SingleCodes,
  94. _DoubleCodes,
  95. _LongDoubleCodes,
  96. _CSingleCodes,
  97. _CDoubleCodes,
  98. _CLongDoubleCodes,
  99. _DT64Codes,
  100. _TD64Codes,
  101. _StrCodes,
  102. _BytesCodes,
  103. _VoidCodes,
  104. _ObjectCodes,
  105. # Ufuncs
  106. _UFunc_Nin1_Nout1,
  107. _UFunc_Nin2_Nout1,
  108. _UFunc_Nin1_Nout2,
  109. _UFunc_Nin2_Nout2,
  110. _GUFunc_Nin2_Nout1,
  111. )
  112. from numpy.typing._callable import (
  113. _BoolOp,
  114. _BoolBitOp,
  115. _BoolSub,
  116. _BoolTrueDiv,
  117. _BoolMod,
  118. _BoolDivMod,
  119. _TD64Div,
  120. _IntTrueDiv,
  121. _UnsignedIntOp,
  122. _UnsignedIntBitOp,
  123. _UnsignedIntMod,
  124. _UnsignedIntDivMod,
  125. _SignedIntOp,
  126. _SignedIntBitOp,
  127. _SignedIntMod,
  128. _SignedIntDivMod,
  129. _FloatOp,
  130. _FloatMod,
  131. _FloatDivMod,
  132. _ComplexOp,
  133. _NumberOp,
  134. _ComparisonOp,
  135. )
  136. # NOTE: Numpy's mypy plugin is used for removing the types unavailable
  137. # to the specific platform
  138. from numpy.typing._extended_precision import (
  139. uint128 as uint128,
  140. uint256 as uint256,
  141. int128 as int128,
  142. int256 as int256,
  143. float80 as float80,
  144. float96 as float96,
  145. float128 as float128,
  146. float256 as float256,
  147. complex160 as complex160,
  148. complex192 as complex192,
  149. complex256 as complex256,
  150. complex512 as complex512,
  151. )
  152. from typing import (
  153. Any,
  154. ByteString,
  155. Callable,
  156. Container,
  157. Callable,
  158. Dict,
  159. Generic,
  160. IO,
  161. Iterable,
  162. Iterator,
  163. List,
  164. Mapping,
  165. NoReturn,
  166. Optional,
  167. overload,
  168. Sequence,
  169. Sized,
  170. SupportsComplex,
  171. SupportsFloat,
  172. SupportsInt,
  173. Text,
  174. Tuple,
  175. Type,
  176. TypeVar,
  177. Union,
  178. )
  179. if sys.version_info >= (3, 8):
  180. from typing import Literal as L, Protocol, SupportsIndex, Final
  181. else:
  182. from typing_extensions import Literal as L, Protocol, SupportsIndex, Final
  183. # Ensures that the stubs are picked up
  184. from numpy import (
  185. char as char,
  186. ctypeslib as ctypeslib,
  187. fft as fft,
  188. lib as lib,
  189. linalg as linalg,
  190. ma as ma,
  191. matrixlib as matrixlib,
  192. polynomial as polynomial,
  193. random as random,
  194. rec as rec,
  195. testing as testing,
  196. version as version,
  197. )
  198. from numpy.core.function_base import (
  199. linspace as linspace,
  200. logspace as logspace,
  201. geomspace as geomspace,
  202. )
  203. from numpy.core.fromnumeric import (
  204. take as take,
  205. reshape as reshape,
  206. choose as choose,
  207. repeat as repeat,
  208. put as put,
  209. swapaxes as swapaxes,
  210. transpose as transpose,
  211. partition as partition,
  212. argpartition as argpartition,
  213. sort as sort,
  214. argsort as argsort,
  215. argmax as argmax,
  216. argmin as argmin,
  217. searchsorted as searchsorted,
  218. resize as resize,
  219. squeeze as squeeze,
  220. diagonal as diagonal,
  221. trace as trace,
  222. ravel as ravel,
  223. nonzero as nonzero,
  224. shape as shape,
  225. compress as compress,
  226. clip as clip,
  227. sum as sum,
  228. all as all,
  229. any as any,
  230. cumsum as cumsum,
  231. ptp as ptp,
  232. amax as amax,
  233. amin as amin,
  234. prod as prod,
  235. cumprod as cumprod,
  236. ndim as ndim,
  237. size as size,
  238. around as around,
  239. mean as mean,
  240. std as std,
  241. var as var,
  242. )
  243. from numpy.core._asarray import (
  244. asarray as asarray,
  245. asanyarray as asanyarray,
  246. ascontiguousarray as ascontiguousarray,
  247. asfortranarray as asfortranarray,
  248. require as require,
  249. )
  250. from numpy.core._type_aliases import (
  251. sctypes as sctypes,
  252. sctypeDict as sctypeDict,
  253. )
  254. from numpy.core._ufunc_config import (
  255. seterr as seterr,
  256. geterr as geterr,
  257. setbufsize as setbufsize,
  258. getbufsize as getbufsize,
  259. seterrcall as seterrcall,
  260. geterrcall as geterrcall,
  261. _SupportsWrite,
  262. _ErrKind,
  263. _ErrFunc,
  264. _ErrDictOptional,
  265. )
  266. from numpy.core.arrayprint import (
  267. set_printoptions as set_printoptions,
  268. get_printoptions as get_printoptions,
  269. array2string as array2string,
  270. format_float_scientific as format_float_scientific,
  271. format_float_positional as format_float_positional,
  272. array_repr as array_repr,
  273. array_str as array_str,
  274. set_string_function as set_string_function,
  275. printoptions as printoptions,
  276. )
  277. from numpy.core.einsumfunc import (
  278. einsum as einsum,
  279. einsum_path as einsum_path,
  280. )
  281. from numpy.core.numeric import (
  282. zeros_like as zeros_like,
  283. ones as ones,
  284. ones_like as ones_like,
  285. empty_like as empty_like,
  286. full as full,
  287. full_like as full_like,
  288. count_nonzero as count_nonzero,
  289. isfortran as isfortran,
  290. argwhere as argwhere,
  291. flatnonzero as flatnonzero,
  292. correlate as correlate,
  293. convolve as convolve,
  294. outer as outer,
  295. tensordot as tensordot,
  296. roll as roll,
  297. rollaxis as rollaxis,
  298. moveaxis as moveaxis,
  299. cross as cross,
  300. indices as indices,
  301. fromfunction as fromfunction,
  302. isscalar as isscalar,
  303. binary_repr as binary_repr,
  304. base_repr as base_repr,
  305. identity as identity,
  306. allclose as allclose,
  307. isclose as isclose,
  308. array_equal as array_equal,
  309. array_equiv as array_equiv,
  310. )
  311. from numpy.core.numerictypes import (
  312. maximum_sctype as maximum_sctype,
  313. issctype as issctype,
  314. obj2sctype as obj2sctype,
  315. issubclass_ as issubclass_,
  316. issubsctype as issubsctype,
  317. issubdtype as issubdtype,
  318. sctype2char as sctype2char,
  319. find_common_type as find_common_type,
  320. nbytes as nbytes,
  321. cast as cast,
  322. ScalarType as ScalarType,
  323. typecodes as typecodes,
  324. )
  325. from numpy.core.shape_base import (
  326. atleast_1d as atleast_1d,
  327. atleast_2d as atleast_2d,
  328. atleast_3d as atleast_3d,
  329. block as block,
  330. hstack as hstack,
  331. stack as stack,
  332. vstack as vstack,
  333. )
  334. from numpy.lib import (
  335. emath as emath,
  336. )
  337. from numpy.lib.arraypad import (
  338. pad as pad,
  339. )
  340. from numpy.lib.arraysetops import (
  341. ediff1d as ediff1d,
  342. intersect1d as intersect1d,
  343. setxor1d as setxor1d,
  344. union1d as union1d,
  345. setdiff1d as setdiff1d,
  346. unique as unique,
  347. in1d as in1d,
  348. isin as isin,
  349. )
  350. from numpy.lib.arrayterator import (
  351. Arrayterator as Arrayterator,
  352. )
  353. from numpy.lib.function_base import (
  354. select as select,
  355. piecewise as piecewise,
  356. trim_zeros as trim_zeros,
  357. copy as copy,
  358. iterable as iterable,
  359. percentile as percentile,
  360. diff as diff,
  361. gradient as gradient,
  362. angle as angle,
  363. unwrap as unwrap,
  364. sort_complex as sort_complex,
  365. disp as disp,
  366. flip as flip,
  367. rot90 as rot90,
  368. extract as extract,
  369. place as place,
  370. asarray_chkfinite as asarray_chkfinite,
  371. average as average,
  372. bincount as bincount,
  373. digitize as digitize,
  374. cov as cov,
  375. corrcoef as corrcoef,
  376. msort as msort,
  377. median as median,
  378. sinc as sinc,
  379. hamming as hamming,
  380. hanning as hanning,
  381. bartlett as bartlett,
  382. blackman as blackman,
  383. kaiser as kaiser,
  384. trapz as trapz,
  385. i0 as i0,
  386. add_newdoc as add_newdoc,
  387. add_docstring as add_docstring,
  388. meshgrid as meshgrid,
  389. delete as delete,
  390. insert as insert,
  391. append as append,
  392. interp as interp,
  393. add_newdoc_ufunc as add_newdoc_ufunc,
  394. quantile as quantile,
  395. )
  396. from numpy.lib.index_tricks import (
  397. ravel_multi_index as ravel_multi_index,
  398. unravel_index as unravel_index,
  399. mgrid as mgrid,
  400. ogrid as ogrid,
  401. r_ as r_,
  402. c_ as c_,
  403. s_ as s_,
  404. index_exp as index_exp,
  405. ix_ as ix_,
  406. fill_diagonal as fill_diagonal,
  407. diag_indices as diag_indices,
  408. diag_indices_from as diag_indices_from,
  409. )
  410. from numpy.lib.nanfunctions import (
  411. nansum as nansum,
  412. nanmax as nanmax,
  413. nanmin as nanmin,
  414. nanargmax as nanargmax,
  415. nanargmin as nanargmin,
  416. nanmean as nanmean,
  417. nanmedian as nanmedian,
  418. nanpercentile as nanpercentile,
  419. nanvar as nanvar,
  420. nanstd as nanstd,
  421. nanprod as nanprod,
  422. nancumsum as nancumsum,
  423. nancumprod as nancumprod,
  424. nanquantile as nanquantile,
  425. )
  426. from numpy.lib.npyio import (
  427. savetxt as savetxt,
  428. loadtxt as loadtxt,
  429. genfromtxt as genfromtxt,
  430. recfromtxt as recfromtxt,
  431. recfromcsv as recfromcsv,
  432. load as load,
  433. loads as loads,
  434. save as save,
  435. savez as savez,
  436. savez_compressed as savez_compressed,
  437. packbits as packbits,
  438. unpackbits as unpackbits,
  439. fromregex as fromregex,
  440. )
  441. from numpy.lib.polynomial import (
  442. poly as poly,
  443. roots as roots,
  444. polyint as polyint,
  445. polyder as polyder,
  446. polyadd as polyadd,
  447. polysub as polysub,
  448. polymul as polymul,
  449. polydiv as polydiv,
  450. polyval as polyval,
  451. polyfit as polyfit,
  452. )
  453. from numpy.lib.shape_base import (
  454. column_stack as column_stack,
  455. row_stack as row_stack,
  456. dstack as dstack,
  457. array_split as array_split,
  458. split as split,
  459. hsplit as hsplit,
  460. vsplit as vsplit,
  461. dsplit as dsplit,
  462. apply_over_axes as apply_over_axes,
  463. expand_dims as expand_dims,
  464. apply_along_axis as apply_along_axis,
  465. kron as kron,
  466. tile as tile,
  467. get_array_wrap as get_array_wrap,
  468. take_along_axis as take_along_axis,
  469. put_along_axis as put_along_axis,
  470. )
  471. from numpy.lib.stride_tricks import (
  472. broadcast_to as broadcast_to,
  473. broadcast_arrays as broadcast_arrays,
  474. broadcast_shapes as broadcast_shapes,
  475. )
  476. from numpy.lib.twodim_base import (
  477. diag as diag,
  478. diagflat as diagflat,
  479. eye as eye,
  480. fliplr as fliplr,
  481. flipud as flipud,
  482. tri as tri,
  483. triu as triu,
  484. tril as tril,
  485. vander as vander,
  486. histogram2d as histogram2d,
  487. mask_indices as mask_indices,
  488. tril_indices as tril_indices,
  489. tril_indices_from as tril_indices_from,
  490. triu_indices as triu_indices,
  491. triu_indices_from as triu_indices_from,
  492. )
  493. from numpy.lib.type_check import (
  494. mintypecode as mintypecode,
  495. asfarray as asfarray,
  496. real as real,
  497. imag as imag,
  498. iscomplex as iscomplex,
  499. isreal as isreal,
  500. iscomplexobj as iscomplexobj,
  501. isrealobj as isrealobj,
  502. nan_to_num as nan_to_num,
  503. real_if_close as real_if_close,
  504. typename as typename,
  505. common_type as common_type,
  506. )
  507. from numpy.lib.ufunclike import (
  508. fix as fix,
  509. isposinf as isposinf,
  510. isneginf as isneginf,
  511. )
  512. from numpy.lib.utils import (
  513. issubclass_ as issubclass_,
  514. issubsctype as issubsctype,
  515. issubdtype as issubdtype,
  516. deprecate as deprecate,
  517. deprecate_with_doc as deprecate_with_doc,
  518. get_include as get_include,
  519. info as info,
  520. source as source,
  521. who as who,
  522. lookfor as lookfor,
  523. byte_bounds as byte_bounds,
  524. safe_eval as safe_eval,
  525. )
  526. __all__: List[str]
  527. __path__: List[str]
  528. __version__: str
  529. __git_version__: str
  530. # TODO: Move placeholders to their respective module once
  531. # their annotations are properly implemented
  532. #
  533. # Placeholders for classes
  534. # TODO: Remove `__getattr__` once the classes are stubbed out
  535. class MachAr:
  536. def __init__(
  537. self,
  538. float_conv: Any = ...,
  539. int_conv: Any = ...,
  540. float_to_float: Any = ...,
  541. float_to_str: Any = ...,
  542. title: Any = ...,
  543. ) -> None: ...
  544. def __getattr__(self, key: str) -> Any: ...
  545. class busdaycalendar:
  546. def __new__(cls, weekmask: Any = ..., holidays: Any = ...) -> Any: ...
  547. def __getattr__(self, key: str) -> Any: ...
  548. class chararray(ndarray[_ShapeType, _DType_co]):
  549. def __new__(
  550. subtype,
  551. shape: Any,
  552. itemsize: Any = ...,
  553. unicode: Any = ...,
  554. buffer: Any = ...,
  555. offset: Any = ...,
  556. strides: Any = ...,
  557. order: Any = ...,
  558. ) -> Any: ...
  559. def __array_finalize__(self, obj): ...
  560. def argsort(self, axis=..., kind=..., order=...): ...
  561. def capitalize(self): ...
  562. def center(self, width, fillchar=...): ...
  563. def count(self, sub, start=..., end=...): ...
  564. def decode(self, encoding=..., errors=...): ...
  565. def encode(self, encoding=..., errors=...): ...
  566. def endswith(self, suffix, start=..., end=...): ...
  567. def expandtabs(self, tabsize=...): ...
  568. def find(self, sub, start=..., end=...): ...
  569. def index(self, sub, start=..., end=...): ...
  570. def isalnum(self): ...
  571. def isalpha(self): ...
  572. def isdigit(self): ...
  573. def islower(self): ...
  574. def isspace(self): ...
  575. def istitle(self): ...
  576. def isupper(self): ...
  577. def join(self, seq): ...
  578. def ljust(self, width, fillchar=...): ...
  579. def lower(self): ...
  580. def lstrip(self, chars=...): ...
  581. def partition(self, sep): ...
  582. def replace(self, old, new, count=...): ...
  583. def rfind(self, sub, start=..., end=...): ...
  584. def rindex(self, sub, start=..., end=...): ...
  585. def rjust(self, width, fillchar=...): ...
  586. def rpartition(self, sep): ...
  587. def rsplit(self, sep=..., maxsplit=...): ...
  588. def rstrip(self, chars=...): ...
  589. def split(self, sep=..., maxsplit=...): ...
  590. def splitlines(self, keepends=...): ...
  591. def startswith(self, prefix, start=..., end=...): ...
  592. def strip(self, chars=...): ...
  593. def swapcase(self): ...
  594. def title(self): ...
  595. def translate(self, table, deletechars=...): ...
  596. def upper(self): ...
  597. def zfill(self, width): ...
  598. def isnumeric(self): ...
  599. def isdecimal(self): ...
  600. class finfo:
  601. def __new__(cls, dtype: Any) -> Any: ...
  602. def __getattr__(self, key: str) -> Any: ...
  603. class format_parser:
  604. def __init__(
  605. self,
  606. formats: Any,
  607. names: Any,
  608. titles: Any,
  609. aligned: Any = ...,
  610. byteorder: Any = ...,
  611. ) -> None: ...
  612. class iinfo:
  613. def __init__(self, int_type: Any) -> None: ...
  614. def __getattr__(self, key: str) -> Any: ...
  615. class matrix(ndarray[_ShapeType, _DType_co]):
  616. def __new__(
  617. subtype,
  618. data: Any,
  619. dtype: Any = ...,
  620. copy: Any = ...,
  621. ) -> Any: ...
  622. def __array_finalize__(self, obj): ...
  623. def __getitem__(self, index): ...
  624. def __mul__(self, other): ...
  625. def __rmul__(self, other): ...
  626. def __imul__(self, other): ...
  627. def __pow__(self, other): ...
  628. def __ipow__(self, other): ...
  629. def __rpow__(self, other): ...
  630. def tolist(self): ...
  631. def sum(self, axis=..., dtype=..., out=...): ...
  632. def squeeze(self, axis=...): ...
  633. def flatten(self, order=...): ...
  634. def mean(self, axis=..., dtype=..., out=...): ...
  635. def std(self, axis=..., dtype=..., out=..., ddof=...): ...
  636. def var(self, axis=..., dtype=..., out=..., ddof=...): ...
  637. def prod(self, axis=..., dtype=..., out=...): ...
  638. def any(self, axis=..., out=...): ...
  639. def all(self, axis=..., out=...): ...
  640. def max(self, axis=..., out=...): ...
  641. def argmax(self, axis=..., out=...): ...
  642. def min(self, axis=..., out=...): ...
  643. def argmin(self, axis=..., out=...): ...
  644. def ptp(self, axis=..., out=...): ...
  645. def ravel(self, order=...): ...
  646. @property
  647. def T(self): ...
  648. @property
  649. def I(self): ...
  650. @property
  651. def A(self): ...
  652. @property
  653. def A1(self): ...
  654. @property
  655. def H(self): ...
  656. def getT(self): ...
  657. def getA(self): ...
  658. def getA1(self): ...
  659. def getH(self): ...
  660. def getI(self): ...
  661. class memmap(ndarray[_ShapeType, _DType_co]):
  662. def __new__(
  663. subtype,
  664. filename: Any,
  665. dtype: Any = ...,
  666. mode: Any = ...,
  667. offset: Any = ...,
  668. shape: Any = ...,
  669. order: Any = ...,
  670. ) -> Any: ...
  671. def __getattr__(self, key: str) -> Any: ...
  672. class nditer:
  673. def __new__(
  674. cls,
  675. op: Any,
  676. flags: Any = ...,
  677. op_flags: Any = ...,
  678. op_dtypes: Any = ...,
  679. order: Any = ...,
  680. casting: Any = ...,
  681. op_axes: Any = ...,
  682. itershape: Any = ...,
  683. buffersize: Any = ...,
  684. ) -> Any: ...
  685. def __getattr__(self, key: str) -> Any: ...
  686. def __enter__(self) -> nditer: ...
  687. def __exit__(
  688. self,
  689. exc_type: None | Type[BaseException],
  690. exc_value: None | BaseException,
  691. traceback: None | TracebackType,
  692. ) -> None: ...
  693. def __iter__(self) -> Iterator[Any]: ...
  694. def __next__(self) -> Any: ...
  695. def __len__(self) -> int: ...
  696. def __copy__(self) -> nditer: ...
  697. def __getitem__(self, index: SupportsIndex | slice) -> Any: ...
  698. def __setitem__(self, index: SupportsIndex | slice, value: Any) -> None: ...
  699. def __delitem__(self, key: SupportsIndex | slice) -> None: ...
  700. class poly1d:
  701. def __init__(
  702. self,
  703. c_or_r: Any,
  704. r: Any = ...,
  705. variable: Any = ...,
  706. ) -> None: ...
  707. def __call__(self, val: Any) -> Any: ...
  708. __hash__: Any
  709. @property
  710. def coeffs(self): ...
  711. @coeffs.setter
  712. def coeffs(self, value): ...
  713. @property
  714. def c(self): ...
  715. @c.setter
  716. def c(self, value): ...
  717. @property
  718. def coef(self): ...
  719. @coef.setter
  720. def coef(self, value): ...
  721. @property
  722. def coefficients(self): ...
  723. @coefficients.setter
  724. def coefficients(self, value): ...
  725. @property
  726. def variable(self): ...
  727. @property
  728. def order(self): ...
  729. @property
  730. def o(self): ...
  731. @property
  732. def roots(self): ...
  733. @property
  734. def r(self): ...
  735. def __array__(self, t=...): ...
  736. def __len__(self): ...
  737. def __neg__(self): ...
  738. def __pos__(self): ...
  739. def __mul__(self, other): ...
  740. def __rmul__(self, other): ...
  741. def __add__(self, other): ...
  742. def __radd__(self, other): ...
  743. def __pow__(self, val): ...
  744. def __sub__(self, other): ...
  745. def __rsub__(self, other): ...
  746. def __div__(self, other): ...
  747. def __truediv__(self, other): ...
  748. def __rdiv__(self, other): ...
  749. def __rtruediv__(self, other): ...
  750. def __eq__(self, other): ...
  751. def __ne__(self, other): ...
  752. def __getitem__(self, val): ...
  753. def __setitem__(self, key, val): ...
  754. def __iter__(self): ...
  755. def integ(self, m=..., k=...): ...
  756. def deriv(self, m=...): ...
  757. class recarray(ndarray[_ShapeType, _DType_co]):
  758. def __new__(
  759. subtype,
  760. shape: Any,
  761. dtype: Any = ...,
  762. buf: Any = ...,
  763. offset: Any = ...,
  764. strides: Any = ...,
  765. formats: Any = ...,
  766. names: Any = ...,
  767. titles: Any = ...,
  768. byteorder: Any = ...,
  769. aligned: Any = ...,
  770. order: Any = ...,
  771. ) -> Any: ...
  772. def __array_finalize__(self, obj): ...
  773. def __getattribute__(self, attr): ...
  774. def __setattr__(self, attr, val): ...
  775. def __getitem__(self, indx): ...
  776. def field(self, attr, val=...): ...
  777. class record(void):
  778. def __getattribute__(self, attr): ...
  779. def __setattr__(self, attr, val): ...
  780. def __getitem__(self, indx): ...
  781. def pprint(self): ...
  782. class vectorize:
  783. pyfunc: Any
  784. cache: Any
  785. signature: Any
  786. otypes: Any
  787. excluded: Any
  788. __doc__: Any
  789. def __init__(
  790. self,
  791. pyfunc,
  792. otypes: Any = ...,
  793. doc: Any = ...,
  794. excluded: Any = ...,
  795. cache: Any = ...,
  796. signature: Any = ...,
  797. ) -> None: ...
  798. def __call__(self, *args: Any, **kwargs: Any) -> Any: ...
  799. # Placeholders for Python-based functions
  800. def asmatrix(data, dtype=...): ...
  801. def asscalar(a): ...
  802. def cumproduct(*args, **kwargs): ...
  803. def histogram(a, bins=..., range=..., normed=..., weights=..., density=...): ...
  804. def histogram_bin_edges(a, bins=..., range=..., weights=...): ...
  805. def histogramdd(sample, bins=..., range=..., normed=..., weights=..., density=...): ...
  806. def mat(data, dtype=...): ...
  807. def max(a, axis=..., out=..., keepdims=..., initial=..., where=...): ...
  808. def min(a, axis=..., out=..., keepdims=..., initial=..., where=...): ...
  809. def product(*args, **kwargs): ...
  810. def round(a, decimals=..., out=...): ...
  811. def round_(a, decimals=..., out=...): ...
  812. def show_config(): ...
  813. # Placeholders for C-based functions
  814. # TODO: Sort out which parameters are positional-only
  815. @overload
  816. def arange(stop, dtype=..., *, like=...): ...
  817. @overload
  818. def arange(start, stop, step=..., dtype=..., *, like=...): ...
  819. def busday_count(
  820. begindates,
  821. enddates,
  822. weekmask=...,
  823. holidays=...,
  824. busdaycal=...,
  825. out=...,
  826. ): ...
  827. def busday_offset(
  828. dates,
  829. offsets,
  830. roll=...,
  831. weekmask=...,
  832. holidays=...,
  833. busdaycal=...,
  834. out=...,
  835. ): ...
  836. def can_cast(from_, to, casting=...): ...
  837. def compare_chararrays(a, b, cmp_op, rstrip): ...
  838. def concatenate(__a, axis=..., out=..., dtype=..., casting=...): ...
  839. def copyto(dst, src, casting=..., where=...): ...
  840. def datetime_as_string(arr, unit=..., timezone=..., casting=...): ...
  841. def datetime_data(__dtype): ...
  842. def dot(a, b, out=...): ...
  843. def frombuffer(buffer, dtype=..., count=..., offset=..., *, like=...): ...
  844. def fromfile(
  845. file, dtype=..., count=..., sep=..., offset=..., *, like=...
  846. ): ...
  847. def fromiter(iter, dtype, count=..., *, like=...): ...
  848. def frompyfunc(func, nin, nout, * identity): ...
  849. def fromstring(string, dtype=..., count=..., sep=..., *, like=...): ...
  850. def geterrobj(): ...
  851. def inner(a, b): ...
  852. def is_busday(
  853. dates, weekmask=..., holidays=..., busdaycal=..., out=...
  854. ): ...
  855. def lexsort(keys, axis=...): ...
  856. def may_share_memory(a, b, max_work=...): ...
  857. def min_scalar_type(a): ...
  858. def nested_iters(*args, **kwargs): ... # TODO: Sort out parameters
  859. def promote_types(type1, type2): ...
  860. def putmask(a, mask, values): ...
  861. def result_type(*arrays_and_dtypes): ...
  862. def seterrobj(errobj): ...
  863. def shares_memory(a, b, max_work=...): ...
  864. def vdot(a, b): ...
  865. @overload
  866. def where(__condition): ...
  867. @overload
  868. def where(__condition, __x, __y): ...
  869. _NdArraySubClass = TypeVar("_NdArraySubClass", bound=ndarray)
  870. _DTypeScalar_co = TypeVar("_DTypeScalar_co", covariant=True, bound=generic)
  871. _ByteOrder = L["S", "<", ">", "=", "|", "L", "B", "N", "I"]
  872. class dtype(Generic[_DTypeScalar_co]):
  873. names: Optional[Tuple[builtins.str, ...]]
  874. # Overload for subclass of generic
  875. @overload
  876. def __new__(
  877. cls,
  878. dtype: Type[_DTypeScalar_co],
  879. align: bool = ...,
  880. copy: bool = ...,
  881. ) -> dtype[_DTypeScalar_co]: ...
  882. # Overloads for string aliases, Python types, and some assorted
  883. # other special cases. Order is sometimes important because of the
  884. # subtype relationships
  885. #
  886. # bool < int < float < complex < object
  887. #
  888. # so we have to make sure the overloads for the narrowest type is
  889. # first.
  890. # Builtin types
  891. @overload
  892. def __new__(cls, dtype: Type[bool], align: bool = ..., copy: bool = ...) -> dtype[bool_]: ...
  893. @overload
  894. def __new__(cls, dtype: Type[int], align: bool = ..., copy: bool = ...) -> dtype[int_]: ...
  895. @overload
  896. def __new__(cls, dtype: Optional[Type[float]], align: bool = ..., copy: bool = ...) -> dtype[float_]: ...
  897. @overload
  898. def __new__(cls, dtype: Type[complex], align: bool = ..., copy: bool = ...) -> dtype[complex_]: ...
  899. @overload
  900. def __new__(cls, dtype: Type[builtins.str], align: bool = ..., copy: bool = ...) -> dtype[str_]: ...
  901. @overload
  902. def __new__(cls, dtype: Type[bytes], align: bool = ..., copy: bool = ...) -> dtype[bytes_]: ...
  903. # `unsignedinteger` string-based representations and ctypes
  904. @overload
  905. def __new__(cls, dtype: _UInt8Codes | Type[ct.c_uint8], align: bool = ..., copy: bool = ...) -> dtype[uint8]: ...
  906. @overload
  907. def __new__(cls, dtype: _UInt16Codes | Type[ct.c_uint16], align: bool = ..., copy: bool = ...) -> dtype[uint16]: ...
  908. @overload
  909. def __new__(cls, dtype: _UInt32Codes | Type[ct.c_uint32], align: bool = ..., copy: bool = ...) -> dtype[uint32]: ...
  910. @overload
  911. def __new__(cls, dtype: _UInt64Codes | Type[ct.c_uint64], align: bool = ..., copy: bool = ...) -> dtype[uint64]: ...
  912. @overload
  913. def __new__(cls, dtype: _UByteCodes | Type[ct.c_ubyte], align: bool = ..., copy: bool = ...) -> dtype[ubyte]: ...
  914. @overload
  915. def __new__(cls, dtype: _UShortCodes | Type[ct.c_ushort], align: bool = ..., copy: bool = ...) -> dtype[ushort]: ...
  916. @overload
  917. def __new__(cls, dtype: _UIntCCodes | Type[ct.c_uint], align: bool = ..., copy: bool = ...) -> dtype[uintc]: ...
  918. # NOTE: We're assuming here that `uint_ptr_t == size_t`,
  919. # an assumption that does not hold in rare cases (same for `ssize_t`)
  920. @overload
  921. def __new__(cls, dtype: _UIntPCodes | Type[ct.c_void_p] | Type[ct.c_size_t], align: bool = ..., copy: bool = ...) -> dtype[uintp]: ...
  922. @overload
  923. def __new__(cls, dtype: _UIntCodes | Type[ct.c_ulong], align: bool = ..., copy: bool = ...) -> dtype[uint]: ...
  924. @overload
  925. def __new__(cls, dtype: _ULongLongCodes | Type[ct.c_ulonglong], align: bool = ..., copy: bool = ...) -> dtype[ulonglong]: ...
  926. # `signedinteger` string-based representations and ctypes
  927. @overload
  928. def __new__(cls, dtype: _Int8Codes | Type[ct.c_int8], align: bool = ..., copy: bool = ...) -> dtype[int8]: ...
  929. @overload
  930. def __new__(cls, dtype: _Int16Codes | Type[ct.c_int16], align: bool = ..., copy: bool = ...) -> dtype[int16]: ...
  931. @overload
  932. def __new__(cls, dtype: _Int32Codes | Type[ct.c_int32], align: bool = ..., copy: bool = ...) -> dtype[int32]: ...
  933. @overload
  934. def __new__(cls, dtype: _Int64Codes | Type[ct.c_int64], align: bool = ..., copy: bool = ...) -> dtype[int64]: ...
  935. @overload
  936. def __new__(cls, dtype: _ByteCodes | Type[ct.c_byte], align: bool = ..., copy: bool = ...) -> dtype[byte]: ...
  937. @overload
  938. def __new__(cls, dtype: _ShortCodes | Type[ct.c_short], align: bool = ..., copy: bool = ...) -> dtype[short]: ...
  939. @overload
  940. def __new__(cls, dtype: _IntCCodes | Type[ct.c_int], align: bool = ..., copy: bool = ...) -> dtype[intc]: ...
  941. @overload
  942. def __new__(cls, dtype: _IntPCodes | Type[ct.c_ssize_t], align: bool = ..., copy: bool = ...) -> dtype[intp]: ...
  943. @overload
  944. def __new__(cls, dtype: _IntCodes | Type[ct.c_long], align: bool = ..., copy: bool = ...) -> dtype[int_]: ...
  945. @overload
  946. def __new__(cls, dtype: _LongLongCodes | Type[ct.c_longlong], align: bool = ..., copy: bool = ...) -> dtype[longlong]: ...
  947. # `floating` string-based representations and ctypes
  948. @overload
  949. def __new__(cls, dtype: _Float16Codes, align: bool = ..., copy: bool = ...) -> dtype[float16]: ...
  950. @overload
  951. def __new__(cls, dtype: _Float32Codes, align: bool = ..., copy: bool = ...) -> dtype[float32]: ...
  952. @overload
  953. def __new__(cls, dtype: _Float64Codes, align: bool = ..., copy: bool = ...) -> dtype[float64]: ...
  954. @overload
  955. def __new__(cls, dtype: _HalfCodes, align: bool = ..., copy: bool = ...) -> dtype[half]: ...
  956. @overload
  957. def __new__(cls, dtype: _SingleCodes | Type[ct.c_float], align: bool = ..., copy: bool = ...) -> dtype[single]: ...
  958. @overload
  959. def __new__(cls, dtype: _DoubleCodes | Type[ct.c_double], align: bool = ..., copy: bool = ...) -> dtype[double]: ...
  960. @overload
  961. def __new__(cls, dtype: _LongDoubleCodes | Type[ct.c_longdouble], align: bool = ..., copy: bool = ...) -> dtype[longdouble]: ...
  962. # `complexfloating` string-based representations
  963. @overload
  964. def __new__(cls, dtype: _Complex64Codes, align: bool = ..., copy: bool = ...) -> dtype[complex64]: ...
  965. @overload
  966. def __new__(cls, dtype: _Complex128Codes, align: bool = ..., copy: bool = ...) -> dtype[complex128]: ...
  967. @overload
  968. def __new__(cls, dtype: _CSingleCodes, align: bool = ..., copy: bool = ...) -> dtype[csingle]: ...
  969. @overload
  970. def __new__(cls, dtype: _CDoubleCodes, align: bool = ..., copy: bool = ...) -> dtype[cdouble]: ...
  971. @overload
  972. def __new__(cls, dtype: _CLongDoubleCodes, align: bool = ..., copy: bool = ...) -> dtype[clongdouble]: ...
  973. # Miscellaneous string-based representations and ctypes
  974. @overload
  975. def __new__(cls, dtype: _BoolCodes | Type[ct.c_bool], align: bool = ..., copy: bool = ...) -> dtype[bool_]: ...
  976. @overload
  977. def __new__(cls, dtype: _TD64Codes, align: bool = ..., copy: bool = ...) -> dtype[timedelta64]: ...
  978. @overload
  979. def __new__(cls, dtype: _DT64Codes, align: bool = ..., copy: bool = ...) -> dtype[datetime64]: ...
  980. @overload
  981. def __new__(cls, dtype: _StrCodes, align: bool = ..., copy: bool = ...) -> dtype[str_]: ...
  982. @overload
  983. def __new__(cls, dtype: _BytesCodes | Type[ct.c_char], align: bool = ..., copy: bool = ...) -> dtype[bytes_]: ...
  984. @overload
  985. def __new__(cls, dtype: _VoidCodes, align: bool = ..., copy: bool = ...) -> dtype[void]: ...
  986. @overload
  987. def __new__(cls, dtype: _ObjectCodes | Type[ct.py_object], align: bool = ..., copy: bool = ...) -> dtype[object_]: ...
  988. # dtype of a dtype is the same dtype
  989. @overload
  990. def __new__(
  991. cls,
  992. dtype: dtype[_DTypeScalar_co],
  993. align: bool = ...,
  994. copy: bool = ...,
  995. ) -> dtype[_DTypeScalar_co]: ...
  996. @overload
  997. def __new__(
  998. cls,
  999. dtype: _SupportsDType[dtype[_DTypeScalar_co]],
  1000. align: bool = ...,
  1001. copy: bool = ...,
  1002. ) -> dtype[_DTypeScalar_co]: ...
  1003. # Handle strings that can't be expressed as literals; i.e. s1, s2, ...
  1004. @overload
  1005. def __new__(
  1006. cls,
  1007. dtype: builtins.str,
  1008. align: bool = ...,
  1009. copy: bool = ...,
  1010. ) -> dtype[Any]: ...
  1011. # Catchall overload for void-likes
  1012. @overload
  1013. def __new__(
  1014. cls,
  1015. dtype: _VoidDTypeLike,
  1016. align: bool = ...,
  1017. copy: bool = ...,
  1018. ) -> dtype[void]: ...
  1019. # Catchall overload for object-likes
  1020. @overload
  1021. def __new__(
  1022. cls,
  1023. dtype: Type[object],
  1024. align: bool = ...,
  1025. copy: bool = ...,
  1026. ) -> dtype[object_]: ...
  1027. @overload
  1028. def __getitem__(self: dtype[void], key: List[builtins.str]) -> dtype[void]: ...
  1029. @overload
  1030. def __getitem__(self: dtype[void], key: Union[builtins.str, int]) -> dtype[Any]: ...
  1031. # NOTE: In the future 1-based multiplications will also yield `void` dtypes
  1032. @overload
  1033. def __mul__(self, value: L[0]) -> None: ... # type: ignore[misc]
  1034. @overload
  1035. def __mul__(self: _DType, value: L[1]) -> _DType: ...
  1036. @overload
  1037. def __mul__(self, value: int) -> dtype[void]: ...
  1038. # NOTE: `__rmul__` seems to be broken when used in combination with
  1039. # literals as of mypy 0.800. Set the return-type to `Any` for now.
  1040. def __rmul__(self, value: int) -> Any: ...
  1041. def __gt__(self, other: DTypeLike) -> bool: ...
  1042. def __ge__(self, other: DTypeLike) -> bool: ...
  1043. def __lt__(self, other: DTypeLike) -> bool: ...
  1044. def __le__(self, other: DTypeLike) -> bool: ...
  1045. @property
  1046. def alignment(self) -> int: ...
  1047. @property
  1048. def base(self: _DType) -> _DType: ...
  1049. @property
  1050. def byteorder(self) -> builtins.str: ...
  1051. @property
  1052. def char(self) -> builtins.str: ...
  1053. @property
  1054. def descr(self) -> List[Union[Tuple[builtins.str, builtins.str], Tuple[builtins.str, builtins.str, _Shape]]]: ...
  1055. @property
  1056. def fields(
  1057. self,
  1058. ) -> Optional[Mapping[builtins.str, Union[Tuple[dtype[Any], int], Tuple[dtype[Any], int, Any]]]]: ...
  1059. @property
  1060. def flags(self) -> int: ...
  1061. @property
  1062. def hasobject(self) -> bool: ...
  1063. @property
  1064. def isbuiltin(self) -> int: ...
  1065. @property
  1066. def isnative(self) -> bool: ...
  1067. @property
  1068. def isalignedstruct(self) -> bool: ...
  1069. @property
  1070. def itemsize(self) -> int: ...
  1071. @property
  1072. def kind(self) -> builtins.str: ...
  1073. @property
  1074. def metadata(self) -> Optional[Mapping[builtins.str, Any]]: ...
  1075. @property
  1076. def name(self) -> builtins.str: ...
  1077. @property
  1078. def names(self) -> Optional[Tuple[str, ...]]: ...
  1079. @property
  1080. def num(self) -> int: ...
  1081. @property
  1082. def shape(self) -> _Shape: ...
  1083. @property
  1084. def ndim(self) -> int: ...
  1085. @property
  1086. def subdtype(self: _DType) -> Optional[Tuple[_DType, _Shape]]: ...
  1087. def newbyteorder(self: _DType, __new_order: _ByteOrder = ...) -> _DType: ...
  1088. @property
  1089. def str(self) -> builtins.str: ...
  1090. @property
  1091. def type(self) -> Type[_DTypeScalar_co]: ...
  1092. class _flagsobj:
  1093. aligned: bool
  1094. updateifcopy: bool
  1095. writeable: bool
  1096. writebackifcopy: bool
  1097. @property
  1098. def behaved(self) -> bool: ...
  1099. @property
  1100. def c_contiguous(self) -> bool: ...
  1101. @property
  1102. def carray(self) -> bool: ...
  1103. @property
  1104. def contiguous(self) -> bool: ...
  1105. @property
  1106. def f_contiguous(self) -> bool: ...
  1107. @property
  1108. def farray(self) -> bool: ...
  1109. @property
  1110. def fnc(self) -> bool: ...
  1111. @property
  1112. def forc(self) -> bool: ...
  1113. @property
  1114. def fortran(self) -> bool: ...
  1115. @property
  1116. def num(self) -> int: ...
  1117. @property
  1118. def owndata(self) -> bool: ...
  1119. def __getitem__(self, key: str) -> bool: ...
  1120. def __setitem__(self, key: str, value: bool) -> None: ...
  1121. _ArrayLikeInt = Union[
  1122. int,
  1123. integer,
  1124. Sequence[Union[int, integer]],
  1125. Sequence[Sequence[Any]], # TODO: wait for support for recursive types
  1126. ndarray
  1127. ]
  1128. _FlatIterSelf = TypeVar("_FlatIterSelf", bound=flatiter)
  1129. class flatiter(Generic[_NdArraySubClass]):
  1130. @property
  1131. def base(self) -> _NdArraySubClass: ...
  1132. @property
  1133. def coords(self) -> _Shape: ...
  1134. @property
  1135. def index(self) -> int: ...
  1136. def copy(self) -> _NdArraySubClass: ...
  1137. def __iter__(self: _FlatIterSelf) -> _FlatIterSelf: ...
  1138. def __next__(self: flatiter[ndarray[Any, dtype[_ScalarType]]]) -> _ScalarType: ...
  1139. def __len__(self) -> int: ...
  1140. @overload
  1141. def __getitem__(
  1142. self: flatiter[ndarray[Any, dtype[_ScalarType]]],
  1143. key: Union[int, integer],
  1144. ) -> _ScalarType: ...
  1145. @overload
  1146. def __getitem__(
  1147. self, key: Union[_ArrayLikeInt, slice, ellipsis],
  1148. ) -> _NdArraySubClass: ...
  1149. @overload
  1150. def __array__(self: flatiter[ndarray[Any, _DType]], __dtype: None = ...) -> ndarray[Any, _DType]: ...
  1151. @overload
  1152. def __array__(self, __dtype: _DType) -> ndarray[Any, _DType]: ...
  1153. _OrderKACF = Optional[L["K", "A", "C", "F"]]
  1154. _OrderACF = Optional[L["A", "C", "F"]]
  1155. _OrderCF = Optional[L["C", "F"]]
  1156. _ModeKind = L["raise", "wrap", "clip"]
  1157. _PartitionKind = L["introselect"]
  1158. _SortKind = L["quicksort", "mergesort", "heapsort", "stable"]
  1159. _SortSide = L["left", "right"]
  1160. _ArraySelf = TypeVar("_ArraySelf", bound=_ArrayOrScalarCommon)
  1161. class _ArrayOrScalarCommon:
  1162. @property
  1163. def T(self: _ArraySelf) -> _ArraySelf: ...
  1164. @property
  1165. def data(self) -> memoryview: ...
  1166. @property
  1167. def flags(self) -> _flagsobj: ...
  1168. @property
  1169. def itemsize(self) -> int: ...
  1170. @property
  1171. def nbytes(self) -> int: ...
  1172. def __bool__(self) -> bool: ...
  1173. def __bytes__(self) -> bytes: ...
  1174. def __str__(self) -> str: ...
  1175. def __repr__(self) -> str: ...
  1176. def __copy__(self: _ArraySelf) -> _ArraySelf: ...
  1177. def __deepcopy__(self: _ArraySelf, __memo: Optional[dict] = ...) -> _ArraySelf: ...
  1178. def __eq__(self, other): ...
  1179. def __ne__(self, other): ...
  1180. def copy(self: _ArraySelf, order: _OrderKACF = ...) -> _ArraySelf: ...
  1181. def dump(self, file: str) -> None: ...
  1182. def dumps(self) -> bytes: ...
  1183. def tobytes(self, order: _OrderKACF = ...) -> bytes: ...
  1184. # NOTE: `tostring()` is deprecated and therefore excluded
  1185. # def tostring(self, order=...): ...
  1186. def tofile(
  1187. self, fid: Union[IO[bytes], str, bytes, os.PathLike[Any]], sep: str = ..., format: str = ...
  1188. ) -> None: ...
  1189. # generics and 0d arrays return builtin scalars
  1190. def tolist(self) -> Any: ...
  1191. # TODO: Add proper signatures
  1192. def __getitem__(self, key) -> Any: ...
  1193. @property
  1194. def __array_interface__(self): ...
  1195. @property
  1196. def __array_priority__(self): ...
  1197. @property
  1198. def __array_struct__(self): ...
  1199. def __array_wrap__(array, context=...): ...
  1200. def __setstate__(self, __state): ...
  1201. # a `bool_` is returned when `keepdims=True` and `self` is a 0d array
  1202. @overload
  1203. def all(
  1204. self,
  1205. axis: None = ...,
  1206. out: None = ...,
  1207. keepdims: L[False] = ...,
  1208. ) -> bool_: ...
  1209. @overload
  1210. def all(
  1211. self,
  1212. axis: Optional[_ShapeLike] = ...,
  1213. out: None = ...,
  1214. keepdims: bool = ...,
  1215. ) -> Any: ...
  1216. @overload
  1217. def all(
  1218. self,
  1219. axis: Optional[_ShapeLike] = ...,
  1220. out: _NdArraySubClass = ...,
  1221. keepdims: bool = ...,
  1222. ) -> _NdArraySubClass: ...
  1223. @overload
  1224. def any(
  1225. self,
  1226. axis: None = ...,
  1227. out: None = ...,
  1228. keepdims: L[False] = ...,
  1229. ) -> bool_: ...
  1230. @overload
  1231. def any(
  1232. self,
  1233. axis: Optional[_ShapeLike] = ...,
  1234. out: None = ...,
  1235. keepdims: bool = ...,
  1236. ) -> Any: ...
  1237. @overload
  1238. def any(
  1239. self,
  1240. axis: Optional[_ShapeLike] = ...,
  1241. out: _NdArraySubClass = ...,
  1242. keepdims: bool = ...,
  1243. ) -> _NdArraySubClass: ...
  1244. @overload
  1245. def argmax(
  1246. self,
  1247. axis: None = ...,
  1248. out: None = ...,
  1249. ) -> intp: ...
  1250. @overload
  1251. def argmax(
  1252. self,
  1253. axis: _ShapeLike = ...,
  1254. out: None = ...,
  1255. ) -> Any: ...
  1256. @overload
  1257. def argmax(
  1258. self,
  1259. axis: Optional[_ShapeLike] = ...,
  1260. out: _NdArraySubClass = ...,
  1261. ) -> _NdArraySubClass: ...
  1262. @overload
  1263. def argmin(
  1264. self,
  1265. axis: None = ...,
  1266. out: None = ...,
  1267. ) -> intp: ...
  1268. @overload
  1269. def argmin(
  1270. self,
  1271. axis: _ShapeLike = ...,
  1272. out: None = ...,
  1273. ) -> Any: ...
  1274. @overload
  1275. def argmin(
  1276. self,
  1277. axis: Optional[_ShapeLike] = ...,
  1278. out: _NdArraySubClass = ...,
  1279. ) -> _NdArraySubClass: ...
  1280. def argsort(
  1281. self,
  1282. axis: Optional[SupportsIndex] = ...,
  1283. kind: Optional[_SortKind] = ...,
  1284. order: Union[None, str, Sequence[str]] = ...,
  1285. ) -> ndarray: ...
  1286. @overload
  1287. def choose(
  1288. self,
  1289. choices: ArrayLike,
  1290. out: None = ...,
  1291. mode: _ModeKind = ...,
  1292. ) -> ndarray: ...
  1293. @overload
  1294. def choose(
  1295. self,
  1296. choices: ArrayLike,
  1297. out: _NdArraySubClass = ...,
  1298. mode: _ModeKind = ...,
  1299. ) -> _NdArraySubClass: ...
  1300. @overload
  1301. def clip(
  1302. self,
  1303. min: ArrayLike = ...,
  1304. max: Optional[ArrayLike] = ...,
  1305. out: None = ...,
  1306. **kwargs: Any,
  1307. ) -> ndarray: ...
  1308. @overload
  1309. def clip(
  1310. self,
  1311. min: None = ...,
  1312. max: ArrayLike = ...,
  1313. out: None = ...,
  1314. **kwargs: Any,
  1315. ) -> ndarray: ...
  1316. @overload
  1317. def clip(
  1318. self,
  1319. min: ArrayLike = ...,
  1320. max: Optional[ArrayLike] = ...,
  1321. out: _NdArraySubClass = ...,
  1322. **kwargs: Any,
  1323. ) -> _NdArraySubClass: ...
  1324. @overload
  1325. def clip(
  1326. self,
  1327. min: None = ...,
  1328. max: ArrayLike = ...,
  1329. out: _NdArraySubClass = ...,
  1330. **kwargs: Any,
  1331. ) -> _NdArraySubClass: ...
  1332. @overload
  1333. def compress(
  1334. self,
  1335. a: ArrayLike,
  1336. axis: Optional[SupportsIndex] = ...,
  1337. out: None = ...,
  1338. ) -> ndarray: ...
  1339. @overload
  1340. def compress(
  1341. self,
  1342. a: ArrayLike,
  1343. axis: Optional[SupportsIndex] = ...,
  1344. out: _NdArraySubClass = ...,
  1345. ) -> _NdArraySubClass: ...
  1346. def conj(self: _ArraySelf) -> _ArraySelf: ...
  1347. def conjugate(self: _ArraySelf) -> _ArraySelf: ...
  1348. @overload
  1349. def cumprod(
  1350. self,
  1351. axis: Optional[SupportsIndex] = ...,
  1352. dtype: DTypeLike = ...,
  1353. out: None = ...,
  1354. ) -> ndarray: ...
  1355. @overload
  1356. def cumprod(
  1357. self,
  1358. axis: Optional[SupportsIndex] = ...,
  1359. dtype: DTypeLike = ...,
  1360. out: _NdArraySubClass = ...,
  1361. ) -> _NdArraySubClass: ...
  1362. @overload
  1363. def cumsum(
  1364. self,
  1365. axis: Optional[SupportsIndex] = ...,
  1366. dtype: DTypeLike = ...,
  1367. out: None = ...,
  1368. ) -> ndarray: ...
  1369. @overload
  1370. def cumsum(
  1371. self,
  1372. axis: Optional[SupportsIndex] = ...,
  1373. dtype: DTypeLike = ...,
  1374. out: _NdArraySubClass = ...,
  1375. ) -> _NdArraySubClass: ...
  1376. @overload
  1377. def max(
  1378. self,
  1379. axis: Optional[_ShapeLike] = ...,
  1380. out: None = ...,
  1381. keepdims: bool = ...,
  1382. initial: _NumberLike_co = ...,
  1383. where: _ArrayLikeBool_co = ...,
  1384. ) -> Any: ...
  1385. @overload
  1386. def max(
  1387. self,
  1388. axis: Optional[_ShapeLike] = ...,
  1389. out: _NdArraySubClass = ...,
  1390. keepdims: bool = ...,
  1391. initial: _NumberLike_co = ...,
  1392. where: _ArrayLikeBool_co = ...,
  1393. ) -> _NdArraySubClass: ...
  1394. @overload
  1395. def mean(
  1396. self,
  1397. axis: Optional[_ShapeLike] = ...,
  1398. dtype: DTypeLike = ...,
  1399. out: None = ...,
  1400. keepdims: bool = ...,
  1401. ) -> Any: ...
  1402. @overload
  1403. def mean(
  1404. self,
  1405. axis: Optional[_ShapeLike] = ...,
  1406. dtype: DTypeLike = ...,
  1407. out: _NdArraySubClass = ...,
  1408. keepdims: bool = ...,
  1409. ) -> _NdArraySubClass: ...
  1410. @overload
  1411. def min(
  1412. self,
  1413. axis: Optional[_ShapeLike] = ...,
  1414. out: None = ...,
  1415. keepdims: bool = ...,
  1416. initial: _NumberLike_co = ...,
  1417. where: _ArrayLikeBool_co = ...,
  1418. ) -> Any: ...
  1419. @overload
  1420. def min(
  1421. self,
  1422. axis: Optional[_ShapeLike] = ...,
  1423. out: _NdArraySubClass = ...,
  1424. keepdims: bool = ...,
  1425. initial: _NumberLike_co = ...,
  1426. where: _ArrayLikeBool_co = ...,
  1427. ) -> _NdArraySubClass: ...
  1428. def newbyteorder(
  1429. self: _ArraySelf,
  1430. __new_order: _ByteOrder = ...,
  1431. ) -> _ArraySelf: ...
  1432. @overload
  1433. def prod(
  1434. self,
  1435. axis: Optional[_ShapeLike] = ...,
  1436. dtype: DTypeLike = ...,
  1437. out: None = ...,
  1438. keepdims: bool = ...,
  1439. initial: _NumberLike_co = ...,
  1440. where: _ArrayLikeBool_co = ...,
  1441. ) -> Any: ...
  1442. @overload
  1443. def prod(
  1444. self,
  1445. axis: Optional[_ShapeLike] = ...,
  1446. dtype: DTypeLike = ...,
  1447. out: _NdArraySubClass = ...,
  1448. keepdims: bool = ...,
  1449. initial: _NumberLike_co = ...,
  1450. where: _ArrayLikeBool_co = ...,
  1451. ) -> _NdArraySubClass: ...
  1452. @overload
  1453. def ptp(
  1454. self,
  1455. axis: Optional[_ShapeLike] = ...,
  1456. out: None = ...,
  1457. keepdims: bool = ...,
  1458. ) -> Any: ...
  1459. @overload
  1460. def ptp(
  1461. self,
  1462. axis: Optional[_ShapeLike] = ...,
  1463. out: _NdArraySubClass = ...,
  1464. keepdims: bool = ...,
  1465. ) -> _NdArraySubClass: ...
  1466. @overload
  1467. def round(
  1468. self: _ArraySelf,
  1469. decimals: SupportsIndex = ...,
  1470. out: None = ...,
  1471. ) -> _ArraySelf: ...
  1472. @overload
  1473. def round(
  1474. self,
  1475. decimals: SupportsIndex = ...,
  1476. out: _NdArraySubClass = ...,
  1477. ) -> _NdArraySubClass: ...
  1478. @overload
  1479. def std(
  1480. self,
  1481. axis: Optional[_ShapeLike] = ...,
  1482. dtype: DTypeLike = ...,
  1483. out: None = ...,
  1484. ddof: int = ...,
  1485. keepdims: bool = ...,
  1486. ) -> Any: ...
  1487. @overload
  1488. def std(
  1489. self,
  1490. axis: Optional[_ShapeLike] = ...,
  1491. dtype: DTypeLike = ...,
  1492. out: _NdArraySubClass = ...,
  1493. ddof: int = ...,
  1494. keepdims: bool = ...,
  1495. ) -> _NdArraySubClass: ...
  1496. @overload
  1497. def sum(
  1498. self,
  1499. axis: Optional[_ShapeLike] = ...,
  1500. dtype: DTypeLike = ...,
  1501. out: None = ...,
  1502. keepdims: bool = ...,
  1503. initial: _NumberLike_co = ...,
  1504. where: _ArrayLikeBool_co = ...,
  1505. ) -> Any: ...
  1506. @overload
  1507. def sum(
  1508. self,
  1509. axis: Optional[_ShapeLike] = ...,
  1510. dtype: DTypeLike = ...,
  1511. out: _NdArraySubClass = ...,
  1512. keepdims: bool = ...,
  1513. initial: _NumberLike_co = ...,
  1514. where: _ArrayLikeBool_co = ...,
  1515. ) -> _NdArraySubClass: ...
  1516. @overload
  1517. def var(
  1518. self,
  1519. axis: Optional[_ShapeLike] = ...,
  1520. dtype: DTypeLike = ...,
  1521. out: None = ...,
  1522. ddof: int = ...,
  1523. keepdims: bool = ...,
  1524. ) -> Any: ...
  1525. @overload
  1526. def var(
  1527. self,
  1528. axis: Optional[_ShapeLike] = ...,
  1529. dtype: DTypeLike = ...,
  1530. out: _NdArraySubClass = ...,
  1531. ddof: int = ...,
  1532. keepdims: bool = ...,
  1533. ) -> _NdArraySubClass: ...
  1534. _DType = TypeVar("_DType", bound=dtype[Any])
  1535. _DType_co = TypeVar("_DType_co", covariant=True, bound=dtype[Any])
  1536. # TODO: Set the `bound` to something more suitable once we
  1537. # have proper shape support
  1538. _ShapeType = TypeVar("_ShapeType", bound=Any)
  1539. _NumberType = TypeVar("_NumberType", bound=number[Any])
  1540. _BufferType = Union[ndarray, bytes, bytearray, memoryview]
  1541. _T = TypeVar("_T")
  1542. _T_co = TypeVar("_T_co", covariant=True)
  1543. _2Tuple = Tuple[_T, _T]
  1544. _Casting = L["no", "equiv", "safe", "same_kind", "unsafe"]
  1545. _DTypeLike = Union[
  1546. dtype[_ScalarType],
  1547. Type[_ScalarType],
  1548. _SupportsDType[dtype[_ScalarType]],
  1549. ]
  1550. _ArrayUInt_co = NDArray[Union[bool_, unsignedinteger[Any]]]
  1551. _ArrayInt_co = NDArray[Union[bool_, integer[Any]]]
  1552. _ArrayFloat_co = NDArray[Union[bool_, integer[Any], floating[Any]]]
  1553. _ArrayComplex_co = NDArray[Union[bool_, integer[Any], floating[Any], complexfloating[Any, Any]]]
  1554. _ArrayNumber_co = NDArray[Union[bool_, number[Any]]]
  1555. _ArrayTD64_co = NDArray[Union[bool_, integer[Any], timedelta64]]
  1556. # Introduce an alias for `dtype` to avoid naming conflicts.
  1557. _dtype = dtype
  1558. class _SupportsItem(Protocol[_T_co]):
  1559. def item(self, __args: Any) -> _T_co: ...
  1560. class _SupportsReal(Protocol[_T_co]):
  1561. @property
  1562. def real(self) -> _T_co: ...
  1563. class _SupportsImag(Protocol[_T_co]):
  1564. @property
  1565. def imag(self) -> _T_co: ...
  1566. class ndarray(_ArrayOrScalarCommon, Generic[_ShapeType, _DType_co]):
  1567. @property
  1568. def base(self) -> Optional[ndarray]: ...
  1569. @property
  1570. def ndim(self) -> int: ...
  1571. @property
  1572. def size(self) -> int: ...
  1573. @property
  1574. def real(
  1575. self: NDArray[_SupportsReal[_ScalarType]], # type: ignore[type-var]
  1576. ) -> ndarray[_ShapeType, _dtype[_ScalarType]]: ...
  1577. @real.setter
  1578. def real(self, value: ArrayLike) -> None: ...
  1579. @property
  1580. def imag(
  1581. self: NDArray[_SupportsImag[_ScalarType]], # type: ignore[type-var]
  1582. ) -> ndarray[_ShapeType, _dtype[_ScalarType]]: ...
  1583. @imag.setter
  1584. def imag(self, value: ArrayLike) -> None: ...
  1585. def __new__(
  1586. cls: Type[_ArraySelf],
  1587. shape: _ShapeLike,
  1588. dtype: DTypeLike = ...,
  1589. buffer: _BufferType = ...,
  1590. offset: int = ...,
  1591. strides: _ShapeLike = ...,
  1592. order: _OrderKACF = ...,
  1593. ) -> _ArraySelf: ...
  1594. @overload
  1595. def __array__(self, __dtype: None = ...) -> ndarray[Any, _DType_co]: ...
  1596. @overload
  1597. def __array__(self, __dtype: _DType) -> ndarray[Any, _DType]: ...
  1598. @property
  1599. def ctypes(self) -> _ctypes[int]: ...
  1600. @property
  1601. def shape(self) -> _Shape: ...
  1602. @shape.setter
  1603. def shape(self, value: _ShapeLike) -> None: ...
  1604. @property
  1605. def strides(self) -> _Shape: ...
  1606. @strides.setter
  1607. def strides(self, value: _ShapeLike) -> None: ...
  1608. def byteswap(self: _ArraySelf, inplace: bool = ...) -> _ArraySelf: ...
  1609. def fill(self, value: Any) -> None: ...
  1610. @property
  1611. def flat(self: _NdArraySubClass) -> flatiter[_NdArraySubClass]: ...
  1612. # Use the same output type as that of the underlying `generic`
  1613. @overload
  1614. def item(
  1615. self: ndarray[Any, _dtype[_SupportsItem[_T]]], # type: ignore[type-var]
  1616. *args: SupportsIndex,
  1617. ) -> _T: ...
  1618. @overload
  1619. def item(
  1620. self: ndarray[Any, _dtype[_SupportsItem[_T]]], # type: ignore[type-var]
  1621. __args: Tuple[SupportsIndex, ...],
  1622. ) -> _T: ...
  1623. @overload
  1624. def itemset(self, __value: Any) -> None: ...
  1625. @overload
  1626. def itemset(self, __item: _ShapeLike, __value: Any) -> None: ...
  1627. @overload
  1628. def resize(self, __new_shape: _ShapeLike, *, refcheck: bool = ...) -> None: ...
  1629. @overload
  1630. def resize(self, *new_shape: SupportsIndex, refcheck: bool = ...) -> None: ...
  1631. def setflags(
  1632. self, write: bool = ..., align: bool = ..., uic: bool = ...
  1633. ) -> None: ...
  1634. def squeeze(
  1635. self,
  1636. axis: Union[SupportsIndex, Tuple[SupportsIndex, ...]] = ...,
  1637. ) -> ndarray[Any, _DType_co]: ...
  1638. def swapaxes(
  1639. self,
  1640. axis1: SupportsIndex,
  1641. axis2: SupportsIndex,
  1642. ) -> ndarray[Any, _DType_co]: ...
  1643. @overload
  1644. def transpose(self: _ArraySelf, __axes: _ShapeLike) -> _ArraySelf: ...
  1645. @overload
  1646. def transpose(self: _ArraySelf, *axes: SupportsIndex) -> _ArraySelf: ...
  1647. def argpartition(
  1648. self,
  1649. kth: _ArrayLikeInt_co,
  1650. axis: Optional[SupportsIndex] = ...,
  1651. kind: _PartitionKind = ...,
  1652. order: Union[None, str, Sequence[str]] = ...,
  1653. ) -> ndarray[Any, _dtype[intp]]: ...
  1654. def diagonal(
  1655. self,
  1656. offset: SupportsIndex = ...,
  1657. axis1: SupportsIndex = ...,
  1658. axis2: SupportsIndex = ...,
  1659. ) -> ndarray[Any, _DType_co]: ...
  1660. # 1D + 1D returns a scalar;
  1661. # all other with at least 1 non-0D array return an ndarray.
  1662. @overload
  1663. def dot(self, b: _ScalarLike_co, out: None = ...) -> ndarray: ...
  1664. @overload
  1665. def dot(self, b: ArrayLike, out: None = ...) -> Any: ... # type: ignore[misc]
  1666. @overload
  1667. def dot(self, b: ArrayLike, out: _NdArraySubClass) -> _NdArraySubClass: ...
  1668. # `nonzero()` is deprecated for 0d arrays/generics
  1669. def nonzero(self) -> Tuple[ndarray[Any, _dtype[intp]], ...]: ...
  1670. def partition(
  1671. self,
  1672. kth: _ArrayLikeInt_co,
  1673. axis: SupportsIndex = ...,
  1674. kind: _PartitionKind = ...,
  1675. order: Union[None, str, Sequence[str]] = ...,
  1676. ) -> None: ...
  1677. # `put` is technically available to `generic`,
  1678. # but is pointless as `generic`s are immutable
  1679. def put(
  1680. self,
  1681. ind: _ArrayLikeInt_co,
  1682. v: ArrayLike,
  1683. mode: _ModeKind = ...,
  1684. ) -> None: ...
  1685. @overload
  1686. def searchsorted( # type: ignore[misc]
  1687. self, # >= 1D array
  1688. v: _ScalarLike_co, # 0D array-like
  1689. side: _SortSide = ...,
  1690. sorter: Optional[_ArrayLikeInt_co] = ...,
  1691. ) -> intp: ...
  1692. @overload
  1693. def searchsorted(
  1694. self, # >= 1D array
  1695. v: ArrayLike,
  1696. side: _SortSide = ...,
  1697. sorter: Optional[_ArrayLikeInt_co] = ...,
  1698. ) -> ndarray[Any, _dtype[intp]]: ...
  1699. def setfield(
  1700. self,
  1701. val: ArrayLike,
  1702. dtype: DTypeLike,
  1703. offset: SupportsIndex = ...,
  1704. ) -> None: ...
  1705. def sort(
  1706. self,
  1707. axis: SupportsIndex = ...,
  1708. kind: Optional[_SortKind] = ...,
  1709. order: Union[None, str, Sequence[str]] = ...,
  1710. ) -> None: ...
  1711. @overload
  1712. def trace(
  1713. self, # >= 2D array
  1714. offset: SupportsIndex = ...,
  1715. axis1: SupportsIndex = ...,
  1716. axis2: SupportsIndex = ...,
  1717. dtype: DTypeLike = ...,
  1718. out: None = ...,
  1719. ) -> Any: ...
  1720. @overload
  1721. def trace(
  1722. self, # >= 2D array
  1723. offset: SupportsIndex = ...,
  1724. axis1: SupportsIndex = ...,
  1725. axis2: SupportsIndex = ...,
  1726. dtype: DTypeLike = ...,
  1727. out: _NdArraySubClass = ...,
  1728. ) -> _NdArraySubClass: ...
  1729. @overload
  1730. def take( # type: ignore[misc]
  1731. self: ndarray[Any, _dtype[_ScalarType]],
  1732. indices: _IntLike_co,
  1733. axis: Optional[SupportsIndex] = ...,
  1734. out: None = ...,
  1735. mode: _ModeKind = ...,
  1736. ) -> _ScalarType: ...
  1737. @overload
  1738. def take( # type: ignore[misc]
  1739. self,
  1740. indices: _ArrayLikeInt_co,
  1741. axis: Optional[SupportsIndex] = ...,
  1742. out: None = ...,
  1743. mode: _ModeKind = ...,
  1744. ) -> ndarray[Any, _DType_co]: ...
  1745. @overload
  1746. def take(
  1747. self,
  1748. indices: _ArrayLikeInt_co,
  1749. axis: Optional[SupportsIndex] = ...,
  1750. out: _NdArraySubClass = ...,
  1751. mode: _ModeKind = ...,
  1752. ) -> _NdArraySubClass: ...
  1753. def repeat(
  1754. self,
  1755. repeats: _ArrayLikeInt_co,
  1756. axis: Optional[SupportsIndex] = ...,
  1757. ) -> ndarray[Any, _DType_co]: ...
  1758. def flatten(
  1759. self,
  1760. order: _OrderKACF = ...,
  1761. ) -> ndarray[Any, _DType_co]: ...
  1762. def ravel(
  1763. self,
  1764. order: _OrderKACF = ...,
  1765. ) -> ndarray[Any, _DType_co]: ...
  1766. @overload
  1767. def reshape(
  1768. self, __shape: _ShapeLike, *, order: _OrderACF = ...
  1769. ) -> ndarray[Any, _DType_co]: ...
  1770. @overload
  1771. def reshape(
  1772. self, *shape: SupportsIndex, order: _OrderACF = ...
  1773. ) -> ndarray[Any, _DType_co]: ...
  1774. @overload
  1775. def astype(
  1776. self,
  1777. dtype: _DTypeLike[_ScalarType],
  1778. order: _OrderKACF = ...,
  1779. casting: _Casting = ...,
  1780. subok: bool = ...,
  1781. copy: bool = ...,
  1782. ) -> NDArray[_ScalarType]: ...
  1783. @overload
  1784. def astype(
  1785. self,
  1786. dtype: DTypeLike,
  1787. order: _OrderKACF = ...,
  1788. casting: _Casting = ...,
  1789. subok: bool = ...,
  1790. copy: bool = ...,
  1791. ) -> NDArray[Any]: ...
  1792. @overload
  1793. def view(self: _ArraySelf) -> _ArraySelf: ...
  1794. @overload
  1795. def view(self, type: Type[_NdArraySubClass]) -> _NdArraySubClass: ...
  1796. @overload
  1797. def view(self, dtype: _DTypeLike[_ScalarType]) -> NDArray[_ScalarType]: ...
  1798. @overload
  1799. def view(self, dtype: DTypeLike) -> NDArray[Any]: ...
  1800. @overload
  1801. def view(
  1802. self,
  1803. dtype: DTypeLike,
  1804. type: Type[_NdArraySubClass],
  1805. ) -> _NdArraySubClass: ...
  1806. @overload
  1807. def getfield(
  1808. self,
  1809. dtype: _DTypeLike[_ScalarType],
  1810. offset: SupportsIndex = ...
  1811. ) -> NDArray[_ScalarType]: ...
  1812. @overload
  1813. def getfield(
  1814. self,
  1815. dtype: DTypeLike,
  1816. offset: SupportsIndex = ...
  1817. ) -> NDArray[Any]: ...
  1818. # Dispatch to the underlying `generic` via protocols
  1819. def __int__(
  1820. self: ndarray[Any, _dtype[SupportsInt]], # type: ignore[type-var]
  1821. ) -> int: ...
  1822. def __float__(
  1823. self: ndarray[Any, _dtype[SupportsFloat]], # type: ignore[type-var]
  1824. ) -> float: ...
  1825. def __complex__(
  1826. self: ndarray[Any, _dtype[SupportsComplex]], # type: ignore[type-var]
  1827. ) -> complex: ...
  1828. def __index__(
  1829. self: ndarray[Any, _dtype[SupportsIndex]], # type: ignore[type-var]
  1830. ) -> int: ...
  1831. def __len__(self) -> int: ...
  1832. def __setitem__(self, key, value): ...
  1833. def __iter__(self) -> Any: ...
  1834. def __contains__(self, key) -> bool: ...
  1835. # The last overload is for catching recursive objects whose
  1836. # nesting is too deep.
  1837. # The first overload is for catching `bytes` (as they are a subtype of
  1838. # `Sequence[int]`) and `str`. As `str` is a recusive sequence of
  1839. # strings, it will pass through the final overload otherwise
  1840. @overload
  1841. def __lt__(self: NDArray[Any], other: _NestedSequence[Union[str, bytes]]) -> NoReturn: ...
  1842. @overload
  1843. def __lt__(self: _ArrayNumber_co, other: _ArrayLikeNumber_co) -> NDArray[bool_]: ...
  1844. @overload
  1845. def __lt__(self: _ArrayTD64_co, other: _ArrayLikeTD64_co) -> NDArray[bool_]: ...
  1846. @overload
  1847. def __lt__(self: NDArray[datetime64], other: _ArrayLikeDT64_co) -> NDArray[bool_]: ...
  1848. @overload
  1849. def __lt__(self: NDArray[object_], other: Any) -> NDArray[bool_]: ...
  1850. @overload
  1851. def __lt__(self: NDArray[Any], other: _ArrayLikeObject_co) -> NDArray[bool_]: ...
  1852. @overload
  1853. def __lt__(
  1854. self: NDArray[Union[number[Any], datetime64, timedelta64, bool_]],
  1855. other: _RecursiveSequence,
  1856. ) -> NDArray[bool_]: ...
  1857. @overload
  1858. def __le__(self: NDArray[Any], other: _NestedSequence[Union[str, bytes]]) -> NoReturn: ...
  1859. @overload
  1860. def __le__(self: _ArrayNumber_co, other: _ArrayLikeNumber_co) -> NDArray[bool_]: ...
  1861. @overload
  1862. def __le__(self: _ArrayTD64_co, other: _ArrayLikeTD64_co) -> NDArray[bool_]: ...
  1863. @overload
  1864. def __le__(self: NDArray[datetime64], other: _ArrayLikeDT64_co) -> NDArray[bool_]: ...
  1865. @overload
  1866. def __le__(self: NDArray[object_], other: Any) -> NDArray[bool_]: ...
  1867. @overload
  1868. def __le__(self: NDArray[Any], other: _ArrayLikeObject_co) -> NDArray[bool_]: ...
  1869. @overload
  1870. def __le__(
  1871. self: NDArray[Union[number[Any], datetime64, timedelta64, bool_]],
  1872. other: _RecursiveSequence,
  1873. ) -> NDArray[bool_]: ...
  1874. @overload
  1875. def __gt__(self: NDArray[Any], other: _NestedSequence[Union[str, bytes]]) -> NoReturn: ...
  1876. @overload
  1877. def __gt__(self: _ArrayNumber_co, other: _ArrayLikeNumber_co) -> NDArray[bool_]: ...
  1878. @overload
  1879. def __gt__(self: _ArrayTD64_co, other: _ArrayLikeTD64_co) -> NDArray[bool_]: ...
  1880. @overload
  1881. def __gt__(self: NDArray[datetime64], other: _ArrayLikeDT64_co) -> NDArray[bool_]: ...
  1882. @overload
  1883. def __gt__(self: NDArray[object_], other: Any) -> NDArray[bool_]: ...
  1884. @overload
  1885. def __gt__(self: NDArray[Any], other: _ArrayLikeObject_co) -> NDArray[bool_]: ...
  1886. @overload
  1887. def __gt__(
  1888. self: NDArray[Union[number[Any], datetime64, timedelta64, bool_]],
  1889. other: _RecursiveSequence,
  1890. ) -> NDArray[bool_]: ...
  1891. @overload
  1892. def __ge__(self: NDArray[Any], other: _NestedSequence[Union[str, bytes]]) -> NoReturn: ...
  1893. @overload
  1894. def __ge__(self: _ArrayNumber_co, other: _ArrayLikeNumber_co) -> NDArray[bool_]: ...
  1895. @overload
  1896. def __ge__(self: _ArrayTD64_co, other: _ArrayLikeTD64_co) -> NDArray[bool_]: ...
  1897. @overload
  1898. def __ge__(self: NDArray[datetime64], other: _ArrayLikeDT64_co) -> NDArray[bool_]: ...
  1899. @overload
  1900. def __ge__(self: NDArray[object_], other: Any) -> NDArray[bool_]: ...
  1901. @overload
  1902. def __ge__(self: NDArray[Any], other: _ArrayLikeObject_co) -> NDArray[bool_]: ...
  1903. @overload
  1904. def __ge__(
  1905. self: NDArray[Union[number[Any], datetime64, timedelta64, bool_]],
  1906. other: _RecursiveSequence,
  1907. ) -> NDArray[bool_]: ...
  1908. # Unary ops
  1909. @overload
  1910. def __abs__(self: NDArray[bool_]) -> NDArray[bool_]: ...
  1911. @overload
  1912. def __abs__(self: NDArray[complexfloating[_NBit1, _NBit1]]) -> NDArray[floating[_NBit1]]: ...
  1913. @overload
  1914. def __abs__(self: NDArray[_NumberType]) -> NDArray[_NumberType]: ...
  1915. @overload
  1916. def __abs__(self: NDArray[timedelta64]) -> NDArray[timedelta64]: ...
  1917. @overload
  1918. def __abs__(self: NDArray[object_]) -> Any: ...
  1919. @overload
  1920. def __invert__(self: NDArray[bool_]) -> NDArray[bool_]: ...
  1921. @overload
  1922. def __invert__(self: NDArray[_IntType]) -> NDArray[_IntType]: ...
  1923. @overload
  1924. def __invert__(self: NDArray[object_]) -> Any: ...
  1925. @overload
  1926. def __pos__(self: NDArray[_NumberType]) -> NDArray[_NumberType]: ...
  1927. @overload
  1928. def __pos__(self: NDArray[timedelta64]) -> NDArray[timedelta64]: ...
  1929. @overload
  1930. def __pos__(self: NDArray[object_]) -> Any: ...
  1931. @overload
  1932. def __neg__(self: NDArray[_NumberType]) -> NDArray[_NumberType]: ...
  1933. @overload
  1934. def __neg__(self: NDArray[timedelta64]) -> NDArray[timedelta64]: ...
  1935. @overload
  1936. def __neg__(self: NDArray[object_]) -> Any: ...
  1937. # Binary ops
  1938. # NOTE: `ndarray` does not implement `__imatmul__`
  1939. @overload
  1940. def __matmul__(self: NDArray[Any], other: _NestedSequence[Union[str, bytes]]) -> NoReturn: ...
  1941. @overload
  1942. def __matmul__(self: NDArray[bool_], other: _ArrayLikeBool_co) -> NDArray[bool_]: ... # type: ignore[misc]
  1943. @overload
  1944. def __matmul__(self: _ArrayUInt_co, other: _ArrayLikeUInt_co) -> NDArray[unsignedinteger[Any]]: ... # type: ignore[misc]
  1945. @overload
  1946. def __matmul__(self: _ArrayInt_co, other: _ArrayLikeInt_co) -> NDArray[signedinteger[Any]]: ... # type: ignore[misc]
  1947. @overload
  1948. def __matmul__(self: _ArrayFloat_co, other: _ArrayLikeFloat_co) -> NDArray[floating[Any]]: ... # type: ignore[misc]
  1949. @overload
  1950. def __matmul__(self: _ArrayComplex_co, other: _ArrayLikeComplex_co) -> NDArray[complexfloating[Any, Any]]: ...
  1951. @overload
  1952. def __matmul__(self: NDArray[object_], other: Any) -> Any: ...
  1953. @overload
  1954. def __matmul__(self: NDArray[Any], other: _ArrayLikeObject_co) -> Any: ...
  1955. @overload
  1956. def __matmul__(
  1957. self: _ArrayNumber_co,
  1958. other: _RecursiveSequence,
  1959. ) -> Any: ...
  1960. @overload
  1961. def __rmatmul__(self: NDArray[Any], other: _NestedSequence[Union[str, bytes]]) -> NoReturn: ...
  1962. @overload
  1963. def __rmatmul__(self: NDArray[bool_], other: _ArrayLikeBool_co) -> NDArray[bool_]: ... # type: ignore[misc]
  1964. @overload
  1965. def __rmatmul__(self: _ArrayUInt_co, other: _ArrayLikeUInt_co) -> NDArray[unsignedinteger[Any]]: ... # type: ignore[misc]
  1966. @overload
  1967. def __rmatmul__(self: _ArrayInt_co, other: _ArrayLikeInt_co) -> NDArray[signedinteger[Any]]: ... # type: ignore[misc]
  1968. @overload
  1969. def __rmatmul__(self: _ArrayFloat_co, other: _ArrayLikeFloat_co) -> NDArray[floating[Any]]: ... # type: ignore[misc]
  1970. @overload
  1971. def __rmatmul__(self: _ArrayComplex_co, other: _ArrayLikeComplex_co) -> NDArray[complexfloating[Any, Any]]: ...
  1972. @overload
  1973. def __rmatmul__(self: NDArray[object_], other: Any) -> Any: ...
  1974. @overload
  1975. def __rmatmul__(self: NDArray[Any], other: _ArrayLikeObject_co) -> Any: ...
  1976. @overload
  1977. def __rmatmul__(
  1978. self: _ArrayNumber_co,
  1979. other: _RecursiveSequence,
  1980. ) -> Any: ...
  1981. @overload
  1982. def __mod__(self: NDArray[Any], other: _NestedSequence[Union[str, bytes]]) -> NoReturn: ...
  1983. @overload
  1984. def __mod__(self: NDArray[bool_], other: _ArrayLikeBool_co) -> NDArray[int8]: ... # type: ignore[misc]
  1985. @overload
  1986. def __mod__(self: _ArrayUInt_co, other: _ArrayLikeUInt_co) -> NDArray[unsignedinteger[Any]]: ... # type: ignore[misc]
  1987. @overload
  1988. def __mod__(self: _ArrayInt_co, other: _ArrayLikeInt_co) -> NDArray[signedinteger[Any]]: ... # type: ignore[misc]
  1989. @overload
  1990. def __mod__(self: _ArrayFloat_co, other: _ArrayLikeFloat_co) -> NDArray[floating[Any]]: ... # type: ignore[misc]
  1991. @overload
  1992. def __mod__(self: _ArrayTD64_co, other: _NestedSequence[_SupportsArray[_dtype[timedelta64]]]) -> NDArray[timedelta64]: ...
  1993. @overload
  1994. def __mod__(self: NDArray[object_], other: Any) -> Any: ...
  1995. @overload
  1996. def __mod__(self: NDArray[Any], other: _ArrayLikeObject_co) -> Any: ...
  1997. @overload
  1998. def __mod__(
  1999. self: NDArray[Union[bool_, integer[Any], floating[Any], timedelta64]],
  2000. other: _RecursiveSequence,
  2001. ) -> Any: ...
  2002. @overload
  2003. def __rmod__(self: NDArray[Any], other: _NestedSequence[Union[str, bytes]]) -> NoReturn: ...
  2004. @overload
  2005. def __rmod__(self: NDArray[bool_], other: _ArrayLikeBool_co) -> NDArray[int8]: ... # type: ignore[misc]
  2006. @overload
  2007. def __rmod__(self: _ArrayUInt_co, other: _ArrayLikeUInt_co) -> NDArray[unsignedinteger[Any]]: ... # type: ignore[misc]
  2008. @overload
  2009. def __rmod__(self: _ArrayInt_co, other: _ArrayLikeInt_co) -> NDArray[signedinteger[Any]]: ... # type: ignore[misc]
  2010. @overload
  2011. def __rmod__(self: _ArrayFloat_co, other: _ArrayLikeFloat_co) -> NDArray[floating[Any]]: ... # type: ignore[misc]
  2012. @overload
  2013. def __rmod__(self: _ArrayTD64_co, other: _NestedSequence[_SupportsArray[_dtype[timedelta64]]]) -> NDArray[timedelta64]: ...
  2014. @overload
  2015. def __rmod__(self: NDArray[object_], other: Any) -> Any: ...
  2016. @overload
  2017. def __rmod__(self: NDArray[Any], other: _ArrayLikeObject_co) -> Any: ...
  2018. @overload
  2019. def __rmod__(
  2020. self: NDArray[Union[bool_, integer[Any], floating[Any], timedelta64]],
  2021. other: _RecursiveSequence,
  2022. ) -> Any: ...
  2023. @overload
  2024. def __divmod__(self: NDArray[Any], other: _NestedSequence[Union[str, bytes]]) -> NoReturn: ...
  2025. @overload
  2026. def __divmod__(self: NDArray[bool_], other: _ArrayLikeBool_co) -> _2Tuple[NDArray[int8]]: ... # type: ignore[misc]
  2027. @overload
  2028. def __divmod__(self: _ArrayUInt_co, other: _ArrayLikeUInt_co) -> _2Tuple[NDArray[unsignedinteger[Any]]]: ... # type: ignore[misc]
  2029. @overload
  2030. def __divmod__(self: _ArrayInt_co, other: _ArrayLikeInt_co) -> _2Tuple[NDArray[signedinteger[Any]]]: ... # type: ignore[misc]
  2031. @overload
  2032. def __divmod__(self: _ArrayFloat_co, other: _ArrayLikeFloat_co) -> _2Tuple[NDArray[floating[Any]]]: ... # type: ignore[misc]
  2033. @overload
  2034. def __divmod__(self: _ArrayTD64_co, other: _NestedSequence[_SupportsArray[_dtype[timedelta64]]]) -> Tuple[NDArray[int64], NDArray[timedelta64]]: ...
  2035. @overload
  2036. def __divmod__(
  2037. self: NDArray[Union[bool_, integer[Any], floating[Any], timedelta64]],
  2038. other: _RecursiveSequence,
  2039. ) -> _2Tuple[Any]: ...
  2040. @overload
  2041. def __rdivmod__(self: NDArray[Any], other: _NestedSequence[Union[str, bytes]]) -> NoReturn: ...
  2042. @overload
  2043. def __rdivmod__(self: NDArray[bool_], other: _ArrayLikeBool_co) -> _2Tuple[NDArray[int8]]: ... # type: ignore[misc]
  2044. @overload
  2045. def __rdivmod__(self: _ArrayUInt_co, other: _ArrayLikeUInt_co) -> _2Tuple[NDArray[unsignedinteger[Any]]]: ... # type: ignore[misc]
  2046. @overload
  2047. def __rdivmod__(self: _ArrayInt_co, other: _ArrayLikeInt_co) -> _2Tuple[NDArray[signedinteger[Any]]]: ... # type: ignore[misc]
  2048. @overload
  2049. def __rdivmod__(self: _ArrayFloat_co, other: _ArrayLikeFloat_co) -> _2Tuple[NDArray[floating[Any]]]: ... # type: ignore[misc]
  2050. @overload
  2051. def __rdivmod__(self: _ArrayTD64_co, other: _NestedSequence[_SupportsArray[_dtype[timedelta64]]]) -> Tuple[NDArray[int64], NDArray[timedelta64]]: ...
  2052. @overload
  2053. def __rdivmod__(
  2054. self: NDArray[Union[bool_, integer[Any], floating[Any], timedelta64]],
  2055. other: _RecursiveSequence,
  2056. ) -> _2Tuple[Any]: ...
  2057. @overload
  2058. def __add__(self: NDArray[Any], other: _NestedSequence[Union[str, bytes]]) -> NoReturn: ...
  2059. @overload
  2060. def __add__(self: NDArray[bool_], other: _ArrayLikeBool_co) -> NDArray[bool_]: ... # type: ignore[misc]
  2061. @overload
  2062. def __add__(self: _ArrayUInt_co, other: _ArrayLikeUInt_co) -> NDArray[unsignedinteger[Any]]: ... # type: ignore[misc]
  2063. @overload
  2064. def __add__(self: _ArrayInt_co, other: _ArrayLikeInt_co) -> NDArray[signedinteger[Any]]: ... # type: ignore[misc]
  2065. @overload
  2066. def __add__(self: _ArrayFloat_co, other: _ArrayLikeFloat_co) -> NDArray[floating[Any]]: ... # type: ignore[misc]
  2067. @overload
  2068. def __add__(self: _ArrayComplex_co, other: _ArrayLikeComplex_co) -> NDArray[complexfloating[Any, Any]]: ... # type: ignore[misc]
  2069. @overload
  2070. def __add__(self: _ArrayTD64_co, other: _ArrayLikeTD64_co) -> NDArray[timedelta64]: ... # type: ignore[misc]
  2071. @overload
  2072. def __add__(self: _ArrayTD64_co, other: _ArrayLikeDT64_co) -> NDArray[datetime64]: ...
  2073. @overload
  2074. def __add__(self: NDArray[datetime64], other: _ArrayLikeTD64_co) -> NDArray[datetime64]: ...
  2075. @overload
  2076. def __add__(self: NDArray[object_], other: Any) -> Any: ...
  2077. @overload
  2078. def __add__(self: NDArray[Any], other: _ArrayLikeObject_co) -> Any: ...
  2079. @overload
  2080. def __add__(
  2081. self: NDArray[Union[bool_, number[Any], timedelta64, datetime64]],
  2082. other: _RecursiveSequence,
  2083. ) -> Any: ...
  2084. @overload
  2085. def __radd__(self: NDArray[Any], other: _NestedSequence[Union[str, bytes]]) -> NoReturn: ...
  2086. @overload
  2087. def __radd__(self: NDArray[bool_], other: _ArrayLikeBool_co) -> NDArray[bool_]: ... # type: ignore[misc]
  2088. @overload
  2089. def __radd__(self: _ArrayUInt_co, other: _ArrayLikeUInt_co) -> NDArray[unsignedinteger[Any]]: ... # type: ignore[misc]
  2090. @overload
  2091. def __radd__(self: _ArrayInt_co, other: _ArrayLikeInt_co) -> NDArray[signedinteger[Any]]: ... # type: ignore[misc]
  2092. @overload
  2093. def __radd__(self: _ArrayFloat_co, other: _ArrayLikeFloat_co) -> NDArray[floating[Any]]: ... # type: ignore[misc]
  2094. @overload
  2095. def __radd__(self: _ArrayComplex_co, other: _ArrayLikeComplex_co) -> NDArray[complexfloating[Any, Any]]: ... # type: ignore[misc]
  2096. @overload
  2097. def __radd__(self: _ArrayTD64_co, other: _ArrayLikeTD64_co) -> NDArray[timedelta64]: ... # type: ignore[misc]
  2098. @overload
  2099. def __radd__(self: _ArrayTD64_co, other: _ArrayLikeDT64_co) -> NDArray[datetime64]: ...
  2100. @overload
  2101. def __radd__(self: NDArray[datetime64], other: _ArrayLikeTD64_co) -> NDArray[datetime64]: ...
  2102. @overload
  2103. def __radd__(self: NDArray[object_], other: Any) -> Any: ...
  2104. @overload
  2105. def __radd__(self: NDArray[Any], other: _ArrayLikeObject_co) -> Any: ...
  2106. @overload
  2107. def __radd__(
  2108. self: NDArray[Union[bool_, number[Any], timedelta64, datetime64]],
  2109. other: _RecursiveSequence,
  2110. ) -> Any: ...
  2111. @overload
  2112. def __sub__(self: NDArray[Any], other: _NestedSequence[Union[str, bytes]]) -> NoReturn: ...
  2113. @overload
  2114. def __sub__(self: NDArray[bool_], other: _ArrayLikeBool_co) -> NoReturn: ...
  2115. @overload
  2116. def __sub__(self: _ArrayUInt_co, other: _ArrayLikeUInt_co) -> NDArray[unsignedinteger[Any]]: ... # type: ignore[misc]
  2117. @overload
  2118. def __sub__(self: _ArrayInt_co, other: _ArrayLikeInt_co) -> NDArray[signedinteger[Any]]: ... # type: ignore[misc]
  2119. @overload
  2120. def __sub__(self: _ArrayFloat_co, other: _ArrayLikeFloat_co) -> NDArray[floating[Any]]: ... # type: ignore[misc]
  2121. @overload
  2122. def __sub__(self: _ArrayComplex_co, other: _ArrayLikeComplex_co) -> NDArray[complexfloating[Any, Any]]: ... # type: ignore[misc]
  2123. @overload
  2124. def __sub__(self: _ArrayTD64_co, other: _ArrayLikeTD64_co) -> NDArray[timedelta64]: ... # type: ignore[misc]
  2125. @overload
  2126. def __sub__(self: NDArray[datetime64], other: _ArrayLikeTD64_co) -> NDArray[datetime64]: ...
  2127. @overload
  2128. def __sub__(self: NDArray[datetime64], other: _ArrayLikeDT64_co) -> NDArray[timedelta64]: ...
  2129. @overload
  2130. def __sub__(self: NDArray[object_], other: Any) -> Any: ...
  2131. @overload
  2132. def __sub__(self: NDArray[Any], other: _ArrayLikeObject_co) -> Any: ...
  2133. @overload
  2134. def __sub__(
  2135. self: NDArray[Union[bool_, number[Any], timedelta64, datetime64]],
  2136. other: _RecursiveSequence,
  2137. ) -> Any: ...
  2138. @overload
  2139. def __rsub__(self: NDArray[Any], other: _NestedSequence[Union[str, bytes]]) -> NoReturn: ...
  2140. @overload
  2141. def __rsub__(self: NDArray[bool_], other: _ArrayLikeBool_co) -> NoReturn: ...
  2142. @overload
  2143. def __rsub__(self: _ArrayUInt_co, other: _ArrayLikeUInt_co) -> NDArray[unsignedinteger[Any]]: ... # type: ignore[misc]
  2144. @overload
  2145. def __rsub__(self: _ArrayInt_co, other: _ArrayLikeInt_co) -> NDArray[signedinteger[Any]]: ... # type: ignore[misc]
  2146. @overload
  2147. def __rsub__(self: _ArrayFloat_co, other: _ArrayLikeFloat_co) -> NDArray[floating[Any]]: ... # type: ignore[misc]
  2148. @overload
  2149. def __rsub__(self: _ArrayComplex_co, other: _ArrayLikeComplex_co) -> NDArray[complexfloating[Any, Any]]: ... # type: ignore[misc]
  2150. @overload
  2151. def __rsub__(self: _ArrayTD64_co, other: _ArrayLikeTD64_co) -> NDArray[timedelta64]: ... # type: ignore[misc]
  2152. @overload
  2153. def __rsub__(self: _ArrayTD64_co, other: _ArrayLikeDT64_co) -> NDArray[datetime64]: ... # type: ignore[misc]
  2154. @overload
  2155. def __rsub__(self: NDArray[datetime64], other: _ArrayLikeDT64_co) -> NDArray[timedelta64]: ...
  2156. @overload
  2157. def __rsub__(self: NDArray[object_], other: Any) -> Any: ...
  2158. @overload
  2159. def __rsub__(self: NDArray[Any], other: _ArrayLikeObject_co) -> Any: ...
  2160. @overload
  2161. def __rsub__(
  2162. self: NDArray[Union[bool_, number[Any], timedelta64, datetime64]],
  2163. other: _RecursiveSequence,
  2164. ) -> Any: ...
  2165. @overload
  2166. def __mul__(self: NDArray[Any], other: _NestedSequence[Union[str, bytes]]) -> NoReturn: ...
  2167. @overload
  2168. def __mul__(self: NDArray[bool_], other: _ArrayLikeBool_co) -> NDArray[bool_]: ... # type: ignore[misc]
  2169. @overload
  2170. def __mul__(self: _ArrayUInt_co, other: _ArrayLikeUInt_co) -> NDArray[unsignedinteger[Any]]: ... # type: ignore[misc]
  2171. @overload
  2172. def __mul__(self: _ArrayInt_co, other: _ArrayLikeInt_co) -> NDArray[signedinteger[Any]]: ... # type: ignore[misc]
  2173. @overload
  2174. def __mul__(self: _ArrayFloat_co, other: _ArrayLikeFloat_co) -> NDArray[floating[Any]]: ... # type: ignore[misc]
  2175. @overload
  2176. def __mul__(self: _ArrayComplex_co, other: _ArrayLikeComplex_co) -> NDArray[complexfloating[Any, Any]]: ... # type: ignore[misc]
  2177. @overload
  2178. def __mul__(self: _ArrayTD64_co, other: _ArrayLikeFloat_co) -> NDArray[timedelta64]: ...
  2179. @overload
  2180. def __mul__(self: _ArrayFloat_co, other: _ArrayLikeTD64_co) -> NDArray[timedelta64]: ...
  2181. @overload
  2182. def __mul__(self: NDArray[object_], other: Any) -> Any: ...
  2183. @overload
  2184. def __mul__(self: NDArray[Any], other: _ArrayLikeObject_co) -> Any: ...
  2185. @overload
  2186. def __mul__(
  2187. self: NDArray[Union[bool_, number[Any], timedelta64]],
  2188. other: _RecursiveSequence,
  2189. ) -> Any: ...
  2190. @overload
  2191. def __rmul__(self: NDArray[Any], other: _NestedSequence[Union[str, bytes]]) -> NoReturn: ...
  2192. @overload
  2193. def __rmul__(self: NDArray[bool_], other: _ArrayLikeBool_co) -> NDArray[bool_]: ... # type: ignore[misc]
  2194. @overload
  2195. def __rmul__(self: _ArrayUInt_co, other: _ArrayLikeUInt_co) -> NDArray[unsignedinteger[Any]]: ... # type: ignore[misc]
  2196. @overload
  2197. def __rmul__(self: _ArrayInt_co, other: _ArrayLikeInt_co) -> NDArray[signedinteger[Any]]: ... # type: ignore[misc]
  2198. @overload
  2199. def __rmul__(self: _ArrayFloat_co, other: _ArrayLikeFloat_co) -> NDArray[floating[Any]]: ... # type: ignore[misc]
  2200. @overload
  2201. def __rmul__(self: _ArrayComplex_co, other: _ArrayLikeComplex_co) -> NDArray[complexfloating[Any, Any]]: ... # type: ignore[misc]
  2202. @overload
  2203. def __rmul__(self: _ArrayTD64_co, other: _ArrayLikeFloat_co) -> NDArray[timedelta64]: ...
  2204. @overload
  2205. def __rmul__(self: _ArrayFloat_co, other: _ArrayLikeTD64_co) -> NDArray[timedelta64]: ...
  2206. @overload
  2207. def __rmul__(self: NDArray[object_], other: Any) -> Any: ...
  2208. @overload
  2209. def __rmul__(self: NDArray[Any], other: _ArrayLikeObject_co) -> Any: ...
  2210. @overload
  2211. def __rmul__(
  2212. self: NDArray[Union[bool_, number[Any], timedelta64]],
  2213. other: _RecursiveSequence,
  2214. ) -> Any: ...
  2215. @overload
  2216. def __floordiv__(self: NDArray[Any], other: _NestedSequence[Union[str, bytes]]) -> NoReturn: ...
  2217. @overload
  2218. def __floordiv__(self: NDArray[bool_], other: _ArrayLikeBool_co) -> NDArray[int8]: ... # type: ignore[misc]
  2219. @overload
  2220. def __floordiv__(self: _ArrayUInt_co, other: _ArrayLikeUInt_co) -> NDArray[unsignedinteger[Any]]: ... # type: ignore[misc]
  2221. @overload
  2222. def __floordiv__(self: _ArrayInt_co, other: _ArrayLikeInt_co) -> NDArray[signedinteger[Any]]: ... # type: ignore[misc]
  2223. @overload
  2224. def __floordiv__(self: _ArrayFloat_co, other: _ArrayLikeFloat_co) -> NDArray[floating[Any]]: ... # type: ignore[misc]
  2225. @overload
  2226. def __floordiv__(self: _ArrayComplex_co, other: _ArrayLikeComplex_co) -> NDArray[complexfloating[Any, Any]]: ... # type: ignore[misc]
  2227. @overload
  2228. def __floordiv__(self: NDArray[timedelta64], other: _NestedSequence[_SupportsArray[_dtype[timedelta64]]]) -> NDArray[int64]: ...
  2229. @overload
  2230. def __floordiv__(self: NDArray[timedelta64], other: _ArrayLikeBool_co) -> NoReturn: ...
  2231. @overload
  2232. def __floordiv__(self: NDArray[timedelta64], other: _ArrayLikeFloat_co) -> NDArray[timedelta64]: ...
  2233. @overload
  2234. def __floordiv__(self: NDArray[object_], other: Any) -> Any: ...
  2235. @overload
  2236. def __floordiv__(self: NDArray[Any], other: _ArrayLikeObject_co) -> Any: ...
  2237. @overload
  2238. def __floordiv__(
  2239. self: NDArray[Union[bool_, number[Any], timedelta64]],
  2240. other: _RecursiveSequence,
  2241. ) -> Any: ...
  2242. @overload
  2243. def __rfloordiv__(self: NDArray[Any], other: _NestedSequence[Union[str, bytes]]) -> NoReturn: ...
  2244. @overload
  2245. def __rfloordiv__(self: NDArray[bool_], other: _ArrayLikeBool_co) -> NDArray[int8]: ... # type: ignore[misc]
  2246. @overload
  2247. def __rfloordiv__(self: _ArrayUInt_co, other: _ArrayLikeUInt_co) -> NDArray[unsignedinteger[Any]]: ... # type: ignore[misc]
  2248. @overload
  2249. def __rfloordiv__(self: _ArrayInt_co, other: _ArrayLikeInt_co) -> NDArray[signedinteger[Any]]: ... # type: ignore[misc]
  2250. @overload
  2251. def __rfloordiv__(self: _ArrayFloat_co, other: _ArrayLikeFloat_co) -> NDArray[floating[Any]]: ... # type: ignore[misc]
  2252. @overload
  2253. def __rfloordiv__(self: _ArrayComplex_co, other: _ArrayLikeComplex_co) -> NDArray[complexfloating[Any, Any]]: ... # type: ignore[misc]
  2254. @overload
  2255. def __rfloordiv__(self: NDArray[timedelta64], other: _NestedSequence[_SupportsArray[_dtype[timedelta64]]]) -> NDArray[int64]: ...
  2256. @overload
  2257. def __rfloordiv__(self: NDArray[bool_], other: _ArrayLikeTD64_co) -> NoReturn: ...
  2258. @overload
  2259. def __rfloordiv__(self: _ArrayFloat_co, other: _ArrayLikeTD64_co) -> NDArray[timedelta64]: ...
  2260. @overload
  2261. def __rfloordiv__(self: NDArray[object_], other: Any) -> Any: ...
  2262. @overload
  2263. def __rfloordiv__(self: NDArray[Any], other: _ArrayLikeObject_co) -> Any: ...
  2264. @overload
  2265. def __rfloordiv__(
  2266. self: NDArray[Union[bool_, number[Any], timedelta64]],
  2267. other: _RecursiveSequence,
  2268. ) -> Any: ...
  2269. @overload
  2270. def __pow__(self: NDArray[Any], other: _NestedSequence[Union[str, bytes]]) -> NoReturn: ...
  2271. @overload
  2272. def __pow__(self: NDArray[bool_], other: _ArrayLikeBool_co) -> NDArray[int8]: ... # type: ignore[misc]
  2273. @overload
  2274. def __pow__(self: _ArrayUInt_co, other: _ArrayLikeUInt_co) -> NDArray[unsignedinteger[Any]]: ... # type: ignore[misc]
  2275. @overload
  2276. def __pow__(self: _ArrayInt_co, other: _ArrayLikeInt_co) -> NDArray[signedinteger[Any]]: ... # type: ignore[misc]
  2277. @overload
  2278. def __pow__(self: _ArrayFloat_co, other: _ArrayLikeFloat_co) -> NDArray[floating[Any]]: ... # type: ignore[misc]
  2279. @overload
  2280. def __pow__(self: _ArrayComplex_co, other: _ArrayLikeComplex_co) -> NDArray[complexfloating[Any, Any]]: ...
  2281. @overload
  2282. def __pow__(self: NDArray[object_], other: Any) -> Any: ...
  2283. @overload
  2284. def __pow__(self: NDArray[Any], other: _ArrayLikeObject_co) -> Any: ...
  2285. @overload
  2286. def __pow__(
  2287. self: NDArray[Union[bool_, number[Any]]],
  2288. other: _RecursiveSequence,
  2289. ) -> Any: ...
  2290. @overload
  2291. def __rpow__(self: NDArray[Any], other: _NestedSequence[Union[str, bytes]]) -> NoReturn: ...
  2292. @overload
  2293. def __rpow__(self: NDArray[bool_], other: _ArrayLikeBool_co) -> NDArray[int8]: ... # type: ignore[misc]
  2294. @overload
  2295. def __rpow__(self: _ArrayUInt_co, other: _ArrayLikeUInt_co) -> NDArray[unsignedinteger[Any]]: ... # type: ignore[misc]
  2296. @overload
  2297. def __rpow__(self: _ArrayInt_co, other: _ArrayLikeInt_co) -> NDArray[signedinteger[Any]]: ... # type: ignore[misc]
  2298. @overload
  2299. def __rpow__(self: _ArrayFloat_co, other: _ArrayLikeFloat_co) -> NDArray[floating[Any]]: ... # type: ignore[misc]
  2300. @overload
  2301. def __rpow__(self: _ArrayComplex_co, other: _ArrayLikeComplex_co) -> NDArray[complexfloating[Any, Any]]: ...
  2302. @overload
  2303. def __rpow__(self: NDArray[object_], other: Any) -> Any: ...
  2304. @overload
  2305. def __rpow__(self: NDArray[Any], other: _ArrayLikeObject_co) -> Any: ...
  2306. @overload
  2307. def __rpow__(
  2308. self: NDArray[Union[bool_, number[Any]]],
  2309. other: _RecursiveSequence,
  2310. ) -> Any: ...
  2311. @overload
  2312. def __truediv__(self: NDArray[Any], other: _NestedSequence[Union[str, bytes]]) -> NoReturn: ...
  2313. @overload
  2314. def __truediv__(self: _ArrayInt_co, other: _ArrayInt_co) -> NDArray[float64]: ... # type: ignore[misc]
  2315. @overload
  2316. def __truediv__(self: _ArrayFloat_co, other: _ArrayLikeFloat_co) -> NDArray[floating[Any]]: ... # type: ignore[misc]
  2317. @overload
  2318. def __truediv__(self: _ArrayComplex_co, other: _ArrayLikeComplex_co) -> NDArray[complexfloating[Any, Any]]: ... # type: ignore[misc]
  2319. @overload
  2320. def __truediv__(self: NDArray[timedelta64], other: _NestedSequence[_SupportsArray[_dtype[timedelta64]]]) -> NDArray[float64]: ...
  2321. @overload
  2322. def __truediv__(self: NDArray[timedelta64], other: _ArrayLikeBool_co) -> NoReturn: ...
  2323. @overload
  2324. def __truediv__(self: NDArray[timedelta64], other: _ArrayLikeFloat_co) -> NDArray[timedelta64]: ...
  2325. @overload
  2326. def __truediv__(self: NDArray[object_], other: Any) -> Any: ...
  2327. @overload
  2328. def __truediv__(self: NDArray[Any], other: _ArrayLikeObject_co) -> Any: ...
  2329. @overload
  2330. def __truediv__(
  2331. self: NDArray[Union[bool_, number[Any], timedelta64]],
  2332. other: _RecursiveSequence,
  2333. ) -> Any: ...
  2334. @overload
  2335. def __rtruediv__(self: NDArray[Any], other: _NestedSequence[Union[str, bytes]]) -> NoReturn: ...
  2336. @overload
  2337. def __rtruediv__(self: _ArrayInt_co, other: _ArrayInt_co) -> NDArray[float64]: ... # type: ignore[misc]
  2338. @overload
  2339. def __rtruediv__(self: _ArrayFloat_co, other: _ArrayLikeFloat_co) -> NDArray[floating[Any]]: ... # type: ignore[misc]
  2340. @overload
  2341. def __rtruediv__(self: _ArrayComplex_co, other: _ArrayLikeComplex_co) -> NDArray[complexfloating[Any, Any]]: ... # type: ignore[misc]
  2342. @overload
  2343. def __rtruediv__(self: NDArray[timedelta64], other: _NestedSequence[_SupportsArray[_dtype[timedelta64]]]) -> NDArray[float64]: ...
  2344. @overload
  2345. def __rtruediv__(self: NDArray[bool_], other: _ArrayLikeTD64_co) -> NoReturn: ...
  2346. @overload
  2347. def __rtruediv__(self: _ArrayFloat_co, other: _ArrayLikeTD64_co) -> NDArray[timedelta64]: ...
  2348. @overload
  2349. def __rtruediv__(self: NDArray[object_], other: Any) -> Any: ...
  2350. @overload
  2351. def __rtruediv__(self: NDArray[Any], other: _ArrayLikeObject_co) -> Any: ...
  2352. @overload
  2353. def __rtruediv__(
  2354. self: NDArray[Union[bool_, number[Any], timedelta64]],
  2355. other: _RecursiveSequence,
  2356. ) -> Any: ...
  2357. @overload
  2358. def __lshift__(self: NDArray[Any], other: _NestedSequence[Union[str, bytes]]) -> NoReturn: ...
  2359. @overload
  2360. def __lshift__(self: NDArray[bool_], other: _ArrayLikeBool_co) -> NDArray[int8]: ... # type: ignore[misc]
  2361. @overload
  2362. def __lshift__(self: _ArrayUInt_co, other: _ArrayLikeUInt_co) -> NDArray[unsignedinteger[Any]]: ... # type: ignore[misc]
  2363. @overload
  2364. def __lshift__(self: _ArrayInt_co, other: _ArrayLikeInt_co) -> NDArray[signedinteger[Any]]: ...
  2365. @overload
  2366. def __lshift__(self: NDArray[object_], other: Any) -> Any: ...
  2367. @overload
  2368. def __lshift__(self: NDArray[Any], other: _ArrayLikeObject_co) -> Any: ...
  2369. @overload
  2370. def __lshift__(
  2371. self: NDArray[Union[bool_, integer[Any]]],
  2372. other: _RecursiveSequence,
  2373. ) -> Any: ...
  2374. @overload
  2375. def __rlshift__(self: NDArray[Any], other: _NestedSequence[Union[str, bytes]]) -> NoReturn: ...
  2376. @overload
  2377. def __rlshift__(self: NDArray[bool_], other: _ArrayLikeBool_co) -> NDArray[int8]: ... # type: ignore[misc]
  2378. @overload
  2379. def __rlshift__(self: _ArrayUInt_co, other: _ArrayLikeUInt_co) -> NDArray[unsignedinteger[Any]]: ... # type: ignore[misc]
  2380. @overload
  2381. def __rlshift__(self: _ArrayInt_co, other: _ArrayLikeInt_co) -> NDArray[signedinteger[Any]]: ...
  2382. @overload
  2383. def __rlshift__(self: NDArray[object_], other: Any) -> Any: ...
  2384. @overload
  2385. def __rlshift__(self: NDArray[Any], other: _ArrayLikeObject_co) -> Any: ...
  2386. @overload
  2387. def __rlshift__(
  2388. self: NDArray[Union[bool_, integer[Any]]],
  2389. other: _RecursiveSequence,
  2390. ) -> Any: ...
  2391. @overload
  2392. def __rshift__(self: NDArray[Any], other: _NestedSequence[Union[str, bytes]]) -> NoReturn: ...
  2393. @overload
  2394. def __rshift__(self: NDArray[bool_], other: _ArrayLikeBool_co) -> NDArray[int8]: ... # type: ignore[misc]
  2395. @overload
  2396. def __rshift__(self: _ArrayUInt_co, other: _ArrayLikeUInt_co) -> NDArray[unsignedinteger[Any]]: ... # type: ignore[misc]
  2397. @overload
  2398. def __rshift__(self: _ArrayInt_co, other: _ArrayLikeInt_co) -> NDArray[signedinteger[Any]]: ...
  2399. @overload
  2400. def __rshift__(self: NDArray[object_], other: Any) -> Any: ...
  2401. @overload
  2402. def __rshift__(self: NDArray[Any], other: _ArrayLikeObject_co) -> Any: ...
  2403. @overload
  2404. def __rshift__(
  2405. self: NDArray[Union[bool_, integer[Any]]],
  2406. other: _RecursiveSequence,
  2407. ) -> Any: ...
  2408. @overload
  2409. def __rrshift__(self: NDArray[Any], other: _NestedSequence[Union[str, bytes]]) -> NoReturn: ...
  2410. @overload
  2411. def __rrshift__(self: NDArray[bool_], other: _ArrayLikeBool_co) -> NDArray[int8]: ... # type: ignore[misc]
  2412. @overload
  2413. def __rrshift__(self: _ArrayUInt_co, other: _ArrayLikeUInt_co) -> NDArray[unsignedinteger[Any]]: ... # type: ignore[misc]
  2414. @overload
  2415. def __rrshift__(self: _ArrayInt_co, other: _ArrayLikeInt_co) -> NDArray[signedinteger[Any]]: ...
  2416. @overload
  2417. def __rrshift__(self: NDArray[object_], other: Any) -> Any: ...
  2418. @overload
  2419. def __rrshift__(self: NDArray[Any], other: _ArrayLikeObject_co) -> Any: ...
  2420. @overload
  2421. def __rrshift__(
  2422. self: NDArray[Union[bool_, integer[Any]]],
  2423. other: _RecursiveSequence,
  2424. ) -> Any: ...
  2425. @overload
  2426. def __and__(self: NDArray[Any], other: _NestedSequence[Union[str, bytes]]) -> NoReturn: ...
  2427. @overload
  2428. def __and__(self: NDArray[bool_], other: _ArrayLikeBool_co) -> NDArray[bool_]: ... # type: ignore[misc]
  2429. @overload
  2430. def __and__(self: _ArrayUInt_co, other: _ArrayLikeUInt_co) -> NDArray[unsignedinteger[Any]]: ... # type: ignore[misc]
  2431. @overload
  2432. def __and__(self: _ArrayInt_co, other: _ArrayLikeInt_co) -> NDArray[signedinteger[Any]]: ...
  2433. @overload
  2434. def __and__(self: NDArray[object_], other: Any) -> Any: ...
  2435. @overload
  2436. def __and__(self: NDArray[Any], other: _ArrayLikeObject_co) -> Any: ...
  2437. @overload
  2438. def __and__(
  2439. self: NDArray[Union[bool_, integer[Any]]],
  2440. other: _RecursiveSequence,
  2441. ) -> Any: ...
  2442. @overload
  2443. def __rand__(self: NDArray[Any], other: _NestedSequence[Union[str, bytes]]) -> NoReturn: ...
  2444. @overload
  2445. def __rand__(self: NDArray[bool_], other: _ArrayLikeBool_co) -> NDArray[bool_]: ... # type: ignore[misc]
  2446. @overload
  2447. def __rand__(self: _ArrayUInt_co, other: _ArrayLikeUInt_co) -> NDArray[unsignedinteger[Any]]: ... # type: ignore[misc]
  2448. @overload
  2449. def __rand__(self: _ArrayInt_co, other: _ArrayLikeInt_co) -> NDArray[signedinteger[Any]]: ...
  2450. @overload
  2451. def __rand__(self: NDArray[object_], other: Any) -> Any: ...
  2452. @overload
  2453. def __rand__(self: NDArray[Any], other: _ArrayLikeObject_co) -> Any: ...
  2454. @overload
  2455. def __rand__(
  2456. self: NDArray[Union[bool_, integer[Any]]],
  2457. other: _RecursiveSequence,
  2458. ) -> Any: ...
  2459. @overload
  2460. def __xor__(self: NDArray[Any], other: _NestedSequence[Union[str, bytes]]) -> NoReturn: ...
  2461. @overload
  2462. def __xor__(self: NDArray[bool_], other: _ArrayLikeBool_co) -> NDArray[bool_]: ... # type: ignore[misc]
  2463. @overload
  2464. def __xor__(self: _ArrayUInt_co, other: _ArrayLikeUInt_co) -> NDArray[unsignedinteger[Any]]: ... # type: ignore[misc]
  2465. @overload
  2466. def __xor__(self: _ArrayInt_co, other: _ArrayLikeInt_co) -> NDArray[signedinteger[Any]]: ...
  2467. @overload
  2468. def __xor__(self: NDArray[object_], other: Any) -> Any: ...
  2469. @overload
  2470. def __xor__(self: NDArray[Any], other: _ArrayLikeObject_co) -> Any: ...
  2471. @overload
  2472. def __xor__(
  2473. self: NDArray[Union[bool_, integer[Any]]],
  2474. other: _RecursiveSequence,
  2475. ) -> Any: ...
  2476. @overload
  2477. def __rxor__(self: NDArray[Any], other: _NestedSequence[Union[str, bytes]]) -> NoReturn: ...
  2478. @overload
  2479. def __rxor__(self: NDArray[bool_], other: _ArrayLikeBool_co) -> NDArray[bool_]: ... # type: ignore[misc]
  2480. @overload
  2481. def __rxor__(self: _ArrayUInt_co, other: _ArrayLikeUInt_co) -> NDArray[unsignedinteger[Any]]: ... # type: ignore[misc]
  2482. @overload
  2483. def __rxor__(self: _ArrayInt_co, other: _ArrayLikeInt_co) -> NDArray[signedinteger[Any]]: ...
  2484. @overload
  2485. def __rxor__(self: NDArray[object_], other: Any) -> Any: ...
  2486. @overload
  2487. def __rxor__(self: NDArray[Any], other: _ArrayLikeObject_co) -> Any: ...
  2488. @overload
  2489. def __rxor__(
  2490. self: NDArray[Union[bool_, integer[Any]]],
  2491. other: _RecursiveSequence,
  2492. ) -> Any: ...
  2493. @overload
  2494. def __or__(self: NDArray[Any], other: _NestedSequence[Union[str, bytes]]) -> NoReturn: ...
  2495. @overload
  2496. def __or__(self: NDArray[bool_], other: _ArrayLikeBool_co) -> NDArray[bool_]: ... # type: ignore[misc]
  2497. @overload
  2498. def __or__(self: _ArrayUInt_co, other: _ArrayLikeUInt_co) -> NDArray[unsignedinteger[Any]]: ... # type: ignore[misc]
  2499. @overload
  2500. def __or__(self: _ArrayInt_co, other: _ArrayLikeInt_co) -> NDArray[signedinteger[Any]]: ...
  2501. @overload
  2502. def __or__(self: NDArray[object_], other: Any) -> Any: ...
  2503. @overload
  2504. def __or__(self: NDArray[Any], other: _ArrayLikeObject_co) -> Any: ...
  2505. @overload
  2506. def __or__(
  2507. self: NDArray[Union[bool_, integer[Any]]],
  2508. other: _RecursiveSequence,
  2509. ) -> Any: ...
  2510. @overload
  2511. def __ror__(self: NDArray[Any], other: _NestedSequence[Union[str, bytes]]) -> NoReturn: ...
  2512. @overload
  2513. def __ror__(self: NDArray[bool_], other: _ArrayLikeBool_co) -> NDArray[bool_]: ... # type: ignore[misc]
  2514. @overload
  2515. def __ror__(self: _ArrayUInt_co, other: _ArrayLikeUInt_co) -> NDArray[unsignedinteger[Any]]: ... # type: ignore[misc]
  2516. @overload
  2517. def __ror__(self: _ArrayInt_co, other: _ArrayLikeInt_co) -> NDArray[signedinteger[Any]]: ...
  2518. @overload
  2519. def __ror__(self: NDArray[object_], other: Any) -> Any: ...
  2520. @overload
  2521. def __ror__(self: NDArray[Any], other: _ArrayLikeObject_co) -> Any: ...
  2522. @overload
  2523. def __ror__(
  2524. self: NDArray[Union[bool_, integer[Any]]],
  2525. other: _RecursiveSequence,
  2526. ) -> Any: ...
  2527. # `np.generic` does not support inplace operations
  2528. @overload # type: ignore[misc]
  2529. def __iadd__(self: NDArray[Any], other: _NestedSequence[Union[str, bytes]]) -> NoReturn: ...
  2530. @overload
  2531. def __iadd__(self: NDArray[bool_], other: _ArrayLikeBool_co) -> NDArray[bool_]: ...
  2532. @overload
  2533. def __iadd__(self: NDArray[unsignedinteger[_NBit1]], other: _ArrayLikeUInt_co) -> NDArray[unsignedinteger[_NBit1]]: ...
  2534. @overload
  2535. def __iadd__(self: NDArray[signedinteger[_NBit1]], other: _ArrayLikeInt_co) -> NDArray[signedinteger[_NBit1]]: ...
  2536. @overload
  2537. def __iadd__(self: NDArray[floating[_NBit1]], other: _ArrayLikeFloat_co) -> NDArray[floating[_NBit1]]: ...
  2538. @overload
  2539. def __iadd__(self: NDArray[complexfloating[_NBit1, _NBit1]], other: _ArrayLikeComplex_co) -> NDArray[complexfloating[_NBit1, _NBit1]]: ...
  2540. @overload
  2541. def __iadd__(self: NDArray[timedelta64], other: _ArrayLikeTD64_co) -> NDArray[timedelta64]: ...
  2542. @overload
  2543. def __iadd__(self: NDArray[datetime64], other: _ArrayLikeTD64_co) -> NDArray[datetime64]: ...
  2544. @overload
  2545. def __iadd__(self: NDArray[object_], other: Any) -> NDArray[object_]: ...
  2546. @overload
  2547. def __iadd__(self: NDArray[_ScalarType], other: _RecursiveSequence) -> NDArray[_ScalarType]: ...
  2548. @overload # type: ignore[misc]
  2549. def __isub__(self: NDArray[Any], other: _NestedSequence[Union[str, bytes]]) -> NoReturn: ...
  2550. @overload
  2551. def __isub__(self: NDArray[unsignedinteger[_NBit1]], other: _ArrayLikeUInt_co) -> NDArray[unsignedinteger[_NBit1]]: ...
  2552. @overload
  2553. def __isub__(self: NDArray[signedinteger[_NBit1]], other: _ArrayLikeInt_co) -> NDArray[signedinteger[_NBit1]]: ...
  2554. @overload
  2555. def __isub__(self: NDArray[floating[_NBit1]], other: _ArrayLikeFloat_co) -> NDArray[floating[_NBit1]]: ...
  2556. @overload
  2557. def __isub__(self: NDArray[complexfloating[_NBit1, _NBit1]], other: _ArrayLikeComplex_co) -> NDArray[complexfloating[_NBit1, _NBit1]]: ...
  2558. @overload
  2559. def __isub__(self: NDArray[timedelta64], other: _ArrayLikeTD64_co) -> NDArray[timedelta64]: ...
  2560. @overload
  2561. def __isub__(self: NDArray[datetime64], other: _ArrayLikeTD64_co) -> NDArray[datetime64]: ...
  2562. @overload
  2563. def __isub__(self: NDArray[object_], other: Any) -> NDArray[object_]: ...
  2564. @overload
  2565. def __isub__(self: NDArray[_ScalarType], other: _RecursiveSequence) -> NDArray[_ScalarType]: ...
  2566. @overload # type: ignore[misc]
  2567. def __imul__(self: NDArray[Any], other: _NestedSequence[Union[str, bytes]]) -> NoReturn: ...
  2568. @overload
  2569. def __imul__(self: NDArray[bool_], other: _ArrayLikeBool_co) -> NDArray[bool_]: ...
  2570. @overload
  2571. def __imul__(self: NDArray[unsignedinteger[_NBit1]], other: _ArrayLikeUInt_co) -> NDArray[unsignedinteger[_NBit1]]: ...
  2572. @overload
  2573. def __imul__(self: NDArray[signedinteger[_NBit1]], other: _ArrayLikeInt_co) -> NDArray[signedinteger[_NBit1]]: ...
  2574. @overload
  2575. def __imul__(self: NDArray[floating[_NBit1]], other: _ArrayLikeFloat_co) -> NDArray[floating[_NBit1]]: ...
  2576. @overload
  2577. def __imul__(self: NDArray[complexfloating[_NBit1, _NBit1]], other: _ArrayLikeComplex_co) -> NDArray[complexfloating[_NBit1, _NBit1]]: ...
  2578. @overload
  2579. def __imul__(self: NDArray[timedelta64], other: _ArrayLikeFloat_co) -> NDArray[timedelta64]: ...
  2580. @overload
  2581. def __imul__(self: NDArray[object_], other: Any) -> NDArray[object_]: ...
  2582. @overload
  2583. def __imul__(self: NDArray[_ScalarType], other: _RecursiveSequence) -> NDArray[_ScalarType]: ...
  2584. @overload # type: ignore[misc]
  2585. def __itruediv__(self: NDArray[Any], other: _NestedSequence[Union[str, bytes]]) -> NoReturn: ...
  2586. @overload
  2587. def __itruediv__(self: NDArray[floating[_NBit1]], other: _ArrayLikeFloat_co) -> NDArray[floating[_NBit1]]: ...
  2588. @overload
  2589. def __itruediv__(self: NDArray[complexfloating[_NBit1, _NBit1]], other: _ArrayLikeComplex_co) -> NDArray[complexfloating[_NBit1, _NBit1]]: ...
  2590. @overload
  2591. def __itruediv__(self: NDArray[timedelta64], other: _ArrayLikeBool_co) -> NoReturn: ...
  2592. @overload
  2593. def __itruediv__(self: NDArray[timedelta64], other: _ArrayLikeInt_co) -> NDArray[timedelta64]: ...
  2594. @overload
  2595. def __itruediv__(self: NDArray[object_], other: Any) -> NDArray[object_]: ...
  2596. @overload
  2597. def __itruediv__(self: NDArray[_ScalarType], other: _RecursiveSequence) -> NDArray[_ScalarType]: ...
  2598. @overload # type: ignore[misc]
  2599. def __ifloordiv__(self: NDArray[Any], other: _NestedSequence[Union[str, bytes]]) -> NoReturn: ...
  2600. @overload
  2601. def __ifloordiv__(self: NDArray[unsignedinteger[_NBit1]], other: _ArrayLikeUInt_co) -> NDArray[unsignedinteger[_NBit1]]: ...
  2602. @overload
  2603. def __ifloordiv__(self: NDArray[signedinteger[_NBit1]], other: _ArrayLikeInt_co) -> NDArray[signedinteger[_NBit1]]: ...
  2604. @overload
  2605. def __ifloordiv__(self: NDArray[floating[_NBit1]], other: _ArrayLikeFloat_co) -> NDArray[floating[_NBit1]]: ...
  2606. @overload
  2607. def __ifloordiv__(self: NDArray[complexfloating[_NBit1, _NBit1]], other: _ArrayLikeComplex_co) -> NDArray[complexfloating[_NBit1, _NBit1]]: ...
  2608. @overload
  2609. def __ifloordiv__(self: NDArray[timedelta64], other: _ArrayLikeBool_co) -> NoReturn: ...
  2610. @overload
  2611. def __ifloordiv__(self: NDArray[timedelta64], other: _ArrayLikeInt_co) -> NDArray[timedelta64]: ...
  2612. @overload
  2613. def __ifloordiv__(self: NDArray[object_], other: Any) -> NDArray[object_]: ...
  2614. @overload
  2615. def __ifloordiv__(self: NDArray[_ScalarType], other: _RecursiveSequence) -> NDArray[_ScalarType]: ...
  2616. @overload # type: ignore[misc]
  2617. def __ipow__(self: NDArray[Any], other: _NestedSequence[Union[str, bytes]]) -> NoReturn: ...
  2618. @overload
  2619. def __ipow__(self: NDArray[unsignedinteger[_NBit1]], other: _ArrayLikeUInt_co) -> NDArray[unsignedinteger[_NBit1]]: ...
  2620. @overload
  2621. def __ipow__(self: NDArray[signedinteger[_NBit1]], other: _ArrayLikeInt_co) -> NDArray[signedinteger[_NBit1]]: ...
  2622. @overload
  2623. def __ipow__(self: NDArray[floating[_NBit1]], other: _ArrayLikeFloat_co) -> NDArray[floating[_NBit1]]: ...
  2624. @overload
  2625. def __ipow__(self: NDArray[complexfloating[_NBit1, _NBit1]], other: _ArrayLikeComplex_co) -> NDArray[complexfloating[_NBit1, _NBit1]]: ...
  2626. @overload
  2627. def __ipow__(self: NDArray[object_], other: Any) -> NDArray[object_]: ...
  2628. @overload
  2629. def __ipow__(self: NDArray[_ScalarType], other: _RecursiveSequence) -> NDArray[_ScalarType]: ...
  2630. @overload # type: ignore[misc]
  2631. def __imod__(self: NDArray[Any], other: _NestedSequence[Union[str, bytes]]) -> NoReturn: ...
  2632. @overload
  2633. def __imod__(self: NDArray[unsignedinteger[_NBit1]], other: _ArrayLikeUInt_co) -> NDArray[unsignedinteger[_NBit1]]: ...
  2634. @overload
  2635. def __imod__(self: NDArray[signedinteger[_NBit1]], other: _ArrayLikeInt_co) -> NDArray[signedinteger[_NBit1]]: ...
  2636. @overload
  2637. def __imod__(self: NDArray[floating[_NBit1]], other: _ArrayLikeFloat_co) -> NDArray[floating[_NBit1]]: ...
  2638. @overload
  2639. def __imod__(self: NDArray[timedelta64], other: _NestedSequence[_SupportsArray[_dtype[timedelta64]]]) -> NDArray[timedelta64]: ...
  2640. @overload
  2641. def __imod__(self: NDArray[object_], other: Any) -> NDArray[object_]: ...
  2642. @overload
  2643. def __imod__(self: NDArray[_ScalarType], other: _RecursiveSequence) -> NDArray[_ScalarType]: ...
  2644. @overload # type: ignore[misc]
  2645. def __ilshift__(self: NDArray[Any], other: _NestedSequence[Union[str, bytes]]) -> NoReturn: ...
  2646. @overload
  2647. def __ilshift__(self: NDArray[unsignedinteger[_NBit1]], other: _ArrayLikeUInt_co) -> NDArray[unsignedinteger[_NBit1]]: ...
  2648. @overload
  2649. def __ilshift__(self: NDArray[signedinteger[_NBit1]], other: _ArrayLikeInt_co) -> NDArray[signedinteger[_NBit1]]: ...
  2650. @overload
  2651. def __ilshift__(self: NDArray[object_], other: Any) -> NDArray[object_]: ...
  2652. @overload
  2653. def __ilshift__(self: NDArray[_ScalarType], other: _RecursiveSequence) -> NDArray[_ScalarType]: ...
  2654. @overload # type: ignore[misc]
  2655. def __irshift__(self: NDArray[Any], other: _NestedSequence[Union[str, bytes]]) -> NoReturn: ...
  2656. @overload
  2657. def __irshift__(self: NDArray[unsignedinteger[_NBit1]], other: _ArrayLikeUInt_co) -> NDArray[unsignedinteger[_NBit1]]: ...
  2658. @overload
  2659. def __irshift__(self: NDArray[signedinteger[_NBit1]], other: _ArrayLikeInt_co) -> NDArray[signedinteger[_NBit1]]: ...
  2660. @overload
  2661. def __irshift__(self: NDArray[object_], other: Any) -> NDArray[object_]: ...
  2662. @overload
  2663. def __irshift__(self: NDArray[_ScalarType], other: _RecursiveSequence) -> NDArray[_ScalarType]: ...
  2664. @overload # type: ignore[misc]
  2665. def __iand__(self: NDArray[Any], other: _NestedSequence[Union[str, bytes]]) -> NoReturn: ...
  2666. @overload
  2667. def __iand__(self: NDArray[bool_], other: _ArrayLikeBool_co) -> NDArray[bool_]: ...
  2668. @overload
  2669. def __iand__(self: NDArray[unsignedinteger[_NBit1]], other: _ArrayLikeUInt_co) -> NDArray[unsignedinteger[_NBit1]]: ...
  2670. @overload
  2671. def __iand__(self: NDArray[signedinteger[_NBit1]], other: _ArrayLikeInt_co) -> NDArray[signedinteger[_NBit1]]: ...
  2672. @overload
  2673. def __iand__(self: NDArray[object_], other: Any) -> NDArray[object_]: ...
  2674. @overload
  2675. def __iand__(self: NDArray[_ScalarType], other: _RecursiveSequence) -> NDArray[_ScalarType]: ...
  2676. @overload # type: ignore[misc]
  2677. def __ixor__(self: NDArray[Any], other: _NestedSequence[Union[str, bytes]]) -> NoReturn: ...
  2678. @overload
  2679. def __ixor__(self: NDArray[bool_], other: _ArrayLikeBool_co) -> NDArray[bool_]: ...
  2680. @overload
  2681. def __ixor__(self: NDArray[unsignedinteger[_NBit1]], other: _ArrayLikeUInt_co) -> NDArray[unsignedinteger[_NBit1]]: ...
  2682. @overload
  2683. def __ixor__(self: NDArray[signedinteger[_NBit1]], other: _ArrayLikeInt_co) -> NDArray[signedinteger[_NBit1]]: ...
  2684. @overload
  2685. def __ixor__(self: NDArray[object_], other: Any) -> NDArray[object_]: ...
  2686. @overload
  2687. def __ixor__(self: NDArray[_ScalarType], other: _RecursiveSequence) -> NDArray[_ScalarType]: ...
  2688. @overload # type: ignore[misc]
  2689. def __ior__(self: NDArray[Any], other: _NestedSequence[Union[str, bytes]]) -> NoReturn: ...
  2690. @overload
  2691. def __ior__(self: NDArray[bool_], other: _ArrayLikeBool_co) -> NDArray[bool_]: ...
  2692. @overload
  2693. def __ior__(self: NDArray[unsignedinteger[_NBit1]], other: _ArrayLikeUInt_co) -> NDArray[unsignedinteger[_NBit1]]: ...
  2694. @overload
  2695. def __ior__(self: NDArray[signedinteger[_NBit1]], other: _ArrayLikeInt_co) -> NDArray[signedinteger[_NBit1]]: ...
  2696. @overload
  2697. def __ior__(self: NDArray[object_], other: Any) -> NDArray[object_]: ...
  2698. @overload
  2699. def __ior__(self: NDArray[_ScalarType], other: _RecursiveSequence) -> NDArray[_ScalarType]: ...
  2700. # Keep `dtype` at the bottom to avoid name conflicts with `np.dtype`
  2701. @property
  2702. def dtype(self) -> _DType_co: ...
  2703. # NOTE: while `np.generic` is not technically an instance of `ABCMeta`,
  2704. # the `@abstractmethod` decorator is herein used to (forcefully) deny
  2705. # the creation of `np.generic` instances.
  2706. # The `# type: ignore` comments are necessary to silence mypy errors regarding
  2707. # the missing `ABCMeta` metaclass.
  2708. # See https://github.com/numpy/numpy-stubs/pull/80 for more details.
  2709. _ScalarType = TypeVar("_ScalarType", bound=generic)
  2710. _NBit1 = TypeVar("_NBit1", bound=NBitBase)
  2711. _NBit2 = TypeVar("_NBit2", bound=NBitBase)
  2712. class generic(_ArrayOrScalarCommon):
  2713. @abstractmethod
  2714. def __init__(self, *args: Any, **kwargs: Any) -> None: ...
  2715. @overload
  2716. def __array__(self: _ScalarType, __dtype: None = ...) -> ndarray[Any, _dtype[_ScalarType]]: ...
  2717. @overload
  2718. def __array__(self, __dtype: _DType) -> ndarray[Any, _DType]: ...
  2719. @property
  2720. def base(self) -> None: ...
  2721. @property
  2722. def ndim(self) -> L[0]: ...
  2723. @property
  2724. def size(self) -> L[1]: ...
  2725. @property
  2726. def shape(self) -> Tuple[()]: ...
  2727. @property
  2728. def strides(self) -> Tuple[()]: ...
  2729. def byteswap(self: _ScalarType, inplace: L[False] = ...) -> _ScalarType: ...
  2730. @property
  2731. def flat(self: _ScalarType) -> flatiter[ndarray[Any, _dtype[_ScalarType]]]: ...
  2732. @overload
  2733. def astype(
  2734. self,
  2735. dtype: _DTypeLike[_ScalarType],
  2736. order: _OrderKACF = ...,
  2737. casting: _Casting = ...,
  2738. subok: bool = ...,
  2739. copy: bool = ...,
  2740. ) -> _ScalarType: ...
  2741. @overload
  2742. def astype(
  2743. self,
  2744. dtype: DTypeLike,
  2745. order: _OrderKACF = ...,
  2746. casting: _Casting = ...,
  2747. subok: bool = ...,
  2748. copy: bool = ...,
  2749. ) -> Any: ...
  2750. # NOTE: `view` will perform a 0D->scalar cast,
  2751. # thus the array `type` is irrelevant to the output type
  2752. @overload
  2753. def view(
  2754. self: _ScalarType,
  2755. type: Type[ndarray[Any, Any]] = ...,
  2756. ) -> _ScalarType: ...
  2757. @overload
  2758. def view(
  2759. self,
  2760. dtype: _DTypeLike[_ScalarType],
  2761. type: Type[ndarray[Any, Any]] = ...,
  2762. ) -> _ScalarType: ...
  2763. @overload
  2764. def view(
  2765. self,
  2766. dtype: DTypeLike,
  2767. type: Type[ndarray[Any, Any]] = ...,
  2768. ) -> Any: ...
  2769. @overload
  2770. def getfield(
  2771. self,
  2772. dtype: _DTypeLike[_ScalarType],
  2773. offset: SupportsIndex = ...
  2774. ) -> _ScalarType: ...
  2775. @overload
  2776. def getfield(
  2777. self,
  2778. dtype: DTypeLike,
  2779. offset: SupportsIndex = ...
  2780. ) -> Any: ...
  2781. def item(
  2782. self,
  2783. __args: Union[L[0], Tuple[()], Tuple[L[0]]] = ...,
  2784. ) -> Any: ...
  2785. @overload
  2786. def take( # type: ignore[misc]
  2787. self: _ScalarType,
  2788. indices: _IntLike_co,
  2789. axis: Optional[SupportsIndex] = ...,
  2790. out: None = ...,
  2791. mode: _ModeKind = ...,
  2792. ) -> _ScalarType: ...
  2793. @overload
  2794. def take( # type: ignore[misc]
  2795. self: _ScalarType,
  2796. indices: _ArrayLikeInt_co,
  2797. axis: Optional[SupportsIndex] = ...,
  2798. out: None = ...,
  2799. mode: _ModeKind = ...,
  2800. ) -> ndarray[Any, _dtype[_ScalarType]]: ...
  2801. @overload
  2802. def take(
  2803. self,
  2804. indices: _ArrayLikeInt_co,
  2805. axis: Optional[SupportsIndex] = ...,
  2806. out: _NdArraySubClass = ...,
  2807. mode: _ModeKind = ...,
  2808. ) -> _NdArraySubClass: ...
  2809. def repeat(
  2810. self: _ScalarType,
  2811. repeats: _ArrayLikeInt_co,
  2812. axis: Optional[SupportsIndex] = ...,
  2813. ) -> ndarray[Any, _dtype[_ScalarType]]: ...
  2814. def flatten(
  2815. self: _ScalarType,
  2816. order: _OrderKACF = ...,
  2817. ) -> ndarray[Any, _dtype[_ScalarType]]: ...
  2818. def ravel(
  2819. self: _ScalarType,
  2820. order: _OrderKACF = ...,
  2821. ) -> ndarray[Any, _dtype[_ScalarType]]: ...
  2822. @overload
  2823. def reshape(
  2824. self: _ScalarType, __shape: _ShapeLike, *, order: _OrderACF = ...
  2825. ) -> ndarray[Any, _dtype[_ScalarType]]: ...
  2826. @overload
  2827. def reshape(
  2828. self: _ScalarType, *shape: SupportsIndex, order: _OrderACF = ...
  2829. ) -> ndarray[Any, _dtype[_ScalarType]]: ...
  2830. def squeeze(
  2831. self: _ScalarType, axis: Union[L[0], Tuple[()]] = ...
  2832. ) -> _ScalarType: ...
  2833. def transpose(self: _ScalarType, __axes: Tuple[()] = ...) -> _ScalarType: ...
  2834. # Keep `dtype` at the bottom to avoid name conflicts with `np.dtype`
  2835. @property
  2836. def dtype(self: _ScalarType) -> _dtype[_ScalarType]: ...
  2837. class number(generic, Generic[_NBit1]): # type: ignore
  2838. @property
  2839. def real(self: _ArraySelf) -> _ArraySelf: ...
  2840. @property
  2841. def imag(self: _ArraySelf) -> _ArraySelf: ...
  2842. def __int__(self) -> int: ...
  2843. def __float__(self) -> float: ...
  2844. def __complex__(self) -> complex: ...
  2845. def __neg__(self: _ArraySelf) -> _ArraySelf: ...
  2846. def __pos__(self: _ArraySelf) -> _ArraySelf: ...
  2847. def __abs__(self: _ArraySelf) -> _ArraySelf: ...
  2848. # Ensure that objects annotated as `number` support arithmetic operations
  2849. __add__: _NumberOp
  2850. __radd__: _NumberOp
  2851. __sub__: _NumberOp
  2852. __rsub__: _NumberOp
  2853. __mul__: _NumberOp
  2854. __rmul__: _NumberOp
  2855. __floordiv__: _NumberOp
  2856. __rfloordiv__: _NumberOp
  2857. __pow__: _NumberOp
  2858. __rpow__: _NumberOp
  2859. __truediv__: _NumberOp
  2860. __rtruediv__: _NumberOp
  2861. __lt__: _ComparisonOp[_NumberLike_co, _ArrayLikeNumber_co]
  2862. __le__: _ComparisonOp[_NumberLike_co, _ArrayLikeNumber_co]
  2863. __gt__: _ComparisonOp[_NumberLike_co, _ArrayLikeNumber_co]
  2864. __ge__: _ComparisonOp[_NumberLike_co, _ArrayLikeNumber_co]
  2865. class bool_(generic):
  2866. def __init__(self, __value: object = ...) -> None: ...
  2867. def item(
  2868. self,
  2869. __args: Union[L[0], Tuple[()], Tuple[L[0]]] = ...,
  2870. ) -> bool: ...
  2871. def tolist(self) -> bool: ...
  2872. @property
  2873. def real(self: _ArraySelf) -> _ArraySelf: ...
  2874. @property
  2875. def imag(self: _ArraySelf) -> _ArraySelf: ...
  2876. def __int__(self) -> int: ...
  2877. def __float__(self) -> float: ...
  2878. def __complex__(self) -> complex: ...
  2879. def __abs__(self: _ArraySelf) -> _ArraySelf: ...
  2880. __add__: _BoolOp[bool_]
  2881. __radd__: _BoolOp[bool_]
  2882. __sub__: _BoolSub
  2883. __rsub__: _BoolSub
  2884. __mul__: _BoolOp[bool_]
  2885. __rmul__: _BoolOp[bool_]
  2886. __floordiv__: _BoolOp[int8]
  2887. __rfloordiv__: _BoolOp[int8]
  2888. __pow__: _BoolOp[int8]
  2889. __rpow__: _BoolOp[int8]
  2890. __truediv__: _BoolTrueDiv
  2891. __rtruediv__: _BoolTrueDiv
  2892. def __invert__(self) -> bool_: ...
  2893. __lshift__: _BoolBitOp[int8]
  2894. __rlshift__: _BoolBitOp[int8]
  2895. __rshift__: _BoolBitOp[int8]
  2896. __rrshift__: _BoolBitOp[int8]
  2897. __and__: _BoolBitOp[bool_]
  2898. __rand__: _BoolBitOp[bool_]
  2899. __xor__: _BoolBitOp[bool_]
  2900. __rxor__: _BoolBitOp[bool_]
  2901. __or__: _BoolBitOp[bool_]
  2902. __ror__: _BoolBitOp[bool_]
  2903. __mod__: _BoolMod
  2904. __rmod__: _BoolMod
  2905. __divmod__: _BoolDivMod
  2906. __rdivmod__: _BoolDivMod
  2907. __lt__: _ComparisonOp[_NumberLike_co, _ArrayLikeNumber_co]
  2908. __le__: _ComparisonOp[_NumberLike_co, _ArrayLikeNumber_co]
  2909. __gt__: _ComparisonOp[_NumberLike_co, _ArrayLikeNumber_co]
  2910. __ge__: _ComparisonOp[_NumberLike_co, _ArrayLikeNumber_co]
  2911. bool8 = bool_
  2912. class object_(generic):
  2913. def __init__(self, __value: object = ...) -> None: ...
  2914. @property
  2915. def real(self: _ArraySelf) -> _ArraySelf: ...
  2916. @property
  2917. def imag(self: _ArraySelf) -> _ArraySelf: ...
  2918. # The 3 protocols below may or may not raise,
  2919. # depending on the underlying object
  2920. def __int__(self) -> int: ...
  2921. def __float__(self) -> float: ...
  2922. def __complex__(self) -> complex: ...
  2923. object0 = object_
  2924. # The `datetime64` constructors requires an object with the three attributes below,
  2925. # and thus supports datetime duck typing
  2926. class _DatetimeScalar(Protocol):
  2927. @property
  2928. def day(self) -> int: ...
  2929. @property
  2930. def month(self) -> int: ...
  2931. @property
  2932. def year(self) -> int: ...
  2933. # TODO: `item`/`tolist` returns either `dt.date`, `dt.datetime` or `int`
  2934. # depending on the unit
  2935. class datetime64(generic):
  2936. @overload
  2937. def __init__(
  2938. self,
  2939. __value: Union[None, datetime64, _CharLike_co, _DatetimeScalar] = ...,
  2940. __format: Union[_CharLike_co, Tuple[_CharLike_co, _IntLike_co]] = ...,
  2941. ) -> None: ...
  2942. @overload
  2943. def __init__(
  2944. self,
  2945. __value: int,
  2946. __format: Union[_CharLike_co, Tuple[_CharLike_co, _IntLike_co]]
  2947. ) -> None: ...
  2948. def __add__(self, other: _TD64Like_co) -> datetime64: ...
  2949. def __radd__(self, other: _TD64Like_co) -> datetime64: ...
  2950. @overload
  2951. def __sub__(self, other: datetime64) -> timedelta64: ...
  2952. @overload
  2953. def __sub__(self, other: _TD64Like_co) -> datetime64: ...
  2954. def __rsub__(self, other: datetime64) -> timedelta64: ...
  2955. __lt__: _ComparisonOp[datetime64, _ArrayLikeDT64_co]
  2956. __le__: _ComparisonOp[datetime64, _ArrayLikeDT64_co]
  2957. __gt__: _ComparisonOp[datetime64, _ArrayLikeDT64_co]
  2958. __ge__: _ComparisonOp[datetime64, _ArrayLikeDT64_co]
  2959. # Support for `__index__` was added in python 3.8 (bpo-20092)
  2960. if sys.version_info >= (3, 8):
  2961. _IntValue = Union[SupportsInt, _CharLike_co, SupportsIndex]
  2962. _FloatValue = Union[None, _CharLike_co, SupportsFloat, SupportsIndex]
  2963. _ComplexValue = Union[
  2964. None,
  2965. _CharLike_co,
  2966. SupportsFloat,
  2967. SupportsComplex,
  2968. SupportsIndex,
  2969. complex, # `complex` is not a subtype of `SupportsComplex`
  2970. ]
  2971. else:
  2972. _IntValue = Union[SupportsInt, _CharLike_co]
  2973. _FloatValue = Union[None, _CharLike_co, SupportsFloat]
  2974. _ComplexValue = Union[
  2975. None,
  2976. _CharLike_co,
  2977. SupportsFloat,
  2978. SupportsComplex,
  2979. complex,
  2980. ]
  2981. class integer(number[_NBit1]): # type: ignore
  2982. @property
  2983. def numerator(self: _ScalarType) -> _ScalarType: ...
  2984. @property
  2985. def denominator(self) -> L[1]: ...
  2986. @overload
  2987. def __round__(self, ndigits: None = ...) -> int: ...
  2988. @overload
  2989. def __round__(self: _ScalarType, ndigits: SupportsIndex) -> _ScalarType: ...
  2990. # NOTE: `__index__` is technically defined in the bottom-most
  2991. # sub-classes (`int64`, `uint32`, etc)
  2992. def item(
  2993. self,
  2994. __args: Union[L[0], Tuple[()], Tuple[L[0]]] = ...,
  2995. ) -> int: ...
  2996. def tolist(self) -> int: ...
  2997. def __index__(self) -> int: ...
  2998. __truediv__: _IntTrueDiv[_NBit1]
  2999. __rtruediv__: _IntTrueDiv[_NBit1]
  3000. def __mod__(self, value: _IntLike_co) -> integer: ...
  3001. def __rmod__(self, value: _IntLike_co) -> integer: ...
  3002. def __invert__(self: _IntType) -> _IntType: ...
  3003. # Ensure that objects annotated as `integer` support bit-wise operations
  3004. def __lshift__(self, other: _IntLike_co) -> integer: ...
  3005. def __rlshift__(self, other: _IntLike_co) -> integer: ...
  3006. def __rshift__(self, other: _IntLike_co) -> integer: ...
  3007. def __rrshift__(self, other: _IntLike_co) -> integer: ...
  3008. def __and__(self, other: _IntLike_co) -> integer: ...
  3009. def __rand__(self, other: _IntLike_co) -> integer: ...
  3010. def __or__(self, other: _IntLike_co) -> integer: ...
  3011. def __ror__(self, other: _IntLike_co) -> integer: ...
  3012. def __xor__(self, other: _IntLike_co) -> integer: ...
  3013. def __rxor__(self, other: _IntLike_co) -> integer: ...
  3014. class signedinteger(integer[_NBit1]):
  3015. def __init__(self, __value: _IntValue = ...) -> None: ...
  3016. __add__: _SignedIntOp[_NBit1]
  3017. __radd__: _SignedIntOp[_NBit1]
  3018. __sub__: _SignedIntOp[_NBit1]
  3019. __rsub__: _SignedIntOp[_NBit1]
  3020. __mul__: _SignedIntOp[_NBit1]
  3021. __rmul__: _SignedIntOp[_NBit1]
  3022. __floordiv__: _SignedIntOp[_NBit1]
  3023. __rfloordiv__: _SignedIntOp[_NBit1]
  3024. __pow__: _SignedIntOp[_NBit1]
  3025. __rpow__: _SignedIntOp[_NBit1]
  3026. __lshift__: _SignedIntBitOp[_NBit1]
  3027. __rlshift__: _SignedIntBitOp[_NBit1]
  3028. __rshift__: _SignedIntBitOp[_NBit1]
  3029. __rrshift__: _SignedIntBitOp[_NBit1]
  3030. __and__: _SignedIntBitOp[_NBit1]
  3031. __rand__: _SignedIntBitOp[_NBit1]
  3032. __xor__: _SignedIntBitOp[_NBit1]
  3033. __rxor__: _SignedIntBitOp[_NBit1]
  3034. __or__: _SignedIntBitOp[_NBit1]
  3035. __ror__: _SignedIntBitOp[_NBit1]
  3036. __mod__: _SignedIntMod[_NBit1]
  3037. __rmod__: _SignedIntMod[_NBit1]
  3038. __divmod__: _SignedIntDivMod[_NBit1]
  3039. __rdivmod__: _SignedIntDivMod[_NBit1]
  3040. int8 = signedinteger[_8Bit]
  3041. int16 = signedinteger[_16Bit]
  3042. int32 = signedinteger[_32Bit]
  3043. int64 = signedinteger[_64Bit]
  3044. byte = signedinteger[_NBitByte]
  3045. short = signedinteger[_NBitShort]
  3046. intc = signedinteger[_NBitIntC]
  3047. intp = signedinteger[_NBitIntP]
  3048. int0 = signedinteger[_NBitIntP]
  3049. int_ = signedinteger[_NBitInt]
  3050. longlong = signedinteger[_NBitLongLong]
  3051. # TODO: `item`/`tolist` returns either `dt.timedelta` or `int`
  3052. # depending on the unit
  3053. class timedelta64(generic):
  3054. def __init__(
  3055. self,
  3056. __value: Union[None, int, _CharLike_co, dt.timedelta, timedelta64] = ...,
  3057. __format: Union[_CharLike_co, Tuple[_CharLike_co, _IntLike_co]] = ...,
  3058. ) -> None: ...
  3059. @property
  3060. def numerator(self: _ScalarType) -> _ScalarType: ...
  3061. @property
  3062. def denominator(self) -> L[1]: ...
  3063. # NOTE: Only a limited number of units support conversion
  3064. # to builtin scalar types: `Y`, `M`, `ns`, `ps`, `fs`, `as`
  3065. def __int__(self) -> int: ...
  3066. def __float__(self) -> float: ...
  3067. def __complex__(self) -> complex: ...
  3068. def __neg__(self: _ArraySelf) -> _ArraySelf: ...
  3069. def __pos__(self: _ArraySelf) -> _ArraySelf: ...
  3070. def __abs__(self: _ArraySelf) -> _ArraySelf: ...
  3071. def __add__(self, other: _TD64Like_co) -> timedelta64: ...
  3072. def __radd__(self, other: _TD64Like_co) -> timedelta64: ...
  3073. def __sub__(self, other: _TD64Like_co) -> timedelta64: ...
  3074. def __rsub__(self, other: _TD64Like_co) -> timedelta64: ...
  3075. def __mul__(self, other: _FloatLike_co) -> timedelta64: ...
  3076. def __rmul__(self, other: _FloatLike_co) -> timedelta64: ...
  3077. __truediv__: _TD64Div[float64]
  3078. __floordiv__: _TD64Div[int64]
  3079. def __rtruediv__(self, other: timedelta64) -> float64: ...
  3080. def __rfloordiv__(self, other: timedelta64) -> int64: ...
  3081. def __mod__(self, other: timedelta64) -> timedelta64: ...
  3082. def __rmod__(self, other: timedelta64) -> timedelta64: ...
  3083. def __divmod__(self, other: timedelta64) -> Tuple[int64, timedelta64]: ...
  3084. def __rdivmod__(self, other: timedelta64) -> Tuple[int64, timedelta64]: ...
  3085. __lt__: _ComparisonOp[_TD64Like_co, _ArrayLikeTD64_co]
  3086. __le__: _ComparisonOp[_TD64Like_co, _ArrayLikeTD64_co]
  3087. __gt__: _ComparisonOp[_TD64Like_co, _ArrayLikeTD64_co]
  3088. __ge__: _ComparisonOp[_TD64Like_co, _ArrayLikeTD64_co]
  3089. class unsignedinteger(integer[_NBit1]):
  3090. # NOTE: `uint64 + signedinteger -> float64`
  3091. def __init__(self, __value: _IntValue = ...) -> None: ...
  3092. __add__: _UnsignedIntOp[_NBit1]
  3093. __radd__: _UnsignedIntOp[_NBit1]
  3094. __sub__: _UnsignedIntOp[_NBit1]
  3095. __rsub__: _UnsignedIntOp[_NBit1]
  3096. __mul__: _UnsignedIntOp[_NBit1]
  3097. __rmul__: _UnsignedIntOp[_NBit1]
  3098. __floordiv__: _UnsignedIntOp[_NBit1]
  3099. __rfloordiv__: _UnsignedIntOp[_NBit1]
  3100. __pow__: _UnsignedIntOp[_NBit1]
  3101. __rpow__: _UnsignedIntOp[_NBit1]
  3102. __lshift__: _UnsignedIntBitOp[_NBit1]
  3103. __rlshift__: _UnsignedIntBitOp[_NBit1]
  3104. __rshift__: _UnsignedIntBitOp[_NBit1]
  3105. __rrshift__: _UnsignedIntBitOp[_NBit1]
  3106. __and__: _UnsignedIntBitOp[_NBit1]
  3107. __rand__: _UnsignedIntBitOp[_NBit1]
  3108. __xor__: _UnsignedIntBitOp[_NBit1]
  3109. __rxor__: _UnsignedIntBitOp[_NBit1]
  3110. __or__: _UnsignedIntBitOp[_NBit1]
  3111. __ror__: _UnsignedIntBitOp[_NBit1]
  3112. __mod__: _UnsignedIntMod[_NBit1]
  3113. __rmod__: _UnsignedIntMod[_NBit1]
  3114. __divmod__: _UnsignedIntDivMod[_NBit1]
  3115. __rdivmod__: _UnsignedIntDivMod[_NBit1]
  3116. uint8 = unsignedinteger[_8Bit]
  3117. uint16 = unsignedinteger[_16Bit]
  3118. uint32 = unsignedinteger[_32Bit]
  3119. uint64 = unsignedinteger[_64Bit]
  3120. ubyte = unsignedinteger[_NBitByte]
  3121. ushort = unsignedinteger[_NBitShort]
  3122. uintc = unsignedinteger[_NBitIntC]
  3123. uintp = unsignedinteger[_NBitIntP]
  3124. uint0 = unsignedinteger[_NBitIntP]
  3125. uint = unsignedinteger[_NBitInt]
  3126. ulonglong = unsignedinteger[_NBitLongLong]
  3127. class inexact(number[_NBit1]): # type: ignore
  3128. def __getnewargs__(self: inexact[_64Bit]) -> Tuple[float, ...]: ...
  3129. _IntType = TypeVar("_IntType", bound=integer)
  3130. _FloatType = TypeVar('_FloatType', bound=floating)
  3131. class floating(inexact[_NBit1]):
  3132. def __init__(self, __value: _FloatValue = ...) -> None: ...
  3133. def item(
  3134. self,
  3135. __args: Union[L[0], Tuple[()], Tuple[L[0]]] = ...,
  3136. ) -> float: ...
  3137. def tolist(self) -> float: ...
  3138. def is_integer(self: float64) -> bool: ...
  3139. def hex(self: float64) -> str: ...
  3140. @classmethod
  3141. def fromhex(cls: Type[float64], __string: str) -> float64: ...
  3142. def as_integer_ratio(self) -> Tuple[int, int]: ...
  3143. if sys.version_info >= (3, 9):
  3144. def __ceil__(self: float64) -> int: ...
  3145. def __floor__(self: float64) -> int: ...
  3146. def __trunc__(self: float64) -> int: ...
  3147. def __getnewargs__(self: float64) -> Tuple[float]: ...
  3148. def __getformat__(self: float64, __typestr: L["double", "float"]) -> str: ...
  3149. @overload
  3150. def __round__(self, ndigits: None = ...) -> int: ...
  3151. @overload
  3152. def __round__(self: _ScalarType, ndigits: SupportsIndex) -> _ScalarType: ...
  3153. __add__: _FloatOp[_NBit1]
  3154. __radd__: _FloatOp[_NBit1]
  3155. __sub__: _FloatOp[_NBit1]
  3156. __rsub__: _FloatOp[_NBit1]
  3157. __mul__: _FloatOp[_NBit1]
  3158. __rmul__: _FloatOp[_NBit1]
  3159. __truediv__: _FloatOp[_NBit1]
  3160. __rtruediv__: _FloatOp[_NBit1]
  3161. __floordiv__: _FloatOp[_NBit1]
  3162. __rfloordiv__: _FloatOp[_NBit1]
  3163. __pow__: _FloatOp[_NBit1]
  3164. __rpow__: _FloatOp[_NBit1]
  3165. __mod__: _FloatMod[_NBit1]
  3166. __rmod__: _FloatMod[_NBit1]
  3167. __divmod__: _FloatDivMod[_NBit1]
  3168. __rdivmod__: _FloatDivMod[_NBit1]
  3169. float16 = floating[_16Bit]
  3170. float32 = floating[_32Bit]
  3171. float64 = floating[_64Bit]
  3172. half = floating[_NBitHalf]
  3173. single = floating[_NBitSingle]
  3174. double = floating[_NBitDouble]
  3175. float_ = floating[_NBitDouble]
  3176. longdouble = floating[_NBitLongDouble]
  3177. longfloat = floating[_NBitLongDouble]
  3178. # The main reason for `complexfloating` having two typevars is cosmetic.
  3179. # It is used to clarify why `complex128`s precision is `_64Bit`, the latter
  3180. # describing the two 64 bit floats representing its real and imaginary component
  3181. class complexfloating(inexact[_NBit1], Generic[_NBit1, _NBit2]):
  3182. def __init__(self, __value: _ComplexValue = ...) -> None: ...
  3183. def item(
  3184. self,
  3185. __args: Union[L[0], Tuple[()], Tuple[L[0]]] = ...,
  3186. ) -> complex: ...
  3187. def tolist(self) -> complex: ...
  3188. @property
  3189. def real(self) -> floating[_NBit1]: ... # type: ignore[override]
  3190. @property
  3191. def imag(self) -> floating[_NBit2]: ... # type: ignore[override]
  3192. def __abs__(self) -> floating[_NBit1]: ... # type: ignore[override]
  3193. def __getnewargs__(self: complex128) -> Tuple[float, float]: ...
  3194. # NOTE: Deprecated
  3195. # def __round__(self, ndigits=...): ...
  3196. __add__: _ComplexOp[_NBit1]
  3197. __radd__: _ComplexOp[_NBit1]
  3198. __sub__: _ComplexOp[_NBit1]
  3199. __rsub__: _ComplexOp[_NBit1]
  3200. __mul__: _ComplexOp[_NBit1]
  3201. __rmul__: _ComplexOp[_NBit1]
  3202. __truediv__: _ComplexOp[_NBit1]
  3203. __rtruediv__: _ComplexOp[_NBit1]
  3204. __floordiv__: _ComplexOp[_NBit1]
  3205. __rfloordiv__: _ComplexOp[_NBit1]
  3206. __pow__: _ComplexOp[_NBit1]
  3207. __rpow__: _ComplexOp[_NBit1]
  3208. complex64 = complexfloating[_32Bit, _32Bit]
  3209. complex128 = complexfloating[_64Bit, _64Bit]
  3210. csingle = complexfloating[_NBitSingle, _NBitSingle]
  3211. singlecomplex = complexfloating[_NBitSingle, _NBitSingle]
  3212. cdouble = complexfloating[_NBitDouble, _NBitDouble]
  3213. complex_ = complexfloating[_NBitDouble, _NBitDouble]
  3214. cfloat = complexfloating[_NBitDouble, _NBitDouble]
  3215. clongdouble = complexfloating[_NBitLongDouble, _NBitLongDouble]
  3216. clongfloat = complexfloating[_NBitLongDouble, _NBitLongDouble]
  3217. longcomplex = complexfloating[_NBitLongDouble, _NBitLongDouble]
  3218. class flexible(generic): ... # type: ignore
  3219. # TODO: `item`/`tolist` returns either `bytes` or `tuple`
  3220. # depending on whether or not it's used as an opaque bytes sequence
  3221. # or a structure
  3222. class void(flexible):
  3223. def __init__(self, __value: Union[_IntLike_co, bytes]) -> None: ...
  3224. @property
  3225. def real(self: _ArraySelf) -> _ArraySelf: ...
  3226. @property
  3227. def imag(self: _ArraySelf) -> _ArraySelf: ...
  3228. def setfield(
  3229. self, val: ArrayLike, dtype: DTypeLike, offset: int = ...
  3230. ) -> None: ...
  3231. def __getitem__(self, key: SupportsIndex) -> Any: ...
  3232. def __setitem__(self, key: SupportsIndex, value: ArrayLike) -> None: ...
  3233. void0 = void
  3234. class character(flexible): # type: ignore
  3235. def __int__(self) -> int: ...
  3236. def __float__(self) -> float: ...
  3237. # NOTE: Most `np.bytes_` / `np.str_` methods return their
  3238. # builtin `bytes` / `str` counterpart
  3239. class bytes_(character, bytes):
  3240. @overload
  3241. def __init__(self, __value: object = ...) -> None: ...
  3242. @overload
  3243. def __init__(
  3244. self, __value: str, encoding: str = ..., errors: str = ...
  3245. ) -> None: ...
  3246. def item(
  3247. self,
  3248. __args: Union[L[0], Tuple[()], Tuple[L[0]]] = ...,
  3249. ) -> bytes: ...
  3250. def tolist(self) -> bytes: ...
  3251. string_ = bytes_
  3252. bytes0 = bytes_
  3253. class str_(character, str):
  3254. @overload
  3255. def __init__(self, __value: object = ...) -> None: ...
  3256. @overload
  3257. def __init__(
  3258. self, __value: bytes, encoding: str = ..., errors: str = ...
  3259. ) -> None: ...
  3260. def item(
  3261. self,
  3262. __args: Union[L[0], Tuple[()], Tuple[L[0]]] = ...,
  3263. ) -> str: ...
  3264. def tolist(self) -> str: ...
  3265. unicode_ = str_
  3266. str0 = str_
  3267. def array(
  3268. object: object,
  3269. dtype: DTypeLike = ...,
  3270. *,
  3271. copy: bool = ...,
  3272. order: _OrderKACF = ...,
  3273. subok: bool = ...,
  3274. ndmin: int = ...,
  3275. like: ArrayLike = ...,
  3276. ) -> ndarray: ...
  3277. def zeros(
  3278. shape: _ShapeLike,
  3279. dtype: DTypeLike = ...,
  3280. order: _OrderCF = ...,
  3281. *,
  3282. like: ArrayLike = ...,
  3283. ) -> ndarray: ...
  3284. def empty(
  3285. shape: _ShapeLike,
  3286. dtype: DTypeLike = ...,
  3287. order: _OrderCF = ...,
  3288. *,
  3289. like: ArrayLike = ...,
  3290. ) -> ndarray: ...
  3291. #
  3292. # Constants
  3293. #
  3294. Inf: Final[float]
  3295. Infinity: Final[float]
  3296. NAN: Final[float]
  3297. NINF: Final[float]
  3298. NZERO: Final[float]
  3299. NaN: Final[float]
  3300. PINF: Final[float]
  3301. PZERO: Final[float]
  3302. e: Final[float]
  3303. euler_gamma: Final[float]
  3304. inf: Final[float]
  3305. infty: Final[float]
  3306. nan: Final[float]
  3307. pi: Final[float]
  3308. ALLOW_THREADS: Final[int]
  3309. BUFSIZE: Final[int]
  3310. CLIP: Final[int]
  3311. ERR_CALL: Final[int]
  3312. ERR_DEFAULT: Final[int]
  3313. ERR_IGNORE: Final[int]
  3314. ERR_LOG: Final[int]
  3315. ERR_PRINT: Final[int]
  3316. ERR_RAISE: Final[int]
  3317. ERR_WARN: Final[int]
  3318. FLOATING_POINT_SUPPORT: Final[int]
  3319. FPE_DIVIDEBYZERO: Final[int]
  3320. FPE_INVALID: Final[int]
  3321. FPE_OVERFLOW: Final[int]
  3322. FPE_UNDERFLOW: Final[int]
  3323. MAXDIMS: Final[int]
  3324. MAY_SHARE_BOUNDS: Final[int]
  3325. MAY_SHARE_EXACT: Final[int]
  3326. RAISE: Final[int]
  3327. SHIFT_DIVIDEBYZERO: Final[int]
  3328. SHIFT_INVALID: Final[int]
  3329. SHIFT_OVERFLOW: Final[int]
  3330. SHIFT_UNDERFLOW: Final[int]
  3331. UFUNC_BUFSIZE_DEFAULT: Final[int]
  3332. WRAP: Final[int]
  3333. tracemalloc_domain: Final[int]
  3334. little_endian: Final[bool]
  3335. True_: Final[bool_]
  3336. False_: Final[bool_]
  3337. UFUNC_PYVALS_NAME: Final[str]
  3338. newaxis: None
  3339. # See `npt._ufunc` for more concrete nin-/nout-specific stubs
  3340. class ufunc:
  3341. @property
  3342. def __name__(self) -> str: ...
  3343. @property
  3344. def __doc__(self) -> str: ...
  3345. __call__: Callable[..., Any]
  3346. @property
  3347. def nin(self) -> int: ...
  3348. @property
  3349. def nout(self) -> int: ...
  3350. @property
  3351. def nargs(self) -> int: ...
  3352. @property
  3353. def ntypes(self) -> int: ...
  3354. @property
  3355. def types(self) -> List[str]: ...
  3356. # Broad return type because it has to encompass things like
  3357. #
  3358. # >>> np.logical_and.identity is True
  3359. # True
  3360. # >>> np.add.identity is 0
  3361. # True
  3362. # >>> np.sin.identity is None
  3363. # True
  3364. #
  3365. # and any user-defined ufuncs.
  3366. @property
  3367. def identity(self) -> Any: ...
  3368. # This is None for ufuncs and a string for gufuncs.
  3369. @property
  3370. def signature(self) -> Optional[str]: ...
  3371. # The next four methods will always exist, but they will just
  3372. # raise a ValueError ufuncs with that don't accept two input
  3373. # arguments and return one output argument. Because of that we
  3374. # can't type them very precisely.
  3375. reduce: Any
  3376. accumulate: Any
  3377. reduce: Any
  3378. outer: Any
  3379. # Similarly at won't be defined for ufuncs that return multiple
  3380. # outputs, so we can't type it very precisely.
  3381. at: Any
  3382. # Parameters: `__name__`, `ntypes` and `identity`
  3383. absolute: _UFunc_Nin1_Nout1[L['absolute'], L[20], None]
  3384. add: _UFunc_Nin2_Nout1[L['add'], L[22], L[0]]
  3385. arccos: _UFunc_Nin1_Nout1[L['arccos'], L[8], None]
  3386. arccosh: _UFunc_Nin1_Nout1[L['arccosh'], L[8], None]
  3387. arcsin: _UFunc_Nin1_Nout1[L['arcsin'], L[8], None]
  3388. arcsinh: _UFunc_Nin1_Nout1[L['arcsinh'], L[8], None]
  3389. arctan2: _UFunc_Nin2_Nout1[L['arctan2'], L[5], None]
  3390. arctan: _UFunc_Nin1_Nout1[L['arctan'], L[8], None]
  3391. arctanh: _UFunc_Nin1_Nout1[L['arctanh'], L[8], None]
  3392. bitwise_and: _UFunc_Nin2_Nout1[L['bitwise_and'], L[12], L[-1]]
  3393. bitwise_not: _UFunc_Nin1_Nout1[L['invert'], L[12], None]
  3394. bitwise_or: _UFunc_Nin2_Nout1[L['bitwise_or'], L[12], L[0]]
  3395. bitwise_xor: _UFunc_Nin2_Nout1[L['bitwise_xor'], L[12], L[0]]
  3396. cbrt: _UFunc_Nin1_Nout1[L['cbrt'], L[5], None]
  3397. ceil: _UFunc_Nin1_Nout1[L['ceil'], L[7], None]
  3398. conj: _UFunc_Nin1_Nout1[L['conjugate'], L[18], None]
  3399. conjugate: _UFunc_Nin1_Nout1[L['conjugate'], L[18], None]
  3400. copysign: _UFunc_Nin2_Nout1[L['copysign'], L[4], None]
  3401. cos: _UFunc_Nin1_Nout1[L['cos'], L[9], None]
  3402. cosh: _UFunc_Nin1_Nout1[L['cosh'], L[8], None]
  3403. deg2rad: _UFunc_Nin1_Nout1[L['deg2rad'], L[5], None]
  3404. degrees: _UFunc_Nin1_Nout1[L['degrees'], L[5], None]
  3405. divide: _UFunc_Nin2_Nout1[L['true_divide'], L[11], None]
  3406. divmod: _UFunc_Nin2_Nout2[L['divmod'], L[15], None]
  3407. equal: _UFunc_Nin2_Nout1[L['equal'], L[23], None]
  3408. exp2: _UFunc_Nin1_Nout1[L['exp2'], L[8], None]
  3409. exp: _UFunc_Nin1_Nout1[L['exp'], L[10], None]
  3410. expm1: _UFunc_Nin1_Nout1[L['expm1'], L[8], None]
  3411. fabs: _UFunc_Nin1_Nout1[L['fabs'], L[5], None]
  3412. float_power: _UFunc_Nin2_Nout1[L['float_power'], L[4], None]
  3413. floor: _UFunc_Nin1_Nout1[L['floor'], L[7], None]
  3414. floor_divide: _UFunc_Nin2_Nout1[L['floor_divide'], L[21], None]
  3415. fmax: _UFunc_Nin2_Nout1[L['fmax'], L[21], None]
  3416. fmin: _UFunc_Nin2_Nout1[L['fmin'], L[21], None]
  3417. fmod: _UFunc_Nin2_Nout1[L['fmod'], L[15], None]
  3418. frexp: _UFunc_Nin1_Nout2[L['frexp'], L[4], None]
  3419. gcd: _UFunc_Nin2_Nout1[L['gcd'], L[11], L[0]]
  3420. greater: _UFunc_Nin2_Nout1[L['greater'], L[23], None]
  3421. greater_equal: _UFunc_Nin2_Nout1[L['greater_equal'], L[23], None]
  3422. heaviside: _UFunc_Nin2_Nout1[L['heaviside'], L[4], None]
  3423. hypot: _UFunc_Nin2_Nout1[L['hypot'], L[5], L[0]]
  3424. invert: _UFunc_Nin1_Nout1[L['invert'], L[12], None]
  3425. isfinite: _UFunc_Nin1_Nout1[L['isfinite'], L[20], None]
  3426. isinf: _UFunc_Nin1_Nout1[L['isinf'], L[20], None]
  3427. isnan: _UFunc_Nin1_Nout1[L['isnan'], L[20], None]
  3428. isnat: _UFunc_Nin1_Nout1[L['isnat'], L[2], None]
  3429. lcm: _UFunc_Nin2_Nout1[L['lcm'], L[11], None]
  3430. ldexp: _UFunc_Nin2_Nout1[L['ldexp'], L[8], None]
  3431. left_shift: _UFunc_Nin2_Nout1[L['left_shift'], L[11], None]
  3432. less: _UFunc_Nin2_Nout1[L['less'], L[23], None]
  3433. less_equal: _UFunc_Nin2_Nout1[L['less_equal'], L[23], None]
  3434. log10: _UFunc_Nin1_Nout1[L['log10'], L[8], None]
  3435. log1p: _UFunc_Nin1_Nout1[L['log1p'], L[8], None]
  3436. log2: _UFunc_Nin1_Nout1[L['log2'], L[8], None]
  3437. log: _UFunc_Nin1_Nout1[L['log'], L[10], None]
  3438. logaddexp2: _UFunc_Nin2_Nout1[L['logaddexp2'], L[4], float]
  3439. logaddexp: _UFunc_Nin2_Nout1[L['logaddexp'], L[4], float]
  3440. logical_and: _UFunc_Nin2_Nout1[L['logical_and'], L[20], L[True]]
  3441. logical_not: _UFunc_Nin1_Nout1[L['logical_not'], L[20], None]
  3442. logical_or: _UFunc_Nin2_Nout1[L['logical_or'], L[20], L[False]]
  3443. logical_xor: _UFunc_Nin2_Nout1[L['logical_xor'], L[19], L[False]]
  3444. matmul: _GUFunc_Nin2_Nout1[L['matmul'], L[19], None]
  3445. maximum: _UFunc_Nin2_Nout1[L['maximum'], L[21], None]
  3446. minimum: _UFunc_Nin2_Nout1[L['minimum'], L[21], None]
  3447. mod: _UFunc_Nin2_Nout1[L['remainder'], L[16], None]
  3448. modf: _UFunc_Nin1_Nout2[L['modf'], L[4], None]
  3449. multiply: _UFunc_Nin2_Nout1[L['multiply'], L[23], L[1]]
  3450. negative: _UFunc_Nin1_Nout1[L['negative'], L[19], None]
  3451. nextafter: _UFunc_Nin2_Nout1[L['nextafter'], L[4], None]
  3452. not_equal: _UFunc_Nin2_Nout1[L['not_equal'], L[23], None]
  3453. positive: _UFunc_Nin1_Nout1[L['positive'], L[19], None]
  3454. power: _UFunc_Nin2_Nout1[L['power'], L[18], None]
  3455. rad2deg: _UFunc_Nin1_Nout1[L['rad2deg'], L[5], None]
  3456. radians: _UFunc_Nin1_Nout1[L['radians'], L[5], None]
  3457. reciprocal: _UFunc_Nin1_Nout1[L['reciprocal'], L[18], None]
  3458. remainder: _UFunc_Nin2_Nout1[L['remainder'], L[16], None]
  3459. right_shift: _UFunc_Nin2_Nout1[L['right_shift'], L[11], None]
  3460. rint: _UFunc_Nin1_Nout1[L['rint'], L[10], None]
  3461. sign: _UFunc_Nin1_Nout1[L['sign'], L[19], None]
  3462. signbit: _UFunc_Nin1_Nout1[L['signbit'], L[4], None]
  3463. sin: _UFunc_Nin1_Nout1[L['sin'], L[9], None]
  3464. sinh: _UFunc_Nin1_Nout1[L['sinh'], L[8], None]
  3465. spacing: _UFunc_Nin1_Nout1[L['spacing'], L[4], None]
  3466. sqrt: _UFunc_Nin1_Nout1[L['sqrt'], L[10], None]
  3467. square: _UFunc_Nin1_Nout1[L['square'], L[18], None]
  3468. subtract: _UFunc_Nin2_Nout1[L['subtract'], L[21], None]
  3469. tan: _UFunc_Nin1_Nout1[L['tan'], L[8], None]
  3470. tanh: _UFunc_Nin1_Nout1[L['tanh'], L[8], None]
  3471. true_divide: _UFunc_Nin2_Nout1[L['true_divide'], L[11], None]
  3472. trunc: _UFunc_Nin1_Nout1[L['trunc'], L[7], None]
  3473. abs = absolute
  3474. # Warnings
  3475. class ModuleDeprecationWarning(DeprecationWarning): ...
  3476. class VisibleDeprecationWarning(UserWarning): ...
  3477. class ComplexWarning(RuntimeWarning): ...
  3478. class RankWarning(UserWarning): ...
  3479. # Errors
  3480. class TooHardError(RuntimeError): ...
  3481. class AxisError(ValueError, IndexError):
  3482. def __init__(
  3483. self, axis: int, ndim: Optional[int] = ..., msg_prefix: Optional[str] = ...
  3484. ) -> None: ...
  3485. _CallType = TypeVar("_CallType", bound=Union[_ErrFunc, _SupportsWrite])
  3486. class errstate(Generic[_CallType], ContextDecorator):
  3487. call: _CallType
  3488. kwargs: _ErrDictOptional
  3489. # Expand `**kwargs` into explicit keyword-only arguments
  3490. def __init__(
  3491. self,
  3492. *,
  3493. call: _CallType = ...,
  3494. all: Optional[_ErrKind] = ...,
  3495. divide: Optional[_ErrKind] = ...,
  3496. over: Optional[_ErrKind] = ...,
  3497. under: Optional[_ErrKind] = ...,
  3498. invalid: Optional[_ErrKind] = ...,
  3499. ) -> None: ...
  3500. def __enter__(self) -> None: ...
  3501. def __exit__(
  3502. self,
  3503. __exc_type: Optional[Type[BaseException]],
  3504. __exc_value: Optional[BaseException],
  3505. __traceback: Optional[TracebackType],
  3506. ) -> None: ...
  3507. class ndenumerate(Generic[_ScalarType]):
  3508. iter: flatiter[NDArray[_ScalarType]]
  3509. @overload
  3510. def __new__(
  3511. cls, arr: _NestedSequence[_SupportsArray[dtype[_ScalarType]]],
  3512. ) -> ndenumerate[_ScalarType]: ...
  3513. @overload
  3514. def __new__(cls, arr: _NestedSequence[str]) -> ndenumerate[str_]: ...
  3515. @overload
  3516. def __new__(cls, arr: _NestedSequence[bytes]) -> ndenumerate[bytes_]: ...
  3517. @overload
  3518. def __new__(cls, arr: _NestedSequence[bool]) -> ndenumerate[bool_]: ...
  3519. @overload
  3520. def __new__(cls, arr: _NestedSequence[int]) -> ndenumerate[int_]: ...
  3521. @overload
  3522. def __new__(cls, arr: _NestedSequence[float]) -> ndenumerate[float_]: ...
  3523. @overload
  3524. def __new__(cls, arr: _NestedSequence[complex]) -> ndenumerate[complex_]: ...
  3525. @overload
  3526. def __new__(cls, arr: _RecursiveSequence) -> ndenumerate[Any]: ...
  3527. def __next__(self: ndenumerate[_ScalarType]) -> Tuple[_Shape, _ScalarType]: ...
  3528. def __iter__(self: _T) -> _T: ...
  3529. class ndindex:
  3530. def __init__(self, *shape: SupportsIndex) -> None: ...
  3531. def __iter__(self: _T) -> _T: ...
  3532. def __next__(self) -> _Shape: ...
  3533. class DataSource:
  3534. def __init__(
  3535. self,
  3536. destpath: Union[None, str, os.PathLike[str]] = ...,
  3537. ) -> None: ...
  3538. def __del__(self) -> None: ...
  3539. def abspath(self, path: str) -> str: ...
  3540. def exists(self, path: str) -> bool: ...
  3541. # Whether the file-object is opened in string or bytes mode (by default)
  3542. # depends on the file-extension of `path`
  3543. def open(
  3544. self,
  3545. path: str,
  3546. mode: str = ...,
  3547. encoding: Optional[str] = ...,
  3548. newline: Optional[str] = ...,
  3549. ) -> IO[Any]: ...
  3550. # TODO: The type of each `__next__` and `iters` return-type depends
  3551. # on the length and dtype of `args`; we can't describe this behavior yet
  3552. # as we lack variadics (PEP 646).
  3553. class broadcast:
  3554. def __new__(cls, *args: ArrayLike) -> broadcast: ...
  3555. @property
  3556. def index(self) -> int: ...
  3557. @property
  3558. def iters(self) -> Tuple[flatiter[Any], ...]: ...
  3559. @property
  3560. def nd(self) -> int: ...
  3561. @property
  3562. def ndim(self) -> int: ...
  3563. @property
  3564. def numiter(self) -> int: ...
  3565. @property
  3566. def shape(self) -> _Shape: ...
  3567. @property
  3568. def size(self) -> int: ...
  3569. def __next__(self) -> Tuple[Any, ...]: ...
  3570. def __iter__(self: _T) -> _T: ...
  3571. def reset(self) -> None: ...