fromnumeric.pyi 23 KB

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