fromnumeric.pyi 40 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733
  1. # ruff: noqa: ANN401
  2. from collections.abc import Sequence
  3. from typing import (
  4. Any,
  5. Literal,
  6. Protocol,
  7. SupportsIndex,
  8. TypeAlias,
  9. TypeVar,
  10. overload,
  11. type_check_only,
  12. )
  13. from _typeshed import Incomplete
  14. from typing_extensions import Never, deprecated
  15. import numpy as np
  16. from numpy import (
  17. number,
  18. uint64,
  19. int_,
  20. int64,
  21. intp,
  22. float16,
  23. floating,
  24. complexfloating,
  25. timedelta64,
  26. object_,
  27. generic,
  28. _AnyShapeType,
  29. _OrderKACF,
  30. _OrderACF,
  31. _ModeKind,
  32. _PartitionKind,
  33. _SortKind,
  34. _SortSide,
  35. _CastingKind,
  36. )
  37. from numpy._globals import _NoValueType
  38. from numpy._typing import (
  39. DTypeLike,
  40. _DTypeLike,
  41. ArrayLike,
  42. _ArrayLike,
  43. NDArray,
  44. _NestedSequence,
  45. _ShapeLike,
  46. _ArrayLikeBool_co,
  47. _ArrayLikeUInt_co,
  48. _ArrayLikeInt,
  49. _ArrayLikeInt_co,
  50. _ArrayLikeFloat_co,
  51. _ArrayLikeComplex_co,
  52. _ArrayLikeObject_co,
  53. _IntLike_co,
  54. _BoolLike_co,
  55. _ComplexLike_co,
  56. _NumberLike_co,
  57. _ScalarLike_co,
  58. )
  59. __all__ = [
  60. "all",
  61. "amax",
  62. "amin",
  63. "any",
  64. "argmax",
  65. "argmin",
  66. "argpartition",
  67. "argsort",
  68. "around",
  69. "choose",
  70. "clip",
  71. "compress",
  72. "cumprod",
  73. "cumsum",
  74. "cumulative_prod",
  75. "cumulative_sum",
  76. "diagonal",
  77. "mean",
  78. "max",
  79. "min",
  80. "matrix_transpose",
  81. "ndim",
  82. "nonzero",
  83. "partition",
  84. "prod",
  85. "ptp",
  86. "put",
  87. "ravel",
  88. "repeat",
  89. "reshape",
  90. "resize",
  91. "round",
  92. "searchsorted",
  93. "shape",
  94. "size",
  95. "sort",
  96. "squeeze",
  97. "std",
  98. "sum",
  99. "swapaxes",
  100. "take",
  101. "trace",
  102. "transpose",
  103. "var",
  104. ]
  105. _SCT = TypeVar("_SCT", bound=generic)
  106. _SCT_uifcO = TypeVar("_SCT_uifcO", bound=number[Any] | object_)
  107. _ArrayT = TypeVar("_ArrayT", bound=np.ndarray[Any, Any])
  108. _ShapeType = TypeVar("_ShapeType", bound=tuple[int, ...])
  109. _ShapeType_co = TypeVar("_ShapeType_co", bound=tuple[int, ...], covariant=True)
  110. @type_check_only
  111. class _SupportsShape(Protocol[_ShapeType_co]):
  112. # NOTE: it matters that `self` is positional only
  113. @property
  114. def shape(self, /) -> _ShapeType_co: ...
  115. # a "sequence" that isn't a string, bytes, bytearray, or memoryview
  116. _T = TypeVar("_T")
  117. _PyArray: TypeAlias = list[_T] | tuple[_T, ...]
  118. # `int` also covers `bool`
  119. _PyScalar: TypeAlias = float | complex | bytes | str
  120. @overload
  121. def take(
  122. a: _ArrayLike[_SCT],
  123. indices: _IntLike_co,
  124. axis: None = ...,
  125. out: None = ...,
  126. mode: _ModeKind = ...,
  127. ) -> _SCT: ...
  128. @overload
  129. def take(
  130. a: ArrayLike,
  131. indices: _IntLike_co,
  132. axis: SupportsIndex | None = ...,
  133. out: None = ...,
  134. mode: _ModeKind = ...,
  135. ) -> Any: ...
  136. @overload
  137. def take(
  138. a: _ArrayLike[_SCT],
  139. indices: _ArrayLikeInt_co,
  140. axis: SupportsIndex | None = ...,
  141. out: None = ...,
  142. mode: _ModeKind = ...,
  143. ) -> NDArray[_SCT]: ...
  144. @overload
  145. def take(
  146. a: ArrayLike,
  147. indices: _ArrayLikeInt_co,
  148. axis: SupportsIndex | None = ...,
  149. out: None = ...,
  150. mode: _ModeKind = ...,
  151. ) -> NDArray[Any]: ...
  152. @overload
  153. def take(
  154. a: ArrayLike,
  155. indices: _ArrayLikeInt_co,
  156. axis: SupportsIndex | None,
  157. out: _ArrayT,
  158. mode: _ModeKind = ...,
  159. ) -> _ArrayT: ...
  160. @overload
  161. def take(
  162. a: ArrayLike,
  163. indices: _ArrayLikeInt_co,
  164. axis: SupportsIndex | None = ...,
  165. *,
  166. out: _ArrayT,
  167. mode: _ModeKind = ...,
  168. ) -> _ArrayT: ...
  169. @overload
  170. def reshape( # shape: index
  171. a: _ArrayLike[_SCT],
  172. /,
  173. shape: SupportsIndex,
  174. order: _OrderACF = "C",
  175. *,
  176. copy: bool | None = None,
  177. ) -> np.ndarray[tuple[int], np.dtype[_SCT]]: ...
  178. @overload
  179. def reshape( # shape: (int, ...) @ _AnyShapeType
  180. a: _ArrayLike[_SCT],
  181. /,
  182. shape: _AnyShapeType,
  183. order: _OrderACF = "C",
  184. *,
  185. copy: bool | None = None,
  186. ) -> np.ndarray[_AnyShapeType, np.dtype[_SCT]]: ...
  187. @overload # shape: Sequence[index]
  188. def reshape(
  189. a: _ArrayLike[_SCT],
  190. /,
  191. shape: Sequence[SupportsIndex],
  192. order: _OrderACF = "C",
  193. *,
  194. copy: bool | None = None,
  195. ) -> NDArray[_SCT]: ...
  196. @overload # shape: index
  197. def reshape(
  198. a: ArrayLike,
  199. /,
  200. shape: SupportsIndex,
  201. order: _OrderACF = "C",
  202. *,
  203. copy: bool | None = None,
  204. ) -> np.ndarray[tuple[int], np.dtype[Any]]: ...
  205. @overload
  206. def reshape( # shape: (int, ...) @ _AnyShapeType
  207. a: ArrayLike,
  208. /,
  209. shape: _AnyShapeType,
  210. order: _OrderACF = "C",
  211. *,
  212. copy: bool | None = None,
  213. ) -> np.ndarray[_AnyShapeType, np.dtype[Any]]: ...
  214. @overload # shape: Sequence[index]
  215. def reshape(
  216. a: ArrayLike,
  217. /,
  218. shape: Sequence[SupportsIndex],
  219. order: _OrderACF = "C",
  220. *,
  221. copy: bool | None = None,
  222. ) -> NDArray[Any]: ...
  223. @overload
  224. @deprecated(
  225. "`newshape` keyword argument is deprecated, "
  226. "use `shape=...` or pass shape positionally instead. "
  227. "(deprecated in NumPy 2.1)",
  228. )
  229. def reshape(
  230. a: ArrayLike,
  231. /,
  232. shape: None = None,
  233. order: _OrderACF = "C",
  234. *,
  235. newshape: _ShapeLike,
  236. copy: bool | None = None,
  237. ) -> NDArray[Any]: ...
  238. @overload
  239. def choose(
  240. a: _IntLike_co,
  241. choices: ArrayLike,
  242. out: None = ...,
  243. mode: _ModeKind = ...,
  244. ) -> Any: ...
  245. @overload
  246. def choose(
  247. a: _ArrayLikeInt_co,
  248. choices: _ArrayLike[_SCT],
  249. out: None = ...,
  250. mode: _ModeKind = ...,
  251. ) -> NDArray[_SCT]: ...
  252. @overload
  253. def choose(
  254. a: _ArrayLikeInt_co,
  255. choices: ArrayLike,
  256. out: None = ...,
  257. mode: _ModeKind = ...,
  258. ) -> NDArray[Any]: ...
  259. @overload
  260. def choose(
  261. a: _ArrayLikeInt_co,
  262. choices: ArrayLike,
  263. out: _ArrayT,
  264. mode: _ModeKind = ...,
  265. ) -> _ArrayT: ...
  266. @overload
  267. def repeat(
  268. a: _ArrayLike[_SCT],
  269. repeats: _ArrayLikeInt_co,
  270. axis: SupportsIndex | None = ...,
  271. ) -> NDArray[_SCT]: ...
  272. @overload
  273. def repeat(
  274. a: ArrayLike,
  275. repeats: _ArrayLikeInt_co,
  276. axis: SupportsIndex | None = ...,
  277. ) -> NDArray[Any]: ...
  278. def put(
  279. a: NDArray[Any],
  280. ind: _ArrayLikeInt_co,
  281. v: ArrayLike,
  282. mode: _ModeKind = ...,
  283. ) -> None: ...
  284. @overload
  285. def swapaxes(
  286. a: _ArrayLike[_SCT],
  287. axis1: SupportsIndex,
  288. axis2: SupportsIndex,
  289. ) -> NDArray[_SCT]: ...
  290. @overload
  291. def swapaxes(
  292. a: ArrayLike,
  293. axis1: SupportsIndex,
  294. axis2: SupportsIndex,
  295. ) -> NDArray[Any]: ...
  296. @overload
  297. def transpose(
  298. a: _ArrayLike[_SCT],
  299. axes: _ShapeLike | None = ...
  300. ) -> NDArray[_SCT]: ...
  301. @overload
  302. def transpose(
  303. a: ArrayLike,
  304. axes: _ShapeLike | None = ...
  305. ) -> NDArray[Any]: ...
  306. @overload
  307. def matrix_transpose(x: _ArrayLike[_SCT], /) -> NDArray[_SCT]: ...
  308. @overload
  309. def matrix_transpose(x: ArrayLike, /) -> NDArray[Any]: ...
  310. #
  311. @overload
  312. def partition(
  313. a: _ArrayLike[_SCT],
  314. kth: _ArrayLikeInt,
  315. axis: SupportsIndex | None = -1,
  316. kind: _PartitionKind = "introselect",
  317. order: None = None,
  318. ) -> NDArray[_SCT]: ...
  319. @overload
  320. def partition(
  321. a: _ArrayLike[np.void],
  322. kth: _ArrayLikeInt,
  323. axis: SupportsIndex | None = -1,
  324. kind: _PartitionKind = "introselect",
  325. order: str | Sequence[str] | None = None,
  326. ) -> NDArray[np.void]: ...
  327. @overload
  328. def partition(
  329. a: ArrayLike,
  330. kth: _ArrayLikeInt,
  331. axis: SupportsIndex | None = -1,
  332. kind: _PartitionKind = "introselect",
  333. order: str | Sequence[str] | None = None,
  334. ) -> NDArray[Any]: ...
  335. #
  336. def argpartition(
  337. a: ArrayLike,
  338. kth: _ArrayLikeInt,
  339. axis: SupportsIndex | None = -1,
  340. kind: _PartitionKind = "introselect",
  341. order: str | Sequence[str] | None = None,
  342. ) -> NDArray[intp]: ...
  343. #
  344. @overload
  345. def sort(
  346. a: _ArrayLike[_SCT],
  347. axis: SupportsIndex | None = ...,
  348. kind: _SortKind | None = ...,
  349. order: str | Sequence[str] | None = ...,
  350. *,
  351. stable: bool | None = ...,
  352. ) -> NDArray[_SCT]: ...
  353. @overload
  354. def sort(
  355. a: ArrayLike,
  356. axis: SupportsIndex | None = ...,
  357. kind: _SortKind | None = ...,
  358. order: str | Sequence[str] | None = ...,
  359. *,
  360. stable: bool | None = ...,
  361. ) -> NDArray[Any]: ...
  362. def argsort(
  363. a: ArrayLike,
  364. axis: SupportsIndex | None = ...,
  365. kind: _SortKind | None = ...,
  366. order: str | Sequence[str] | None = ...,
  367. *,
  368. stable: bool | None = ...,
  369. ) -> NDArray[intp]: ...
  370. @overload
  371. def argmax(
  372. a: ArrayLike,
  373. axis: None = ...,
  374. out: None = ...,
  375. *,
  376. keepdims: Literal[False] = ...,
  377. ) -> intp: ...
  378. @overload
  379. def argmax(
  380. a: ArrayLike,
  381. axis: SupportsIndex | None = ...,
  382. out: None = ...,
  383. *,
  384. keepdims: bool = ...,
  385. ) -> Any: ...
  386. @overload
  387. def argmax(
  388. a: ArrayLike,
  389. axis: SupportsIndex | None,
  390. out: _ArrayT,
  391. *,
  392. keepdims: bool = ...,
  393. ) -> _ArrayT: ...
  394. @overload
  395. def argmax(
  396. a: ArrayLike,
  397. axis: SupportsIndex | None = ...,
  398. *,
  399. out: _ArrayT,
  400. keepdims: bool = ...,
  401. ) -> _ArrayT: ...
  402. @overload
  403. def argmin(
  404. a: ArrayLike,
  405. axis: None = ...,
  406. out: None = ...,
  407. *,
  408. keepdims: Literal[False] = ...,
  409. ) -> intp: ...
  410. @overload
  411. def argmin(
  412. a: ArrayLike,
  413. axis: SupportsIndex | None = ...,
  414. out: None = ...,
  415. *,
  416. keepdims: bool = ...,
  417. ) -> Any: ...
  418. @overload
  419. def argmin(
  420. a: ArrayLike,
  421. axis: SupportsIndex | None,
  422. out: _ArrayT,
  423. *,
  424. keepdims: bool = ...,
  425. ) -> _ArrayT: ...
  426. @overload
  427. def argmin(
  428. a: ArrayLike,
  429. axis: SupportsIndex | None = ...,
  430. *,
  431. out: _ArrayT,
  432. keepdims: bool = ...,
  433. ) -> _ArrayT: ...
  434. @overload
  435. def searchsorted(
  436. a: ArrayLike,
  437. v: _ScalarLike_co,
  438. side: _SortSide = ...,
  439. sorter: _ArrayLikeInt_co | None = ..., # 1D int array
  440. ) -> intp: ...
  441. @overload
  442. def searchsorted(
  443. a: ArrayLike,
  444. v: ArrayLike,
  445. side: _SortSide = ...,
  446. sorter: _ArrayLikeInt_co | None = ..., # 1D int array
  447. ) -> NDArray[intp]: ...
  448. #
  449. @overload
  450. def resize(a: _ArrayLike[_SCT], new_shape: SupportsIndex | tuple[SupportsIndex]) -> np.ndarray[tuple[int], np.dtype[_SCT]]: ...
  451. @overload
  452. def resize(a: _ArrayLike[_SCT], new_shape: _AnyShapeType) -> np.ndarray[_AnyShapeType, np.dtype[_SCT]]: ...
  453. @overload
  454. def resize(a: _ArrayLike[_SCT], new_shape: _ShapeLike) -> NDArray[_SCT]: ...
  455. @overload
  456. def resize(a: ArrayLike, new_shape: SupportsIndex | tuple[SupportsIndex]) -> np.ndarray[tuple[int], np.dtype[Any]]: ...
  457. @overload
  458. def resize(a: ArrayLike, new_shape: _AnyShapeType) -> np.ndarray[_AnyShapeType, np.dtype[Any]]: ...
  459. @overload
  460. def resize(a: ArrayLike, new_shape: _ShapeLike) -> NDArray[Any]: ...
  461. @overload
  462. def squeeze(
  463. a: _SCT,
  464. axis: _ShapeLike | None = ...,
  465. ) -> _SCT: ...
  466. @overload
  467. def squeeze(
  468. a: _ArrayLike[_SCT],
  469. axis: _ShapeLike | None = ...,
  470. ) -> NDArray[_SCT]: ...
  471. @overload
  472. def squeeze(
  473. a: ArrayLike,
  474. axis: _ShapeLike | None = ...,
  475. ) -> NDArray[Any]: ...
  476. @overload
  477. def diagonal(
  478. a: _ArrayLike[_SCT],
  479. offset: SupportsIndex = ...,
  480. axis1: SupportsIndex = ...,
  481. axis2: SupportsIndex = ..., # >= 2D array
  482. ) -> NDArray[_SCT]: ...
  483. @overload
  484. def diagonal(
  485. a: ArrayLike,
  486. offset: SupportsIndex = ...,
  487. axis1: SupportsIndex = ...,
  488. axis2: SupportsIndex = ..., # >= 2D array
  489. ) -> NDArray[Any]: ...
  490. @overload
  491. def trace(
  492. a: ArrayLike, # >= 2D array
  493. offset: SupportsIndex = ...,
  494. axis1: SupportsIndex = ...,
  495. axis2: SupportsIndex = ...,
  496. dtype: DTypeLike = ...,
  497. out: None = ...,
  498. ) -> Any: ...
  499. @overload
  500. def trace(
  501. a: ArrayLike, # >= 2D array
  502. offset: SupportsIndex,
  503. axis1: SupportsIndex,
  504. axis2: SupportsIndex,
  505. dtype: DTypeLike,
  506. out: _ArrayT,
  507. ) -> _ArrayT: ...
  508. @overload
  509. def trace(
  510. a: ArrayLike, # >= 2D array
  511. offset: SupportsIndex = ...,
  512. axis1: SupportsIndex = ...,
  513. axis2: SupportsIndex = ...,
  514. dtype: DTypeLike = ...,
  515. *,
  516. out: _ArrayT,
  517. ) -> _ArrayT: ...
  518. _Array1D: TypeAlias = np.ndarray[tuple[int], np.dtype[_SCT]]
  519. @overload
  520. def ravel(a: _ArrayLike[_SCT], order: _OrderKACF = "C") -> _Array1D[_SCT]: ...
  521. @overload
  522. def ravel(a: bytes | _NestedSequence[bytes], order: _OrderKACF = "C") -> _Array1D[np.bytes_]: ...
  523. @overload
  524. def ravel(a: str | _NestedSequence[str], order: _OrderKACF = "C") -> _Array1D[np.str_]: ...
  525. @overload
  526. def ravel(a: bool | _NestedSequence[bool], order: _OrderKACF = "C") -> _Array1D[np.bool]: ...
  527. @overload
  528. def ravel(a: int | _NestedSequence[int], order: _OrderKACF = "C") -> _Array1D[np.int_ | np.bool]: ...
  529. @overload
  530. def ravel(a: float | _NestedSequence[float], order: _OrderKACF = "C") -> _Array1D[np.float64 | np.int_ | np.bool]: ...
  531. @overload
  532. def ravel(
  533. a: complex | _NestedSequence[complex],
  534. order: _OrderKACF = "C",
  535. ) -> _Array1D[np.complex128 | np.float64 | np.int_ | np.bool]: ...
  536. @overload
  537. def ravel(a: ArrayLike, order: _OrderKACF = "C") -> np.ndarray[tuple[int], np.dtype[Any]]: ...
  538. def nonzero(a: _ArrayLike[Any]) -> tuple[NDArray[intp], ...]: ...
  539. # this prevents `Any` from being returned with Pyright
  540. @overload
  541. def shape(a: _SupportsShape[Never]) -> tuple[int, ...]: ...
  542. @overload
  543. def shape(a: _SupportsShape[_ShapeType]) -> _ShapeType: ...
  544. @overload
  545. def shape(a: _PyScalar) -> tuple[()]: ...
  546. # `collections.abc.Sequence` can't be used hesre, since `bytes` and `str` are
  547. # subtypes of it, which would make the return types incompatible.
  548. @overload
  549. def shape(a: _PyArray[_PyScalar]) -> tuple[int]: ...
  550. @overload
  551. def shape(a: _PyArray[_PyArray[_PyScalar]]) -> tuple[int, int]: ...
  552. # this overload will be skipped by typecheckers that don't support PEP 688
  553. @overload
  554. def shape(a: memoryview | bytearray) -> tuple[int]: ...
  555. @overload
  556. def shape(a: ArrayLike) -> tuple[int, ...]: ...
  557. @overload
  558. def compress(
  559. condition: _ArrayLikeBool_co, # 1D bool array
  560. a: _ArrayLike[_SCT],
  561. axis: SupportsIndex | None = ...,
  562. out: None = ...,
  563. ) -> NDArray[_SCT]: ...
  564. @overload
  565. def compress(
  566. condition: _ArrayLikeBool_co, # 1D bool array
  567. a: ArrayLike,
  568. axis: SupportsIndex | None = ...,
  569. out: None = ...,
  570. ) -> NDArray[Any]: ...
  571. @overload
  572. def compress(
  573. condition: _ArrayLikeBool_co, # 1D bool array
  574. a: ArrayLike,
  575. axis: SupportsIndex | None,
  576. out: _ArrayT,
  577. ) -> _ArrayT: ...
  578. @overload
  579. def compress(
  580. condition: _ArrayLikeBool_co, # 1D bool array
  581. a: ArrayLike,
  582. axis: SupportsIndex | None = ...,
  583. *,
  584. out: _ArrayT,
  585. ) -> _ArrayT: ...
  586. @overload
  587. def clip(
  588. a: _SCT,
  589. a_min: ArrayLike | None,
  590. a_max: ArrayLike | None,
  591. out: None = ...,
  592. *,
  593. min: ArrayLike | None = ...,
  594. max: ArrayLike | None = ...,
  595. dtype: None = ...,
  596. where: _ArrayLikeBool_co | None = ...,
  597. order: _OrderKACF = ...,
  598. subok: bool = ...,
  599. signature: str | tuple[str | None, ...] = ...,
  600. casting: _CastingKind = ...,
  601. ) -> _SCT: ...
  602. @overload
  603. def clip(
  604. a: _ScalarLike_co,
  605. a_min: ArrayLike | None,
  606. a_max: ArrayLike | None,
  607. out: None = ...,
  608. *,
  609. min: ArrayLike | None = ...,
  610. max: ArrayLike | None = ...,
  611. dtype: None = ...,
  612. where: _ArrayLikeBool_co | None = ...,
  613. order: _OrderKACF = ...,
  614. subok: bool = ...,
  615. signature: str | tuple[str | None, ...] = ...,
  616. casting: _CastingKind = ...,
  617. ) -> Any: ...
  618. @overload
  619. def clip(
  620. a: _ArrayLike[_SCT],
  621. a_min: ArrayLike | None,
  622. a_max: ArrayLike | None,
  623. out: None = ...,
  624. *,
  625. min: ArrayLike | None = ...,
  626. max: ArrayLike | None = ...,
  627. dtype: None = ...,
  628. where: _ArrayLikeBool_co | None = ...,
  629. order: _OrderKACF = ...,
  630. subok: bool = ...,
  631. signature: str | tuple[str | None, ...] = ...,
  632. casting: _CastingKind = ...,
  633. ) -> NDArray[_SCT]: ...
  634. @overload
  635. def clip(
  636. a: ArrayLike,
  637. a_min: ArrayLike | None,
  638. a_max: ArrayLike | None,
  639. out: None = ...,
  640. *,
  641. min: ArrayLike | None = ...,
  642. max: ArrayLike | None = ...,
  643. dtype: None = ...,
  644. where: _ArrayLikeBool_co | None = ...,
  645. order: _OrderKACF = ...,
  646. subok: bool = ...,
  647. signature: str | tuple[str | None, ...] = ...,
  648. casting: _CastingKind = ...,
  649. ) -> NDArray[Any]: ...
  650. @overload
  651. def clip(
  652. a: ArrayLike,
  653. a_min: ArrayLike | None,
  654. a_max: ArrayLike | None,
  655. out: _ArrayT,
  656. *,
  657. min: ArrayLike | None = ...,
  658. max: ArrayLike | None = ...,
  659. dtype: DTypeLike = ...,
  660. where: _ArrayLikeBool_co | None = ...,
  661. order: _OrderKACF = ...,
  662. subok: bool = ...,
  663. signature: str | tuple[str | None, ...] = ...,
  664. casting: _CastingKind = ...,
  665. ) -> _ArrayT: ...
  666. @overload
  667. def clip(
  668. a: ArrayLike,
  669. a_min: ArrayLike | None,
  670. a_max: ArrayLike | None,
  671. out: ArrayLike = ...,
  672. *,
  673. min: ArrayLike | None = ...,
  674. max: ArrayLike | None = ...,
  675. dtype: DTypeLike,
  676. where: _ArrayLikeBool_co | None = ...,
  677. order: _OrderKACF = ...,
  678. subok: bool = ...,
  679. signature: str | tuple[str | None, ...] = ...,
  680. casting: _CastingKind = ...,
  681. ) -> Any: ...
  682. @overload
  683. def sum(
  684. a: _ArrayLike[_SCT],
  685. axis: None = ...,
  686. dtype: None = ...,
  687. out: None = ...,
  688. keepdims: Literal[False] = ...,
  689. initial: _NumberLike_co = ...,
  690. where: _ArrayLikeBool_co = ...,
  691. ) -> _SCT: ...
  692. @overload
  693. def sum(
  694. a: _ArrayLike[_SCT],
  695. axis: None = ...,
  696. dtype: None = ...,
  697. out: None = ...,
  698. keepdims: bool = ...,
  699. initial: _NumberLike_co = ...,
  700. where: _ArrayLikeBool_co = ...,
  701. ) -> _SCT | NDArray[_SCT]: ...
  702. @overload
  703. def sum(
  704. a: ArrayLike,
  705. axis: None,
  706. dtype: _DTypeLike[_SCT],
  707. out: None = ...,
  708. keepdims: Literal[False] = ...,
  709. initial: _NumberLike_co = ...,
  710. where: _ArrayLikeBool_co = ...,
  711. ) -> _SCT: ...
  712. @overload
  713. def sum(
  714. a: ArrayLike,
  715. axis: None = ...,
  716. *,
  717. dtype: _DTypeLike[_SCT],
  718. out: None = ...,
  719. keepdims: Literal[False] = ...,
  720. initial: _NumberLike_co = ...,
  721. where: _ArrayLikeBool_co = ...,
  722. ) -> _SCT: ...
  723. @overload
  724. def sum(
  725. a: ArrayLike,
  726. axis: _ShapeLike | None,
  727. dtype: _DTypeLike[_SCT],
  728. out: None = ...,
  729. keepdims: bool = ...,
  730. initial: _NumberLike_co = ...,
  731. where: _ArrayLikeBool_co = ...,
  732. ) -> _SCT | NDArray[_SCT]: ...
  733. @overload
  734. def sum(
  735. a: ArrayLike,
  736. axis: _ShapeLike | None = ...,
  737. *,
  738. dtype: _DTypeLike[_SCT],
  739. out: None = ...,
  740. keepdims: bool = ...,
  741. initial: _NumberLike_co = ...,
  742. where: _ArrayLikeBool_co = ...,
  743. ) -> _SCT | NDArray[_SCT]: ...
  744. @overload
  745. def sum(
  746. a: ArrayLike,
  747. axis: _ShapeLike | None = ...,
  748. dtype: DTypeLike = ...,
  749. out: None = ...,
  750. keepdims: bool = ...,
  751. initial: _NumberLike_co = ...,
  752. where: _ArrayLikeBool_co = ...,
  753. ) -> Any: ...
  754. @overload
  755. def sum(
  756. a: ArrayLike,
  757. axis: _ShapeLike | None,
  758. dtype: DTypeLike,
  759. out: _ArrayT,
  760. keepdims: bool = ...,
  761. initial: _NumberLike_co = ...,
  762. where: _ArrayLikeBool_co = ...,
  763. ) -> _ArrayT: ...
  764. @overload
  765. def sum(
  766. a: ArrayLike,
  767. axis: _ShapeLike | None = ...,
  768. dtype: DTypeLike = ...,
  769. *,
  770. out: _ArrayT,
  771. keepdims: bool = ...,
  772. initial: _NumberLike_co = ...,
  773. where: _ArrayLikeBool_co = ...,
  774. ) -> _ArrayT: ...
  775. @overload
  776. def all(
  777. a: ArrayLike,
  778. axis: None = None,
  779. out: None = None,
  780. keepdims: Literal[False, 0] | _NoValueType = ...,
  781. *,
  782. where: _ArrayLikeBool_co | _NoValueType = ...,
  783. ) -> np.bool: ...
  784. @overload
  785. def all(
  786. a: ArrayLike,
  787. axis: int | tuple[int, ...] | None = None,
  788. out: None = None,
  789. keepdims: _BoolLike_co | _NoValueType = ...,
  790. *,
  791. where: _ArrayLikeBool_co | _NoValueType = ...,
  792. ) -> Incomplete: ...
  793. @overload
  794. def all(
  795. a: ArrayLike,
  796. axis: int | tuple[int, ...] | None,
  797. out: _ArrayT,
  798. keepdims: _BoolLike_co | _NoValueType = ...,
  799. *,
  800. where: _ArrayLikeBool_co | _NoValueType = ...,
  801. ) -> _ArrayT: ...
  802. @overload
  803. def all(
  804. a: ArrayLike,
  805. axis: int | tuple[int, ...] | None = None,
  806. *,
  807. out: _ArrayT,
  808. keepdims: _BoolLike_co | _NoValueType = ...,
  809. where: _ArrayLikeBool_co | _NoValueType = ...,
  810. ) -> _ArrayT: ...
  811. @overload
  812. def any(
  813. a: ArrayLike,
  814. axis: None = None,
  815. out: None = None,
  816. keepdims: Literal[False, 0] | _NoValueType = ...,
  817. *,
  818. where: _ArrayLikeBool_co | _NoValueType = ...,
  819. ) -> np.bool: ...
  820. @overload
  821. def any(
  822. a: ArrayLike,
  823. axis: int | tuple[int, ...] | None = None,
  824. out: None = None,
  825. keepdims: _BoolLike_co | _NoValueType = ...,
  826. *,
  827. where: _ArrayLikeBool_co | _NoValueType = ...,
  828. ) -> Incomplete: ...
  829. @overload
  830. def any(
  831. a: ArrayLike,
  832. axis: int | tuple[int, ...] | None,
  833. out: _ArrayT,
  834. keepdims: _BoolLike_co | _NoValueType = ...,
  835. *,
  836. where: _ArrayLikeBool_co | _NoValueType = ...,
  837. ) -> _ArrayT: ...
  838. @overload
  839. def any(
  840. a: ArrayLike,
  841. axis: int | tuple[int, ...] | None = None,
  842. *,
  843. out: _ArrayT,
  844. keepdims: _BoolLike_co | _NoValueType = ...,
  845. where: _ArrayLikeBool_co | _NoValueType = ...,
  846. ) -> _ArrayT: ...
  847. @overload
  848. def cumsum(
  849. a: _ArrayLike[_SCT],
  850. axis: SupportsIndex | None = ...,
  851. dtype: None = ...,
  852. out: None = ...,
  853. ) -> NDArray[_SCT]: ...
  854. @overload
  855. def cumsum(
  856. a: ArrayLike,
  857. axis: SupportsIndex | None = ...,
  858. dtype: None = ...,
  859. out: None = ...,
  860. ) -> NDArray[Any]: ...
  861. @overload
  862. def cumsum(
  863. a: ArrayLike,
  864. axis: SupportsIndex | None,
  865. dtype: _DTypeLike[_SCT],
  866. out: None = ...,
  867. ) -> NDArray[_SCT]: ...
  868. @overload
  869. def cumsum(
  870. a: ArrayLike,
  871. axis: SupportsIndex | None = ...,
  872. *,
  873. dtype: _DTypeLike[_SCT],
  874. out: None = ...,
  875. ) -> NDArray[_SCT]: ...
  876. @overload
  877. def cumsum(
  878. a: ArrayLike,
  879. axis: SupportsIndex | None = ...,
  880. dtype: DTypeLike = ...,
  881. out: None = ...,
  882. ) -> NDArray[Any]: ...
  883. @overload
  884. def cumsum(
  885. a: ArrayLike,
  886. axis: SupportsIndex | None,
  887. dtype: DTypeLike,
  888. out: _ArrayT,
  889. ) -> _ArrayT: ...
  890. @overload
  891. def cumsum(
  892. a: ArrayLike,
  893. axis: SupportsIndex | None = ...,
  894. dtype: DTypeLike = ...,
  895. *,
  896. out: _ArrayT,
  897. ) -> _ArrayT: ...
  898. @overload
  899. def cumulative_sum(
  900. x: _ArrayLike[_SCT],
  901. /,
  902. *,
  903. axis: SupportsIndex | None = ...,
  904. dtype: None = ...,
  905. out: None = ...,
  906. include_initial: bool = ...,
  907. ) -> NDArray[_SCT]: ...
  908. @overload
  909. def cumulative_sum(
  910. x: ArrayLike,
  911. /,
  912. *,
  913. axis: SupportsIndex | None = ...,
  914. dtype: None = ...,
  915. out: None = ...,
  916. include_initial: bool = ...,
  917. ) -> NDArray[Any]: ...
  918. @overload
  919. def cumulative_sum(
  920. x: ArrayLike,
  921. /,
  922. *,
  923. axis: SupportsIndex | None = ...,
  924. dtype: _DTypeLike[_SCT],
  925. out: None = ...,
  926. include_initial: bool = ...,
  927. ) -> NDArray[_SCT]: ...
  928. @overload
  929. def cumulative_sum(
  930. x: ArrayLike,
  931. /,
  932. *,
  933. axis: SupportsIndex | None = ...,
  934. dtype: DTypeLike = ...,
  935. out: None = ...,
  936. include_initial: bool = ...,
  937. ) -> NDArray[Any]: ...
  938. @overload
  939. def cumulative_sum(
  940. x: ArrayLike,
  941. /,
  942. *,
  943. axis: SupportsIndex | None = ...,
  944. dtype: DTypeLike = ...,
  945. out: _ArrayT,
  946. include_initial: bool = ...,
  947. ) -> _ArrayT: ...
  948. @overload
  949. def ptp(
  950. a: _ArrayLike[_SCT],
  951. axis: None = ...,
  952. out: None = ...,
  953. keepdims: Literal[False] = ...,
  954. ) -> _SCT: ...
  955. @overload
  956. def ptp(
  957. a: ArrayLike,
  958. axis: _ShapeLike | None = ...,
  959. out: None = ...,
  960. keepdims: bool = ...,
  961. ) -> Any: ...
  962. @overload
  963. def ptp(
  964. a: ArrayLike,
  965. axis: _ShapeLike | None,
  966. out: _ArrayT,
  967. keepdims: bool = ...,
  968. ) -> _ArrayT: ...
  969. @overload
  970. def ptp(
  971. a: ArrayLike,
  972. axis: _ShapeLike | None = ...,
  973. *,
  974. out: _ArrayT,
  975. keepdims: bool = ...,
  976. ) -> _ArrayT: ...
  977. @overload
  978. def amax(
  979. a: _ArrayLike[_SCT],
  980. axis: None = ...,
  981. out: None = ...,
  982. keepdims: Literal[False] = ...,
  983. initial: _NumberLike_co = ...,
  984. where: _ArrayLikeBool_co = ...,
  985. ) -> _SCT: ...
  986. @overload
  987. def amax(
  988. a: ArrayLike,
  989. axis: _ShapeLike | None = ...,
  990. out: None = ...,
  991. keepdims: bool = ...,
  992. initial: _NumberLike_co = ...,
  993. where: _ArrayLikeBool_co = ...,
  994. ) -> Any: ...
  995. @overload
  996. def amax(
  997. a: ArrayLike,
  998. axis: _ShapeLike | None,
  999. out: _ArrayT,
  1000. keepdims: bool = ...,
  1001. initial: _NumberLike_co = ...,
  1002. where: _ArrayLikeBool_co = ...,
  1003. ) -> _ArrayT: ...
  1004. @overload
  1005. def amax(
  1006. a: ArrayLike,
  1007. axis: _ShapeLike | None = ...,
  1008. *,
  1009. out: _ArrayT,
  1010. keepdims: bool = ...,
  1011. initial: _NumberLike_co = ...,
  1012. where: _ArrayLikeBool_co = ...,
  1013. ) -> _ArrayT: ...
  1014. @overload
  1015. def amin(
  1016. a: _ArrayLike[_SCT],
  1017. axis: None = ...,
  1018. out: None = ...,
  1019. keepdims: Literal[False] = ...,
  1020. initial: _NumberLike_co = ...,
  1021. where: _ArrayLikeBool_co = ...,
  1022. ) -> _SCT: ...
  1023. @overload
  1024. def amin(
  1025. a: ArrayLike,
  1026. axis: _ShapeLike | None = ...,
  1027. out: None = ...,
  1028. keepdims: bool = ...,
  1029. initial: _NumberLike_co = ...,
  1030. where: _ArrayLikeBool_co = ...,
  1031. ) -> Any: ...
  1032. @overload
  1033. def amin(
  1034. a: ArrayLike,
  1035. axis: _ShapeLike | None,
  1036. out: _ArrayT,
  1037. keepdims: bool = ...,
  1038. initial: _NumberLike_co = ...,
  1039. where: _ArrayLikeBool_co = ...,
  1040. ) -> _ArrayT: ...
  1041. @overload
  1042. def amin(
  1043. a: ArrayLike,
  1044. axis: _ShapeLike | None = ...,
  1045. *,
  1046. out: _ArrayT,
  1047. keepdims: bool = ...,
  1048. initial: _NumberLike_co = ...,
  1049. where: _ArrayLikeBool_co = ...,
  1050. ) -> _ArrayT: ...
  1051. # TODO: `np.prod()``: For object arrays `initial` does not necessarily
  1052. # have to be a numerical scalar.
  1053. # The only requirement is that it is compatible
  1054. # with the `.__mul__()` method(s) of the passed array's elements.
  1055. # Note that the same situation holds for all wrappers around
  1056. # `np.ufunc.reduce`, e.g. `np.sum()` (`.__add__()`).
  1057. @overload
  1058. def prod(
  1059. a: _ArrayLikeBool_co,
  1060. axis: None = ...,
  1061. dtype: None = ...,
  1062. out: None = ...,
  1063. keepdims: Literal[False] = ...,
  1064. initial: _NumberLike_co = ...,
  1065. where: _ArrayLikeBool_co = ...,
  1066. ) -> int_: ...
  1067. @overload
  1068. def prod(
  1069. a: _ArrayLikeUInt_co,
  1070. axis: None = ...,
  1071. dtype: None = ...,
  1072. out: None = ...,
  1073. keepdims: Literal[False] = ...,
  1074. initial: _NumberLike_co = ...,
  1075. where: _ArrayLikeBool_co = ...,
  1076. ) -> uint64: ...
  1077. @overload
  1078. def prod(
  1079. a: _ArrayLikeInt_co,
  1080. axis: None = ...,
  1081. dtype: None = ...,
  1082. out: None = ...,
  1083. keepdims: Literal[False] = ...,
  1084. initial: _NumberLike_co = ...,
  1085. where: _ArrayLikeBool_co = ...,
  1086. ) -> int64: ...
  1087. @overload
  1088. def prod(
  1089. a: _ArrayLikeFloat_co,
  1090. axis: None = ...,
  1091. dtype: None = ...,
  1092. out: None = ...,
  1093. keepdims: Literal[False] = ...,
  1094. initial: _NumberLike_co = ...,
  1095. where: _ArrayLikeBool_co = ...,
  1096. ) -> floating[Any]: ...
  1097. @overload
  1098. def prod(
  1099. a: _ArrayLikeComplex_co,
  1100. axis: None = ...,
  1101. dtype: None = ...,
  1102. out: None = ...,
  1103. keepdims: Literal[False] = ...,
  1104. initial: _NumberLike_co = ...,
  1105. where: _ArrayLikeBool_co = ...,
  1106. ) -> complexfloating[Any, Any]: ...
  1107. @overload
  1108. def prod(
  1109. a: _ArrayLikeComplex_co | _ArrayLikeObject_co,
  1110. axis: _ShapeLike | None = ...,
  1111. dtype: None = ...,
  1112. out: None = ...,
  1113. keepdims: bool = ...,
  1114. initial: _NumberLike_co = ...,
  1115. where: _ArrayLikeBool_co = ...,
  1116. ) -> Any: ...
  1117. @overload
  1118. def prod(
  1119. a: _ArrayLikeComplex_co | _ArrayLikeObject_co,
  1120. axis: None,
  1121. dtype: _DTypeLike[_SCT],
  1122. out: None = ...,
  1123. keepdims: Literal[False] = ...,
  1124. initial: _NumberLike_co = ...,
  1125. where: _ArrayLikeBool_co = ...,
  1126. ) -> _SCT: ...
  1127. @overload
  1128. def prod(
  1129. a: _ArrayLikeComplex_co | _ArrayLikeObject_co,
  1130. axis: None = ...,
  1131. *,
  1132. dtype: _DTypeLike[_SCT],
  1133. out: None = ...,
  1134. keepdims: Literal[False] = ...,
  1135. initial: _NumberLike_co = ...,
  1136. where: _ArrayLikeBool_co = ...,
  1137. ) -> _SCT: ...
  1138. @overload
  1139. def prod(
  1140. a: _ArrayLikeComplex_co | _ArrayLikeObject_co,
  1141. axis: _ShapeLike | None = ...,
  1142. dtype: DTypeLike | None = ...,
  1143. out: None = ...,
  1144. keepdims: bool = ...,
  1145. initial: _NumberLike_co = ...,
  1146. where: _ArrayLikeBool_co = ...,
  1147. ) -> Any: ...
  1148. @overload
  1149. def prod(
  1150. a: _ArrayLikeComplex_co | _ArrayLikeObject_co,
  1151. axis: _ShapeLike | None,
  1152. dtype: DTypeLike | None,
  1153. out: _ArrayT,
  1154. keepdims: bool = ...,
  1155. initial: _NumberLike_co = ...,
  1156. where: _ArrayLikeBool_co = ...,
  1157. ) -> _ArrayT: ...
  1158. @overload
  1159. def prod(
  1160. a: _ArrayLikeComplex_co | _ArrayLikeObject_co,
  1161. axis: _ShapeLike | None = ...,
  1162. dtype: DTypeLike | None = ...,
  1163. *,
  1164. out: _ArrayT,
  1165. keepdims: bool = ...,
  1166. initial: _NumberLike_co = ...,
  1167. where: _ArrayLikeBool_co = ...,
  1168. ) -> _ArrayT: ...
  1169. @overload
  1170. def cumprod(
  1171. a: _ArrayLikeBool_co,
  1172. axis: SupportsIndex | None = ...,
  1173. dtype: None = ...,
  1174. out: None = ...,
  1175. ) -> NDArray[int_]: ...
  1176. @overload
  1177. def cumprod(
  1178. a: _ArrayLikeUInt_co,
  1179. axis: SupportsIndex | None = ...,
  1180. dtype: None = ...,
  1181. out: None = ...,
  1182. ) -> NDArray[uint64]: ...
  1183. @overload
  1184. def cumprod(
  1185. a: _ArrayLikeInt_co,
  1186. axis: SupportsIndex | None = ...,
  1187. dtype: None = ...,
  1188. out: None = ...,
  1189. ) -> NDArray[int64]: ...
  1190. @overload
  1191. def cumprod(
  1192. a: _ArrayLikeFloat_co,
  1193. axis: SupportsIndex | None = ...,
  1194. dtype: None = ...,
  1195. out: None = ...,
  1196. ) -> NDArray[floating[Any]]: ...
  1197. @overload
  1198. def cumprod(
  1199. a: _ArrayLikeComplex_co,
  1200. axis: SupportsIndex | None = ...,
  1201. dtype: None = ...,
  1202. out: None = ...,
  1203. ) -> NDArray[complexfloating[Any, Any]]: ...
  1204. @overload
  1205. def cumprod(
  1206. a: _ArrayLikeObject_co,
  1207. axis: SupportsIndex | None = ...,
  1208. dtype: None = ...,
  1209. out: None = ...,
  1210. ) -> NDArray[object_]: ...
  1211. @overload
  1212. def cumprod(
  1213. a: _ArrayLikeComplex_co | _ArrayLikeObject_co,
  1214. axis: SupportsIndex | None,
  1215. dtype: _DTypeLike[_SCT],
  1216. out: None = ...,
  1217. ) -> NDArray[_SCT]: ...
  1218. @overload
  1219. def cumprod(
  1220. a: _ArrayLikeComplex_co | _ArrayLikeObject_co,
  1221. axis: SupportsIndex | None = ...,
  1222. *,
  1223. dtype: _DTypeLike[_SCT],
  1224. out: None = ...,
  1225. ) -> NDArray[_SCT]: ...
  1226. @overload
  1227. def cumprod(
  1228. a: _ArrayLikeComplex_co | _ArrayLikeObject_co,
  1229. axis: SupportsIndex | None = ...,
  1230. dtype: DTypeLike = ...,
  1231. out: None = ...,
  1232. ) -> NDArray[Any]: ...
  1233. @overload
  1234. def cumprod(
  1235. a: _ArrayLikeComplex_co | _ArrayLikeObject_co,
  1236. axis: SupportsIndex | None,
  1237. dtype: DTypeLike,
  1238. out: _ArrayT,
  1239. ) -> _ArrayT: ...
  1240. @overload
  1241. def cumprod(
  1242. a: _ArrayLikeComplex_co | _ArrayLikeObject_co,
  1243. axis: SupportsIndex | None = ...,
  1244. dtype: DTypeLike = ...,
  1245. *,
  1246. out: _ArrayT,
  1247. ) -> _ArrayT: ...
  1248. @overload
  1249. def cumulative_prod(
  1250. x: _ArrayLikeBool_co,
  1251. /,
  1252. *,
  1253. axis: SupportsIndex | None = ...,
  1254. dtype: None = ...,
  1255. out: None = ...,
  1256. include_initial: bool = ...,
  1257. ) -> NDArray[int_]: ...
  1258. @overload
  1259. def cumulative_prod(
  1260. x: _ArrayLikeUInt_co,
  1261. /,
  1262. *,
  1263. axis: SupportsIndex | None = ...,
  1264. dtype: None = ...,
  1265. out: None = ...,
  1266. include_initial: bool = ...,
  1267. ) -> NDArray[uint64]: ...
  1268. @overload
  1269. def cumulative_prod(
  1270. x: _ArrayLikeInt_co,
  1271. /,
  1272. *,
  1273. axis: SupportsIndex | None = ...,
  1274. dtype: None = ...,
  1275. out: None = ...,
  1276. include_initial: bool = ...,
  1277. ) -> NDArray[int64]: ...
  1278. @overload
  1279. def cumulative_prod(
  1280. x: _ArrayLikeFloat_co,
  1281. /,
  1282. *,
  1283. axis: SupportsIndex | None = ...,
  1284. dtype: None = ...,
  1285. out: None = ...,
  1286. include_initial: bool = ...,
  1287. ) -> NDArray[floating[Any]]: ...
  1288. @overload
  1289. def cumulative_prod(
  1290. x: _ArrayLikeComplex_co,
  1291. /,
  1292. *,
  1293. axis: SupportsIndex | None = ...,
  1294. dtype: None = ...,
  1295. out: None = ...,
  1296. include_initial: bool = ...,
  1297. ) -> NDArray[complexfloating[Any, Any]]: ...
  1298. @overload
  1299. def cumulative_prod(
  1300. x: _ArrayLikeObject_co,
  1301. /,
  1302. *,
  1303. axis: SupportsIndex | None = ...,
  1304. dtype: None = ...,
  1305. out: None = ...,
  1306. include_initial: bool = ...,
  1307. ) -> NDArray[object_]: ...
  1308. @overload
  1309. def cumulative_prod(
  1310. x: _ArrayLikeComplex_co | _ArrayLikeObject_co,
  1311. /,
  1312. *,
  1313. axis: SupportsIndex | None = ...,
  1314. dtype: _DTypeLike[_SCT],
  1315. out: None = ...,
  1316. include_initial: bool = ...,
  1317. ) -> NDArray[_SCT]: ...
  1318. @overload
  1319. def cumulative_prod(
  1320. x: _ArrayLikeComplex_co | _ArrayLikeObject_co,
  1321. /,
  1322. *,
  1323. axis: SupportsIndex | None = ...,
  1324. dtype: DTypeLike = ...,
  1325. out: None = ...,
  1326. include_initial: bool = ...,
  1327. ) -> NDArray[Any]: ...
  1328. @overload
  1329. def cumulative_prod(
  1330. x: _ArrayLikeComplex_co | _ArrayLikeObject_co,
  1331. /,
  1332. *,
  1333. axis: SupportsIndex | None = ...,
  1334. dtype: DTypeLike = ...,
  1335. out: _ArrayT,
  1336. include_initial: bool = ...,
  1337. ) -> _ArrayT: ...
  1338. def ndim(a: ArrayLike) -> int: ...
  1339. def size(a: ArrayLike, axis: int | None = ...) -> int: ...
  1340. @overload
  1341. def around(
  1342. a: _BoolLike_co,
  1343. decimals: SupportsIndex = ...,
  1344. out: None = ...,
  1345. ) -> float16: ...
  1346. @overload
  1347. def around(
  1348. a: _SCT_uifcO,
  1349. decimals: SupportsIndex = ...,
  1350. out: None = ...,
  1351. ) -> _SCT_uifcO: ...
  1352. @overload
  1353. def around(
  1354. a: _ComplexLike_co | object_,
  1355. decimals: SupportsIndex = ...,
  1356. out: None = ...,
  1357. ) -> Any: ...
  1358. @overload
  1359. def around(
  1360. a: _ArrayLikeBool_co,
  1361. decimals: SupportsIndex = ...,
  1362. out: None = ...,
  1363. ) -> NDArray[float16]: ...
  1364. @overload
  1365. def around(
  1366. a: _ArrayLike[_SCT_uifcO],
  1367. decimals: SupportsIndex = ...,
  1368. out: None = ...,
  1369. ) -> NDArray[_SCT_uifcO]: ...
  1370. @overload
  1371. def around(
  1372. a: _ArrayLikeComplex_co | _ArrayLikeObject_co,
  1373. decimals: SupportsIndex = ...,
  1374. out: None = ...,
  1375. ) -> NDArray[Any]: ...
  1376. @overload
  1377. def around(
  1378. a: _ArrayLikeComplex_co | _ArrayLikeObject_co,
  1379. decimals: SupportsIndex,
  1380. out: _ArrayT,
  1381. ) -> _ArrayT: ...
  1382. @overload
  1383. def around(
  1384. a: _ArrayLikeComplex_co | _ArrayLikeObject_co,
  1385. decimals: SupportsIndex = ...,
  1386. *,
  1387. out: _ArrayT,
  1388. ) -> _ArrayT: ...
  1389. @overload
  1390. def mean(
  1391. a: _ArrayLikeFloat_co,
  1392. axis: None = ...,
  1393. dtype: None = ...,
  1394. out: None = ...,
  1395. keepdims: Literal[False] | _NoValueType = ...,
  1396. *,
  1397. where: _ArrayLikeBool_co | _NoValueType = ...,
  1398. ) -> floating[Any]: ...
  1399. @overload
  1400. def mean(
  1401. a: _ArrayLikeComplex_co,
  1402. axis: None = ...,
  1403. dtype: None = ...,
  1404. out: None = ...,
  1405. keepdims: Literal[False] | _NoValueType = ...,
  1406. *,
  1407. where: _ArrayLikeBool_co | _NoValueType = ...,
  1408. ) -> complexfloating[Any]: ...
  1409. @overload
  1410. def mean(
  1411. a: _ArrayLike[np.timedelta64],
  1412. axis: None = ...,
  1413. dtype: None = ...,
  1414. out: None = ...,
  1415. keepdims: Literal[False] | _NoValueType = ...,
  1416. *,
  1417. where: _ArrayLikeBool_co | _NoValueType = ...,
  1418. ) -> timedelta64: ...
  1419. @overload
  1420. def mean(
  1421. a: _ArrayLikeComplex_co | _ArrayLikeObject_co,
  1422. axis: _ShapeLike | None,
  1423. dtype: DTypeLike,
  1424. out: _ArrayT,
  1425. keepdims: bool | _NoValueType = ...,
  1426. *,
  1427. where: _ArrayLikeBool_co | _NoValueType = ...,
  1428. ) -> _ArrayT: ...
  1429. @overload
  1430. def mean(
  1431. a: _ArrayLikeComplex_co | _ArrayLikeObject_co,
  1432. axis: _ShapeLike | None = ...,
  1433. dtype: DTypeLike | None = ...,
  1434. *,
  1435. out: _ArrayT,
  1436. keepdims: bool | _NoValueType = ...,
  1437. where: _ArrayLikeBool_co | _NoValueType = ...,
  1438. ) -> _ArrayT: ...
  1439. @overload
  1440. def mean(
  1441. a: _ArrayLikeComplex_co | _ArrayLikeObject_co,
  1442. axis: None,
  1443. dtype: _DTypeLike[_SCT],
  1444. out: None = ...,
  1445. keepdims: Literal[False] | _NoValueType = ...,
  1446. *,
  1447. where: _ArrayLikeBool_co | _NoValueType = ...,
  1448. ) -> _SCT: ...
  1449. @overload
  1450. def mean(
  1451. a: _ArrayLikeComplex_co | _ArrayLikeObject_co,
  1452. axis: None = ...,
  1453. *,
  1454. dtype: _DTypeLike[_SCT],
  1455. out: None = ...,
  1456. keepdims: Literal[False] | _NoValueType = ...,
  1457. where: _ArrayLikeBool_co | _NoValueType = ...,
  1458. ) -> _SCT: ...
  1459. @overload
  1460. def mean(
  1461. a: _ArrayLikeComplex_co | _ArrayLikeObject_co,
  1462. axis: _ShapeLike | None,
  1463. dtype: _DTypeLike[_SCT],
  1464. out: None,
  1465. keepdims: Literal[True, 1],
  1466. *,
  1467. where: _ArrayLikeBool_co | _NoValueType = ...,
  1468. ) -> NDArray[_SCT]: ...
  1469. @overload
  1470. def mean(
  1471. a: _ArrayLikeComplex_co | _ArrayLikeObject_co,
  1472. axis: _ShapeLike | None,
  1473. dtype: _DTypeLike[_SCT],
  1474. out: None = ...,
  1475. *,
  1476. keepdims: bool | _NoValueType = ...,
  1477. where: _ArrayLikeBool_co | _NoValueType = ...,
  1478. ) -> _SCT | NDArray[_SCT]: ...
  1479. @overload
  1480. def mean(
  1481. a: _ArrayLikeComplex_co | _ArrayLikeObject_co,
  1482. axis: _ShapeLike | None = ...,
  1483. *,
  1484. dtype: _DTypeLike[_SCT],
  1485. out: None = ...,
  1486. keepdims: bool | _NoValueType = ...,
  1487. where: _ArrayLikeBool_co | _NoValueType = ...,
  1488. ) -> _SCT | NDArray[_SCT]: ...
  1489. @overload
  1490. def mean(
  1491. a: _ArrayLikeComplex_co | _ArrayLikeObject_co,
  1492. axis: _ShapeLike | None = ...,
  1493. dtype: DTypeLike | None = ...,
  1494. out: None = ...,
  1495. keepdims: bool | _NoValueType = ...,
  1496. *,
  1497. where: _ArrayLikeBool_co | _NoValueType = ...,
  1498. ) -> Incomplete: ...
  1499. @overload
  1500. def std(
  1501. a: _ArrayLikeComplex_co,
  1502. axis: None = ...,
  1503. dtype: None = ...,
  1504. out: None = ...,
  1505. ddof: float = ...,
  1506. keepdims: Literal[False] = ...,
  1507. *,
  1508. where: _ArrayLikeBool_co | _NoValueType = ...,
  1509. mean: _ArrayLikeComplex_co | _NoValueType = ...,
  1510. correction: float | _NoValueType = ...,
  1511. ) -> floating[Any]: ...
  1512. @overload
  1513. def std(
  1514. a: _ArrayLikeComplex_co | _ArrayLikeObject_co,
  1515. axis: _ShapeLike | None = ...,
  1516. dtype: None = ...,
  1517. out: None = ...,
  1518. ddof: float = ...,
  1519. keepdims: bool = ...,
  1520. *,
  1521. where: _ArrayLikeBool_co | _NoValueType = ...,
  1522. mean: _ArrayLikeComplex_co | _ArrayLikeObject_co | _NoValueType = ...,
  1523. correction: float | _NoValueType = ...,
  1524. ) -> Any: ...
  1525. @overload
  1526. def std(
  1527. a: _ArrayLikeComplex_co | _ArrayLikeObject_co,
  1528. axis: None,
  1529. dtype: _DTypeLike[_SCT],
  1530. out: None = ...,
  1531. ddof: float = ...,
  1532. keepdims: Literal[False] = ...,
  1533. *,
  1534. where: _ArrayLikeBool_co | _NoValueType = ...,
  1535. mean: _ArrayLikeComplex_co | _ArrayLikeObject_co | _NoValueType = ...,
  1536. correction: float | _NoValueType = ...,
  1537. ) -> _SCT: ...
  1538. @overload
  1539. def std(
  1540. a: _ArrayLikeComplex_co | _ArrayLikeObject_co,
  1541. axis: None = ...,
  1542. *,
  1543. dtype: _DTypeLike[_SCT],
  1544. out: None = ...,
  1545. ddof: float = ...,
  1546. keepdims: Literal[False] = ...,
  1547. where: _ArrayLikeBool_co | _NoValueType = ...,
  1548. mean: _ArrayLikeComplex_co | _ArrayLikeObject_co | _NoValueType = ...,
  1549. correction: float | _NoValueType = ...,
  1550. ) -> _SCT: ...
  1551. @overload
  1552. def std(
  1553. a: _ArrayLikeComplex_co | _ArrayLikeObject_co,
  1554. axis: _ShapeLike | None = ...,
  1555. dtype: DTypeLike = ...,
  1556. out: None = ...,
  1557. ddof: float = ...,
  1558. keepdims: bool = ...,
  1559. *,
  1560. where: _ArrayLikeBool_co | _NoValueType = ...,
  1561. mean: _ArrayLikeComplex_co | _ArrayLikeObject_co | _NoValueType = ...,
  1562. correction: float | _NoValueType = ...,
  1563. ) -> Any: ...
  1564. @overload
  1565. def std(
  1566. a: _ArrayLikeComplex_co | _ArrayLikeObject_co,
  1567. axis: _ShapeLike | None,
  1568. dtype: DTypeLike,
  1569. out: _ArrayT,
  1570. ddof: float = ...,
  1571. keepdims: bool = ...,
  1572. *,
  1573. where: _ArrayLikeBool_co | _NoValueType = ...,
  1574. mean: _ArrayLikeComplex_co | _ArrayLikeObject_co | _NoValueType = ...,
  1575. correction: float | _NoValueType = ...,
  1576. ) -> _ArrayT: ...
  1577. @overload
  1578. def std(
  1579. a: _ArrayLikeComplex_co | _ArrayLikeObject_co,
  1580. axis: _ShapeLike | None = ...,
  1581. dtype: DTypeLike = ...,
  1582. *,
  1583. out: _ArrayT,
  1584. ddof: float = ...,
  1585. keepdims: bool = ...,
  1586. where: _ArrayLikeBool_co | _NoValueType = ...,
  1587. mean: _ArrayLikeComplex_co | _ArrayLikeObject_co | _NoValueType = ...,
  1588. correction: float | _NoValueType = ...,
  1589. ) -> _ArrayT: ...
  1590. @overload
  1591. def var(
  1592. a: _ArrayLikeComplex_co,
  1593. axis: None = ...,
  1594. dtype: None = ...,
  1595. out: None = ...,
  1596. ddof: float = ...,
  1597. keepdims: Literal[False] = ...,
  1598. *,
  1599. where: _ArrayLikeBool_co | _NoValueType = ...,
  1600. mean: _ArrayLikeComplex_co | _NoValueType = ...,
  1601. correction: float | _NoValueType = ...,
  1602. ) -> floating[Any]: ...
  1603. @overload
  1604. def var(
  1605. a: _ArrayLikeComplex_co | _ArrayLikeObject_co,
  1606. axis: _ShapeLike | None = ...,
  1607. dtype: None = ...,
  1608. out: None = ...,
  1609. ddof: float = ...,
  1610. keepdims: bool = ...,
  1611. *,
  1612. where: _ArrayLikeBool_co | _NoValueType = ...,
  1613. mean: _ArrayLikeComplex_co | _ArrayLikeObject_co | _NoValueType = ...,
  1614. correction: float | _NoValueType = ...,
  1615. ) -> Any: ...
  1616. @overload
  1617. def var(
  1618. a: _ArrayLikeComplex_co | _ArrayLikeObject_co,
  1619. axis: None,
  1620. dtype: _DTypeLike[_SCT],
  1621. out: None = ...,
  1622. ddof: float = ...,
  1623. keepdims: Literal[False] = ...,
  1624. *,
  1625. where: _ArrayLikeBool_co | _NoValueType = ...,
  1626. mean: _ArrayLikeComplex_co | _ArrayLikeObject_co | _NoValueType = ...,
  1627. correction: float | _NoValueType = ...,
  1628. ) -> _SCT: ...
  1629. @overload
  1630. def var(
  1631. a: _ArrayLikeComplex_co | _ArrayLikeObject_co,
  1632. axis: None = ...,
  1633. *,
  1634. dtype: _DTypeLike[_SCT],
  1635. out: None = ...,
  1636. ddof: float = ...,
  1637. keepdims: Literal[False] = ...,
  1638. where: _ArrayLikeBool_co | _NoValueType = ...,
  1639. mean: _ArrayLikeComplex_co | _ArrayLikeObject_co | _NoValueType = ...,
  1640. correction: float | _NoValueType = ...,
  1641. ) -> _SCT: ...
  1642. @overload
  1643. def var(
  1644. a: _ArrayLikeComplex_co | _ArrayLikeObject_co,
  1645. axis: _ShapeLike | None = ...,
  1646. dtype: DTypeLike = ...,
  1647. out: None = ...,
  1648. ddof: float = ...,
  1649. keepdims: bool = ...,
  1650. *,
  1651. where: _ArrayLikeBool_co | _NoValueType = ...,
  1652. mean: _ArrayLikeComplex_co | _ArrayLikeObject_co | _NoValueType = ...,
  1653. correction: float | _NoValueType = ...,
  1654. ) -> Any: ...
  1655. @overload
  1656. def var(
  1657. a: _ArrayLikeComplex_co | _ArrayLikeObject_co,
  1658. axis: _ShapeLike | None,
  1659. dtype: DTypeLike,
  1660. out: _ArrayT,
  1661. ddof: float = ...,
  1662. keepdims: bool = ...,
  1663. *,
  1664. where: _ArrayLikeBool_co | _NoValueType = ...,
  1665. mean: _ArrayLikeComplex_co | _ArrayLikeObject_co | _NoValueType = ...,
  1666. correction: float | _NoValueType = ...,
  1667. ) -> _ArrayT: ...
  1668. @overload
  1669. def var(
  1670. a: _ArrayLikeComplex_co | _ArrayLikeObject_co,
  1671. axis: _ShapeLike | None = ...,
  1672. dtype: DTypeLike = ...,
  1673. *,
  1674. out: _ArrayT,
  1675. ddof: float = ...,
  1676. keepdims: bool = ...,
  1677. where: _ArrayLikeBool_co | _NoValueType = ...,
  1678. mean: _ArrayLikeComplex_co | _ArrayLikeObject_co | _NoValueType = ...,
  1679. correction: float | _NoValueType = ...,
  1680. ) -> _ArrayT: ...
  1681. max = amax
  1682. min = amin
  1683. round = around