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