fromnumeric.pyi 23 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060
  1. import datetime as dt
  2. from collections.abc import Sequence
  3. from typing import Union, Any, overload, TypeVar, Literal, SupportsIndex
  4. from numpy import (
  5. ndarray,
  6. number,
  7. uint64,
  8. int_,
  9. int64,
  10. intp,
  11. float16,
  12. bool_,
  13. floating,
  14. complexfloating,
  15. object_,
  16. generic,
  17. _OrderKACF,
  18. _OrderACF,
  19. _ModeKind,
  20. _PartitionKind,
  21. _SortKind,
  22. _SortSide,
  23. _CastingKind,
  24. )
  25. from numpy._typing import (
  26. DTypeLike,
  27. _DTypeLike,
  28. ArrayLike,
  29. _ArrayLike,
  30. NDArray,
  31. _ShapeLike,
  32. _Shape,
  33. _ArrayLikeBool_co,
  34. _ArrayLikeUInt_co,
  35. _ArrayLikeInt_co,
  36. _ArrayLikeFloat_co,
  37. _ArrayLikeComplex_co,
  38. _ArrayLikeObject_co,
  39. _IntLike_co,
  40. _BoolLike_co,
  41. _ComplexLike_co,
  42. _NumberLike_co,
  43. _ScalarLike_co,
  44. )
  45. _SCT = TypeVar("_SCT", bound=generic)
  46. _SCT_uifcO = TypeVar("_SCT_uifcO", bound=number[Any] | object_)
  47. _ArrayType = TypeVar("_ArrayType", bound=NDArray[Any])
  48. __all__: list[str]
  49. @overload
  50. def take(
  51. a: _ArrayLike[_SCT],
  52. indices: _IntLike_co,
  53. axis: None = ...,
  54. out: None = ...,
  55. mode: _ModeKind = ...,
  56. ) -> _SCT: ...
  57. @overload
  58. def take(
  59. a: ArrayLike,
  60. indices: _IntLike_co,
  61. axis: None | SupportsIndex = ...,
  62. out: None = ...,
  63. mode: _ModeKind = ...,
  64. ) -> Any: ...
  65. @overload
  66. def take(
  67. a: _ArrayLike[_SCT],
  68. indices: _ArrayLikeInt_co,
  69. axis: None | SupportsIndex = ...,
  70. out: None = ...,
  71. mode: _ModeKind = ...,
  72. ) -> NDArray[_SCT]: ...
  73. @overload
  74. def take(
  75. a: ArrayLike,
  76. indices: _ArrayLikeInt_co,
  77. axis: None | SupportsIndex = ...,
  78. out: None = ...,
  79. mode: _ModeKind = ...,
  80. ) -> NDArray[Any]: ...
  81. @overload
  82. def take(
  83. a: ArrayLike,
  84. indices: _ArrayLikeInt_co,
  85. axis: None | SupportsIndex = ...,
  86. out: _ArrayType = ...,
  87. mode: _ModeKind = ...,
  88. ) -> _ArrayType: ...
  89. @overload
  90. def reshape(
  91. a: _ArrayLike[_SCT],
  92. newshape: _ShapeLike,
  93. order: _OrderACF = ...,
  94. ) -> NDArray[_SCT]: ...
  95. @overload
  96. def reshape(
  97. a: ArrayLike,
  98. newshape: _ShapeLike,
  99. order: _OrderACF = ...,
  100. ) -> NDArray[Any]: ...
  101. @overload
  102. def choose(
  103. a: _IntLike_co,
  104. choices: ArrayLike,
  105. out: None = ...,
  106. mode: _ModeKind = ...,
  107. ) -> Any: ...
  108. @overload
  109. def choose(
  110. a: _ArrayLikeInt_co,
  111. choices: _ArrayLike[_SCT],
  112. out: None = ...,
  113. mode: _ModeKind = ...,
  114. ) -> NDArray[_SCT]: ...
  115. @overload
  116. def choose(
  117. a: _ArrayLikeInt_co,
  118. choices: ArrayLike,
  119. out: None = ...,
  120. mode: _ModeKind = ...,
  121. ) -> NDArray[Any]: ...
  122. @overload
  123. def choose(
  124. a: _ArrayLikeInt_co,
  125. choices: ArrayLike,
  126. out: _ArrayType = ...,
  127. mode: _ModeKind = ...,
  128. ) -> _ArrayType: ...
  129. @overload
  130. def repeat(
  131. a: _ArrayLike[_SCT],
  132. repeats: _ArrayLikeInt_co,
  133. axis: None | SupportsIndex = ...,
  134. ) -> NDArray[_SCT]: ...
  135. @overload
  136. def repeat(
  137. a: ArrayLike,
  138. repeats: _ArrayLikeInt_co,
  139. axis: None | SupportsIndex = ...,
  140. ) -> NDArray[Any]: ...
  141. def put(
  142. a: NDArray[Any],
  143. ind: _ArrayLikeInt_co,
  144. v: ArrayLike,
  145. mode: _ModeKind = ...,
  146. ) -> None: ...
  147. @overload
  148. def swapaxes(
  149. a: _ArrayLike[_SCT],
  150. axis1: SupportsIndex,
  151. axis2: SupportsIndex,
  152. ) -> NDArray[_SCT]: ...
  153. @overload
  154. def swapaxes(
  155. a: ArrayLike,
  156. axis1: SupportsIndex,
  157. axis2: SupportsIndex,
  158. ) -> NDArray[Any]: ...
  159. @overload
  160. def transpose(
  161. a: _ArrayLike[_SCT],
  162. axes: None | _ShapeLike = ...
  163. ) -> NDArray[_SCT]: ...
  164. @overload
  165. def transpose(
  166. a: ArrayLike,
  167. axes: None | _ShapeLike = ...
  168. ) -> NDArray[Any]: ...
  169. @overload
  170. def partition(
  171. a: _ArrayLike[_SCT],
  172. kth: _ArrayLikeInt_co,
  173. axis: None | SupportsIndex = ...,
  174. kind: _PartitionKind = ...,
  175. order: None | str | Sequence[str] = ...,
  176. ) -> NDArray[_SCT]: ...
  177. @overload
  178. def partition(
  179. a: ArrayLike,
  180. kth: _ArrayLikeInt_co,
  181. axis: None | SupportsIndex = ...,
  182. kind: _PartitionKind = ...,
  183. order: None | str | Sequence[str] = ...,
  184. ) -> NDArray[Any]: ...
  185. def argpartition(
  186. a: ArrayLike,
  187. kth: _ArrayLikeInt_co,
  188. axis: None | SupportsIndex = ...,
  189. kind: _PartitionKind = ...,
  190. order: None | str | Sequence[str] = ...,
  191. ) -> NDArray[intp]: ...
  192. @overload
  193. def sort(
  194. a: _ArrayLike[_SCT],
  195. axis: None | SupportsIndex = ...,
  196. kind: None | _SortKind = ...,
  197. order: None | str | Sequence[str] = ...,
  198. ) -> NDArray[_SCT]: ...
  199. @overload
  200. def sort(
  201. a: ArrayLike,
  202. axis: None | SupportsIndex = ...,
  203. kind: None | _SortKind = ...,
  204. order: None | str | Sequence[str] = ...,
  205. ) -> NDArray[Any]: ...
  206. def argsort(
  207. a: ArrayLike,
  208. axis: None | SupportsIndex = ...,
  209. kind: None | _SortKind = ...,
  210. order: None | str | Sequence[str] = ...,
  211. ) -> NDArray[intp]: ...
  212. @overload
  213. def argmax(
  214. a: ArrayLike,
  215. axis: None = ...,
  216. out: None = ...,
  217. *,
  218. keepdims: Literal[False] = ...,
  219. ) -> intp: ...
  220. @overload
  221. def argmax(
  222. a: ArrayLike,
  223. axis: None | SupportsIndex = ...,
  224. out: None = ...,
  225. *,
  226. keepdims: bool = ...,
  227. ) -> Any: ...
  228. @overload
  229. def argmax(
  230. a: ArrayLike,
  231. axis: None | SupportsIndex = ...,
  232. out: _ArrayType = ...,
  233. *,
  234. keepdims: bool = ...,
  235. ) -> _ArrayType: ...
  236. @overload
  237. def argmin(
  238. a: ArrayLike,
  239. axis: None = ...,
  240. out: None = ...,
  241. *,
  242. keepdims: Literal[False] = ...,
  243. ) -> intp: ...
  244. @overload
  245. def argmin(
  246. a: ArrayLike,
  247. axis: None | SupportsIndex = ...,
  248. out: None = ...,
  249. *,
  250. keepdims: bool = ...,
  251. ) -> Any: ...
  252. @overload
  253. def argmin(
  254. a: ArrayLike,
  255. axis: None | SupportsIndex = ...,
  256. out: _ArrayType = ...,
  257. *,
  258. keepdims: bool = ...,
  259. ) -> _ArrayType: ...
  260. @overload
  261. def searchsorted(
  262. a: ArrayLike,
  263. v: _ScalarLike_co,
  264. side: _SortSide = ...,
  265. sorter: None | _ArrayLikeInt_co = ..., # 1D int array
  266. ) -> intp: ...
  267. @overload
  268. def searchsorted(
  269. a: ArrayLike,
  270. v: ArrayLike,
  271. side: _SortSide = ...,
  272. sorter: None | _ArrayLikeInt_co = ..., # 1D int array
  273. ) -> NDArray[intp]: ...
  274. @overload
  275. def resize(
  276. a: _ArrayLike[_SCT],
  277. new_shape: _ShapeLike,
  278. ) -> NDArray[_SCT]: ...
  279. @overload
  280. def resize(
  281. a: ArrayLike,
  282. new_shape: _ShapeLike,
  283. ) -> NDArray[Any]: ...
  284. @overload
  285. def squeeze(
  286. a: _SCT,
  287. axis: None | _ShapeLike = ...,
  288. ) -> _SCT: ...
  289. @overload
  290. def squeeze(
  291. a: _ArrayLike[_SCT],
  292. axis: None | _ShapeLike = ...,
  293. ) -> NDArray[_SCT]: ...
  294. @overload
  295. def squeeze(
  296. a: ArrayLike,
  297. axis: None | _ShapeLike = ...,
  298. ) -> NDArray[Any]: ...
  299. @overload
  300. def diagonal(
  301. a: _ArrayLike[_SCT],
  302. offset: SupportsIndex = ...,
  303. axis1: SupportsIndex = ...,
  304. axis2: SupportsIndex = ..., # >= 2D array
  305. ) -> NDArray[_SCT]: ...
  306. @overload
  307. def diagonal(
  308. a: ArrayLike,
  309. offset: SupportsIndex = ...,
  310. axis1: SupportsIndex = ...,
  311. axis2: SupportsIndex = ..., # >= 2D array
  312. ) -> NDArray[Any]: ...
  313. @overload
  314. def trace(
  315. a: ArrayLike, # >= 2D array
  316. offset: SupportsIndex = ...,
  317. axis1: SupportsIndex = ...,
  318. axis2: SupportsIndex = ...,
  319. dtype: DTypeLike = ...,
  320. out: None = ...,
  321. ) -> Any: ...
  322. @overload
  323. def trace(
  324. a: ArrayLike, # >= 2D array
  325. offset: SupportsIndex = ...,
  326. axis1: SupportsIndex = ...,
  327. axis2: SupportsIndex = ...,
  328. dtype: DTypeLike = ...,
  329. out: _ArrayType = ...,
  330. ) -> _ArrayType: ...
  331. @overload
  332. def ravel(a: _ArrayLike[_SCT], order: _OrderKACF = ...) -> NDArray[_SCT]: ...
  333. @overload
  334. def ravel(a: ArrayLike, order: _OrderKACF = ...) -> NDArray[Any]: ...
  335. def nonzero(a: ArrayLike) -> tuple[NDArray[intp], ...]: ...
  336. def shape(a: ArrayLike) -> _Shape: ...
  337. @overload
  338. def compress(
  339. condition: _ArrayLikeBool_co, # 1D bool array
  340. a: _ArrayLike[_SCT],
  341. axis: None | SupportsIndex = ...,
  342. out: None = ...,
  343. ) -> NDArray[_SCT]: ...
  344. @overload
  345. def compress(
  346. condition: _ArrayLikeBool_co, # 1D bool array
  347. a: ArrayLike,
  348. axis: None | SupportsIndex = ...,
  349. out: None = ...,
  350. ) -> NDArray[Any]: ...
  351. @overload
  352. def compress(
  353. condition: _ArrayLikeBool_co, # 1D bool array
  354. a: ArrayLike,
  355. axis: None | SupportsIndex = ...,
  356. out: _ArrayType = ...,
  357. ) -> _ArrayType: ...
  358. @overload
  359. def clip(
  360. a: _SCT,
  361. a_min: None | ArrayLike,
  362. a_max: None | ArrayLike,
  363. out: None = ...,
  364. *,
  365. dtype: None = ...,
  366. where: None | _ArrayLikeBool_co = ...,
  367. order: _OrderKACF = ...,
  368. subok: bool = ...,
  369. signature: str | tuple[None | str, ...] = ...,
  370. extobj: list[Any] = ...,
  371. casting: _CastingKind = ...,
  372. ) -> _SCT: ...
  373. @overload
  374. def clip(
  375. a: _ScalarLike_co,
  376. a_min: None | ArrayLike,
  377. a_max: None | ArrayLike,
  378. out: None = ...,
  379. *,
  380. dtype: None = ...,
  381. where: None | _ArrayLikeBool_co = ...,
  382. order: _OrderKACF = ...,
  383. subok: bool = ...,
  384. signature: str | tuple[None | str, ...] = ...,
  385. extobj: list[Any] = ...,
  386. casting: _CastingKind = ...,
  387. ) -> Any: ...
  388. @overload
  389. def clip(
  390. a: _ArrayLike[_SCT],
  391. a_min: None | ArrayLike,
  392. a_max: None | ArrayLike,
  393. out: None = ...,
  394. *,
  395. dtype: None = ...,
  396. where: None | _ArrayLikeBool_co = ...,
  397. order: _OrderKACF = ...,
  398. subok: bool = ...,
  399. signature: str | tuple[None | str, ...] = ...,
  400. extobj: list[Any] = ...,
  401. casting: _CastingKind = ...,
  402. ) -> NDArray[_SCT]: ...
  403. @overload
  404. def clip(
  405. a: ArrayLike,
  406. a_min: None | ArrayLike,
  407. a_max: None | ArrayLike,
  408. out: None = ...,
  409. *,
  410. dtype: None = ...,
  411. where: None | _ArrayLikeBool_co = ...,
  412. order: _OrderKACF = ...,
  413. subok: bool = ...,
  414. signature: str | tuple[None | str, ...] = ...,
  415. extobj: list[Any] = ...,
  416. casting: _CastingKind = ...,
  417. ) -> NDArray[Any]: ...
  418. @overload
  419. def clip(
  420. a: ArrayLike,
  421. a_min: None | ArrayLike,
  422. a_max: None | ArrayLike,
  423. out: _ArrayType = ...,
  424. *,
  425. dtype: DTypeLike,
  426. where: None | _ArrayLikeBool_co = ...,
  427. order: _OrderKACF = ...,
  428. subok: bool = ...,
  429. signature: str | tuple[None | str, ...] = ...,
  430. extobj: list[Any] = ...,
  431. casting: _CastingKind = ...,
  432. ) -> Any: ...
  433. @overload
  434. def clip(
  435. a: ArrayLike,
  436. a_min: None | ArrayLike,
  437. a_max: None | ArrayLike,
  438. out: _ArrayType,
  439. *,
  440. dtype: DTypeLike = ...,
  441. where: None | _ArrayLikeBool_co = ...,
  442. order: _OrderKACF = ...,
  443. subok: bool = ...,
  444. signature: str | tuple[None | str, ...] = ...,
  445. extobj: list[Any] = ...,
  446. casting: _CastingKind = ...,
  447. ) -> _ArrayType: ...
  448. @overload
  449. def sum(
  450. a: _ArrayLike[_SCT],
  451. axis: None = ...,
  452. dtype: None = ...,
  453. out: None = ...,
  454. keepdims: bool = ...,
  455. initial: _NumberLike_co = ...,
  456. where: _ArrayLikeBool_co = ...,
  457. ) -> _SCT: ...
  458. @overload
  459. def sum(
  460. a: ArrayLike,
  461. axis: None | _ShapeLike = ...,
  462. dtype: DTypeLike = ...,
  463. out: None = ...,
  464. keepdims: bool = ...,
  465. initial: _NumberLike_co = ...,
  466. where: _ArrayLikeBool_co = ...,
  467. ) -> Any: ...
  468. @overload
  469. def sum(
  470. a: ArrayLike,
  471. axis: None | _ShapeLike = ...,
  472. dtype: DTypeLike = ...,
  473. out: _ArrayType = ...,
  474. keepdims: bool = ...,
  475. initial: _NumberLike_co = ...,
  476. where: _ArrayLikeBool_co = ...,
  477. ) -> _ArrayType: ...
  478. @overload
  479. def all(
  480. a: ArrayLike,
  481. axis: None = ...,
  482. out: None = ...,
  483. keepdims: Literal[False] = ...,
  484. *,
  485. where: _ArrayLikeBool_co = ...,
  486. ) -> bool_: ...
  487. @overload
  488. def all(
  489. a: ArrayLike,
  490. axis: None | _ShapeLike = ...,
  491. out: None = ...,
  492. keepdims: bool = ...,
  493. *,
  494. where: _ArrayLikeBool_co = ...,
  495. ) -> Any: ...
  496. @overload
  497. def all(
  498. a: ArrayLike,
  499. axis: None | _ShapeLike = ...,
  500. out: _ArrayType = ...,
  501. keepdims: bool = ...,
  502. *,
  503. where: _ArrayLikeBool_co = ...,
  504. ) -> _ArrayType: ...
  505. @overload
  506. def any(
  507. a: ArrayLike,
  508. axis: None = ...,
  509. out: None = ...,
  510. keepdims: Literal[False] = ...,
  511. *,
  512. where: _ArrayLikeBool_co = ...,
  513. ) -> bool_: ...
  514. @overload
  515. def any(
  516. a: ArrayLike,
  517. axis: None | _ShapeLike = ...,
  518. out: None = ...,
  519. keepdims: bool = ...,
  520. *,
  521. where: _ArrayLikeBool_co = ...,
  522. ) -> Any: ...
  523. @overload
  524. def any(
  525. a: ArrayLike,
  526. axis: None | _ShapeLike = ...,
  527. out: _ArrayType = ...,
  528. keepdims: bool = ...,
  529. *,
  530. where: _ArrayLikeBool_co = ...,
  531. ) -> _ArrayType: ...
  532. @overload
  533. def cumsum(
  534. a: _ArrayLike[_SCT],
  535. axis: None | SupportsIndex = ...,
  536. dtype: None = ...,
  537. out: None = ...,
  538. ) -> NDArray[_SCT]: ...
  539. @overload
  540. def cumsum(
  541. a: ArrayLike,
  542. axis: None | SupportsIndex = ...,
  543. dtype: None = ...,
  544. out: None = ...,
  545. ) -> NDArray[Any]: ...
  546. @overload
  547. def cumsum(
  548. a: ArrayLike,
  549. axis: None | SupportsIndex = ...,
  550. dtype: _DTypeLike[_SCT] = ...,
  551. out: None = ...,
  552. ) -> NDArray[_SCT]: ...
  553. @overload
  554. def cumsum(
  555. a: ArrayLike,
  556. axis: None | SupportsIndex = ...,
  557. dtype: DTypeLike = ...,
  558. out: None = ...,
  559. ) -> NDArray[Any]: ...
  560. @overload
  561. def cumsum(
  562. a: ArrayLike,
  563. axis: None | SupportsIndex = ...,
  564. dtype: DTypeLike = ...,
  565. out: _ArrayType = ...,
  566. ) -> _ArrayType: ...
  567. @overload
  568. def ptp(
  569. a: _ArrayLike[_SCT],
  570. axis: None = ...,
  571. out: None = ...,
  572. keepdims: Literal[False] = ...,
  573. ) -> _SCT: ...
  574. @overload
  575. def ptp(
  576. a: ArrayLike,
  577. axis: None | _ShapeLike = ...,
  578. out: None = ...,
  579. keepdims: bool = ...,
  580. ) -> Any: ...
  581. @overload
  582. def ptp(
  583. a: ArrayLike,
  584. axis: None | _ShapeLike = ...,
  585. out: _ArrayType = ...,
  586. keepdims: bool = ...,
  587. ) -> _ArrayType: ...
  588. @overload
  589. def amax(
  590. a: _ArrayLike[_SCT],
  591. axis: None = ...,
  592. out: None = ...,
  593. keepdims: Literal[False] = ...,
  594. initial: _NumberLike_co = ...,
  595. where: _ArrayLikeBool_co = ...,
  596. ) -> _SCT: ...
  597. @overload
  598. def amax(
  599. a: ArrayLike,
  600. axis: None | _ShapeLike = ...,
  601. out: None = ...,
  602. keepdims: bool = ...,
  603. initial: _NumberLike_co = ...,
  604. where: _ArrayLikeBool_co = ...,
  605. ) -> Any: ...
  606. @overload
  607. def amax(
  608. a: ArrayLike,
  609. axis: None | _ShapeLike = ...,
  610. out: _ArrayType = ...,
  611. keepdims: bool = ...,
  612. initial: _NumberLike_co = ...,
  613. where: _ArrayLikeBool_co = ...,
  614. ) -> _ArrayType: ...
  615. @overload
  616. def amin(
  617. a: _ArrayLike[_SCT],
  618. axis: None = ...,
  619. out: None = ...,
  620. keepdims: Literal[False] = ...,
  621. initial: _NumberLike_co = ...,
  622. where: _ArrayLikeBool_co = ...,
  623. ) -> _SCT: ...
  624. @overload
  625. def amin(
  626. a: ArrayLike,
  627. axis: None | _ShapeLike = ...,
  628. out: None = ...,
  629. keepdims: bool = ...,
  630. initial: _NumberLike_co = ...,
  631. where: _ArrayLikeBool_co = ...,
  632. ) -> Any: ...
  633. @overload
  634. def amin(
  635. a: ArrayLike,
  636. axis: None | _ShapeLike = ...,
  637. out: _ArrayType = ...,
  638. keepdims: bool = ...,
  639. initial: _NumberLike_co = ...,
  640. where: _ArrayLikeBool_co = ...,
  641. ) -> _ArrayType: ...
  642. # TODO: `np.prod()``: For object arrays `initial` does not necessarily
  643. # have to be a numerical scalar.
  644. # The only requirement is that it is compatible
  645. # with the `.__mul__()` method(s) of the passed array's elements.
  646. # Note that the same situation holds for all wrappers around
  647. # `np.ufunc.reduce`, e.g. `np.sum()` (`.__add__()`).
  648. @overload
  649. def prod(
  650. a: _ArrayLikeBool_co,
  651. axis: None = ...,
  652. dtype: None = ...,
  653. out: None = ...,
  654. keepdims: Literal[False] = ...,
  655. initial: _NumberLike_co = ...,
  656. where: _ArrayLikeBool_co = ...,
  657. ) -> int_: ...
  658. @overload
  659. def prod(
  660. a: _ArrayLikeUInt_co,
  661. axis: None = ...,
  662. dtype: None = ...,
  663. out: None = ...,
  664. keepdims: Literal[False] = ...,
  665. initial: _NumberLike_co = ...,
  666. where: _ArrayLikeBool_co = ...,
  667. ) -> uint64: ...
  668. @overload
  669. def prod(
  670. a: _ArrayLikeInt_co,
  671. axis: None = ...,
  672. dtype: None = ...,
  673. out: None = ...,
  674. keepdims: Literal[False] = ...,
  675. initial: _NumberLike_co = ...,
  676. where: _ArrayLikeBool_co = ...,
  677. ) -> int64: ...
  678. @overload
  679. def prod(
  680. a: _ArrayLikeFloat_co,
  681. axis: None = ...,
  682. dtype: None = ...,
  683. out: None = ...,
  684. keepdims: Literal[False] = ...,
  685. initial: _NumberLike_co = ...,
  686. where: _ArrayLikeBool_co = ...,
  687. ) -> floating[Any]: ...
  688. @overload
  689. def prod(
  690. a: _ArrayLikeComplex_co,
  691. axis: None = ...,
  692. dtype: None = ...,
  693. out: None = ...,
  694. keepdims: Literal[False] = ...,
  695. initial: _NumberLike_co = ...,
  696. where: _ArrayLikeBool_co = ...,
  697. ) -> complexfloating[Any, Any]: ...
  698. @overload
  699. def prod(
  700. a: _ArrayLikeComplex_co | _ArrayLikeObject_co,
  701. axis: None | _ShapeLike = ...,
  702. dtype: None = ...,
  703. out: None = ...,
  704. keepdims: bool = ...,
  705. initial: _NumberLike_co = ...,
  706. where: _ArrayLikeBool_co = ...,
  707. ) -> Any: ...
  708. @overload
  709. def prod(
  710. a: _ArrayLikeComplex_co | _ArrayLikeObject_co,
  711. axis: None = ...,
  712. dtype: _DTypeLike[_SCT] = ...,
  713. out: None = ...,
  714. keepdims: Literal[False] = ...,
  715. initial: _NumberLike_co = ...,
  716. where: _ArrayLikeBool_co = ...,
  717. ) -> _SCT: ...
  718. @overload
  719. def prod(
  720. a: _ArrayLikeComplex_co | _ArrayLikeObject_co,
  721. axis: None | _ShapeLike = ...,
  722. dtype: None | DTypeLike = ...,
  723. out: None = ...,
  724. keepdims: bool = ...,
  725. initial: _NumberLike_co = ...,
  726. where: _ArrayLikeBool_co = ...,
  727. ) -> Any: ...
  728. @overload
  729. def prod(
  730. a: _ArrayLikeComplex_co | _ArrayLikeObject_co,
  731. axis: None | _ShapeLike = ...,
  732. dtype: None | DTypeLike = ...,
  733. out: _ArrayType = ...,
  734. keepdims: bool = ...,
  735. initial: _NumberLike_co = ...,
  736. where: _ArrayLikeBool_co = ...,
  737. ) -> _ArrayType: ...
  738. @overload
  739. def cumprod(
  740. a: _ArrayLikeBool_co,
  741. axis: None | SupportsIndex = ...,
  742. dtype: None = ...,
  743. out: None = ...,
  744. ) -> NDArray[int_]: ...
  745. @overload
  746. def cumprod(
  747. a: _ArrayLikeUInt_co,
  748. axis: None | SupportsIndex = ...,
  749. dtype: None = ...,
  750. out: None = ...,
  751. ) -> NDArray[uint64]: ...
  752. @overload
  753. def cumprod(
  754. a: _ArrayLikeInt_co,
  755. axis: None | SupportsIndex = ...,
  756. dtype: None = ...,
  757. out: None = ...,
  758. ) -> NDArray[int64]: ...
  759. @overload
  760. def cumprod(
  761. a: _ArrayLikeFloat_co,
  762. axis: None | SupportsIndex = ...,
  763. dtype: None = ...,
  764. out: None = ...,
  765. ) -> NDArray[floating[Any]]: ...
  766. @overload
  767. def cumprod(
  768. a: _ArrayLikeComplex_co,
  769. axis: None | SupportsIndex = ...,
  770. dtype: None = ...,
  771. out: None = ...,
  772. ) -> NDArray[complexfloating[Any, Any]]: ...
  773. @overload
  774. def cumprod(
  775. a: _ArrayLikeObject_co,
  776. axis: None | SupportsIndex = ...,
  777. dtype: None = ...,
  778. out: None = ...,
  779. ) -> NDArray[object_]: ...
  780. @overload
  781. def cumprod(
  782. a: _ArrayLikeComplex_co | _ArrayLikeObject_co,
  783. axis: None | SupportsIndex = ...,
  784. dtype: _DTypeLike[_SCT] = ...,
  785. out: None = ...,
  786. ) -> NDArray[_SCT]: ...
  787. @overload
  788. def cumprod(
  789. a: _ArrayLikeComplex_co | _ArrayLikeObject_co,
  790. axis: None | SupportsIndex = ...,
  791. dtype: DTypeLike = ...,
  792. out: None = ...,
  793. ) -> NDArray[Any]: ...
  794. @overload
  795. def cumprod(
  796. a: _ArrayLikeComplex_co | _ArrayLikeObject_co,
  797. axis: None | SupportsIndex = ...,
  798. dtype: DTypeLike = ...,
  799. out: _ArrayType = ...,
  800. ) -> _ArrayType: ...
  801. def ndim(a: ArrayLike) -> int: ...
  802. def size(a: ArrayLike, axis: None | int = ...) -> int: ...
  803. @overload
  804. def around(
  805. a: _BoolLike_co,
  806. decimals: SupportsIndex = ...,
  807. out: None = ...,
  808. ) -> float16: ...
  809. @overload
  810. def around(
  811. a: _SCT_uifcO,
  812. decimals: SupportsIndex = ...,
  813. out: None = ...,
  814. ) -> _SCT_uifcO: ...
  815. @overload
  816. def around(
  817. a: _ComplexLike_co | object_,
  818. decimals: SupportsIndex = ...,
  819. out: None = ...,
  820. ) -> Any: ...
  821. @overload
  822. def around(
  823. a: _ArrayLikeBool_co,
  824. decimals: SupportsIndex = ...,
  825. out: None = ...,
  826. ) -> NDArray[float16]: ...
  827. @overload
  828. def around(
  829. a: _ArrayLike[_SCT_uifcO],
  830. decimals: SupportsIndex = ...,
  831. out: None = ...,
  832. ) -> NDArray[_SCT_uifcO]: ...
  833. @overload
  834. def around(
  835. a: _ArrayLikeComplex_co | _ArrayLikeObject_co,
  836. decimals: SupportsIndex = ...,
  837. out: None = ...,
  838. ) -> NDArray[Any]: ...
  839. @overload
  840. def around(
  841. a: _ArrayLikeComplex_co | _ArrayLikeObject_co,
  842. decimals: SupportsIndex = ...,
  843. out: _ArrayType = ...,
  844. ) -> _ArrayType: ...
  845. @overload
  846. def mean(
  847. a: _ArrayLikeFloat_co,
  848. axis: None = ...,
  849. dtype: None = ...,
  850. out: None = ...,
  851. keepdims: Literal[False] = ...,
  852. *,
  853. where: _ArrayLikeBool_co = ...,
  854. ) -> floating[Any]: ...
  855. @overload
  856. def mean(
  857. a: _ArrayLikeComplex_co,
  858. axis: None = ...,
  859. dtype: None = ...,
  860. out: None = ...,
  861. keepdims: Literal[False] = ...,
  862. *,
  863. where: _ArrayLikeBool_co = ...,
  864. ) -> complexfloating[Any, Any]: ...
  865. @overload
  866. def mean(
  867. a: _ArrayLikeComplex_co | _ArrayLikeObject_co,
  868. axis: None | _ShapeLike = ...,
  869. dtype: None = ...,
  870. out: None = ...,
  871. keepdims: bool = ...,
  872. *,
  873. where: _ArrayLikeBool_co = ...,
  874. ) -> Any: ...
  875. @overload
  876. def mean(
  877. a: _ArrayLikeComplex_co | _ArrayLikeObject_co,
  878. axis: None = ...,
  879. dtype: _DTypeLike[_SCT] = ...,
  880. out: None = ...,
  881. keepdims: Literal[False] = ...,
  882. *,
  883. where: _ArrayLikeBool_co = ...,
  884. ) -> _SCT: ...
  885. @overload
  886. def mean(
  887. a: _ArrayLikeComplex_co | _ArrayLikeObject_co,
  888. axis: None | _ShapeLike = ...,
  889. dtype: DTypeLike = ...,
  890. out: None = ...,
  891. keepdims: bool = ...,
  892. *,
  893. where: _ArrayLikeBool_co = ...,
  894. ) -> Any: ...
  895. @overload
  896. def mean(
  897. a: _ArrayLikeComplex_co | _ArrayLikeObject_co,
  898. axis: None | _ShapeLike = ...,
  899. dtype: DTypeLike = ...,
  900. out: _ArrayType = ...,
  901. keepdims: bool = ...,
  902. *,
  903. where: _ArrayLikeBool_co = ...,
  904. ) -> _ArrayType: ...
  905. @overload
  906. def std(
  907. a: _ArrayLikeComplex_co,
  908. axis: None = ...,
  909. dtype: None = ...,
  910. out: None = ...,
  911. ddof: float = ...,
  912. keepdims: Literal[False] = ...,
  913. *,
  914. where: _ArrayLikeBool_co = ...,
  915. ) -> floating[Any]: ...
  916. @overload
  917. def std(
  918. a: _ArrayLikeComplex_co | _ArrayLikeObject_co,
  919. axis: None | _ShapeLike = ...,
  920. dtype: None = ...,
  921. out: None = ...,
  922. ddof: float = ...,
  923. keepdims: bool = ...,
  924. *,
  925. where: _ArrayLikeBool_co = ...,
  926. ) -> Any: ...
  927. @overload
  928. def std(
  929. a: _ArrayLikeComplex_co | _ArrayLikeObject_co,
  930. axis: None = ...,
  931. dtype: _DTypeLike[_SCT] = ...,
  932. out: None = ...,
  933. ddof: float = ...,
  934. keepdims: Literal[False] = ...,
  935. *,
  936. where: _ArrayLikeBool_co = ...,
  937. ) -> _SCT: ...
  938. @overload
  939. def std(
  940. a: _ArrayLikeComplex_co | _ArrayLikeObject_co,
  941. axis: None | _ShapeLike = ...,
  942. dtype: DTypeLike = ...,
  943. out: None = ...,
  944. ddof: float = ...,
  945. keepdims: bool = ...,
  946. *,
  947. where: _ArrayLikeBool_co = ...,
  948. ) -> Any: ...
  949. @overload
  950. def std(
  951. a: _ArrayLikeComplex_co | _ArrayLikeObject_co,
  952. axis: None | _ShapeLike = ...,
  953. dtype: DTypeLike = ...,
  954. out: _ArrayType = ...,
  955. ddof: float = ...,
  956. keepdims: bool = ...,
  957. *,
  958. where: _ArrayLikeBool_co = ...,
  959. ) -> _ArrayType: ...
  960. @overload
  961. def var(
  962. a: _ArrayLikeComplex_co,
  963. axis: None = ...,
  964. dtype: None = ...,
  965. out: None = ...,
  966. ddof: float = ...,
  967. keepdims: Literal[False] = ...,
  968. *,
  969. where: _ArrayLikeBool_co = ...,
  970. ) -> floating[Any]: ...
  971. @overload
  972. def var(
  973. a: _ArrayLikeComplex_co | _ArrayLikeObject_co,
  974. axis: None | _ShapeLike = ...,
  975. dtype: None = ...,
  976. out: None = ...,
  977. ddof: float = ...,
  978. keepdims: bool = ...,
  979. *,
  980. where: _ArrayLikeBool_co = ...,
  981. ) -> Any: ...
  982. @overload
  983. def var(
  984. a: _ArrayLikeComplex_co | _ArrayLikeObject_co,
  985. axis: None = ...,
  986. dtype: _DTypeLike[_SCT] = ...,
  987. out: None = ...,
  988. ddof: float = ...,
  989. keepdims: Literal[False] = ...,
  990. *,
  991. where: _ArrayLikeBool_co = ...,
  992. ) -> _SCT: ...
  993. @overload
  994. def var(
  995. a: _ArrayLikeComplex_co | _ArrayLikeObject_co,
  996. axis: None | _ShapeLike = ...,
  997. dtype: DTypeLike = ...,
  998. out: None = ...,
  999. ddof: float = ...,
  1000. keepdims: bool = ...,
  1001. *,
  1002. where: _ArrayLikeBool_co = ...,
  1003. ) -> Any: ...
  1004. @overload
  1005. def var(
  1006. a: _ArrayLikeComplex_co | _ArrayLikeObject_co,
  1007. axis: None | _ShapeLike = ...,
  1008. dtype: DTypeLike = ...,
  1009. out: _ArrayType = ...,
  1010. ddof: float = ...,
  1011. keepdims: bool = ...,
  1012. *,
  1013. where: _ArrayLikeBool_co = ...,
  1014. ) -> _ArrayType: ...
  1015. max = amax
  1016. min = amin
  1017. round = around