__init__.pyi 150 KB

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