core.pyi 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472
  1. from collections.abc import Callable
  2. from typing import Any, TypeVar
  3. from numpy import ndarray, dtype, float64
  4. from numpy import (
  5. amax as amax,
  6. amin as amin,
  7. bool_ as bool_,
  8. expand_dims as expand_dims,
  9. diff as diff,
  10. clip as clip,
  11. indices as indices,
  12. ones_like as ones_like,
  13. squeeze as squeeze,
  14. zeros_like as zeros_like,
  15. )
  16. from numpy.lib.function_base import (
  17. angle as angle,
  18. )
  19. # TODO: Set the `bound` to something more suitable once we
  20. # have proper shape support
  21. _ShapeType = TypeVar("_ShapeType", bound=Any)
  22. _DType_co = TypeVar("_DType_co", bound=dtype[Any], covariant=True)
  23. __all__: list[str]
  24. MaskType = bool_
  25. nomask: bool_
  26. class MaskedArrayFutureWarning(FutureWarning): ...
  27. class MAError(Exception): ...
  28. class MaskError(MAError): ...
  29. def default_fill_value(obj): ...
  30. def minimum_fill_value(obj): ...
  31. def maximum_fill_value(obj): ...
  32. def set_fill_value(a, fill_value): ...
  33. def common_fill_value(a, b): ...
  34. def filled(a, fill_value=...): ...
  35. def getdata(a, subok=...): ...
  36. get_data = getdata
  37. def fix_invalid(a, mask=..., copy=..., fill_value=...): ...
  38. class _MaskedUFunc:
  39. f: Any
  40. __doc__: Any
  41. __name__: Any
  42. def __init__(self, ufunc): ...
  43. class _MaskedUnaryOperation(_MaskedUFunc):
  44. fill: Any
  45. domain: Any
  46. def __init__(self, mufunc, fill=..., domain=...): ...
  47. def __call__(self, a, *args, **kwargs): ...
  48. class _MaskedBinaryOperation(_MaskedUFunc):
  49. fillx: Any
  50. filly: Any
  51. def __init__(self, mbfunc, fillx=..., filly=...): ...
  52. def __call__(self, a, b, *args, **kwargs): ...
  53. def reduce(self, target, axis=..., dtype=...): ...
  54. def outer(self, a, b): ...
  55. def accumulate(self, target, axis=...): ...
  56. class _DomainedBinaryOperation(_MaskedUFunc):
  57. domain: Any
  58. fillx: Any
  59. filly: Any
  60. def __init__(self, dbfunc, domain, fillx=..., filly=...): ...
  61. def __call__(self, a, b, *args, **kwargs): ...
  62. exp: _MaskedUnaryOperation
  63. conjugate: _MaskedUnaryOperation
  64. sin: _MaskedUnaryOperation
  65. cos: _MaskedUnaryOperation
  66. arctan: _MaskedUnaryOperation
  67. arcsinh: _MaskedUnaryOperation
  68. sinh: _MaskedUnaryOperation
  69. cosh: _MaskedUnaryOperation
  70. tanh: _MaskedUnaryOperation
  71. abs: _MaskedUnaryOperation
  72. absolute: _MaskedUnaryOperation
  73. fabs: _MaskedUnaryOperation
  74. negative: _MaskedUnaryOperation
  75. floor: _MaskedUnaryOperation
  76. ceil: _MaskedUnaryOperation
  77. around: _MaskedUnaryOperation
  78. logical_not: _MaskedUnaryOperation
  79. sqrt: _MaskedUnaryOperation
  80. log: _MaskedUnaryOperation
  81. log2: _MaskedUnaryOperation
  82. log10: _MaskedUnaryOperation
  83. tan: _MaskedUnaryOperation
  84. arcsin: _MaskedUnaryOperation
  85. arccos: _MaskedUnaryOperation
  86. arccosh: _MaskedUnaryOperation
  87. arctanh: _MaskedUnaryOperation
  88. add: _MaskedBinaryOperation
  89. subtract: _MaskedBinaryOperation
  90. multiply: _MaskedBinaryOperation
  91. arctan2: _MaskedBinaryOperation
  92. equal: _MaskedBinaryOperation
  93. not_equal: _MaskedBinaryOperation
  94. less_equal: _MaskedBinaryOperation
  95. greater_equal: _MaskedBinaryOperation
  96. less: _MaskedBinaryOperation
  97. greater: _MaskedBinaryOperation
  98. logical_and: _MaskedBinaryOperation
  99. alltrue: _MaskedBinaryOperation
  100. logical_or: _MaskedBinaryOperation
  101. sometrue: Callable[..., Any]
  102. logical_xor: _MaskedBinaryOperation
  103. bitwise_and: _MaskedBinaryOperation
  104. bitwise_or: _MaskedBinaryOperation
  105. bitwise_xor: _MaskedBinaryOperation
  106. hypot: _MaskedBinaryOperation
  107. divide: _MaskedBinaryOperation
  108. true_divide: _MaskedBinaryOperation
  109. floor_divide: _MaskedBinaryOperation
  110. remainder: _MaskedBinaryOperation
  111. fmod: _MaskedBinaryOperation
  112. mod: _MaskedBinaryOperation
  113. def make_mask_descr(ndtype): ...
  114. def getmask(a): ...
  115. get_mask = getmask
  116. def getmaskarray(arr): ...
  117. def is_mask(m): ...
  118. def make_mask(m, copy=..., shrink=..., dtype=...): ...
  119. def make_mask_none(newshape, dtype=...): ...
  120. def mask_or(m1, m2, copy=..., shrink=...): ...
  121. def flatten_mask(mask): ...
  122. def masked_where(condition, a, copy=...): ...
  123. def masked_greater(x, value, copy=...): ...
  124. def masked_greater_equal(x, value, copy=...): ...
  125. def masked_less(x, value, copy=...): ...
  126. def masked_less_equal(x, value, copy=...): ...
  127. def masked_not_equal(x, value, copy=...): ...
  128. def masked_equal(x, value, copy=...): ...
  129. def masked_inside(x, v1, v2, copy=...): ...
  130. def masked_outside(x, v1, v2, copy=...): ...
  131. def masked_object(x, value, copy=..., shrink=...): ...
  132. def masked_values(x, value, rtol=..., atol=..., copy=..., shrink=...): ...
  133. def masked_invalid(a, copy=...): ...
  134. class _MaskedPrintOption:
  135. def __init__(self, display): ...
  136. def display(self): ...
  137. def set_display(self, s): ...
  138. def enabled(self): ...
  139. def enable(self, shrink=...): ...
  140. masked_print_option: _MaskedPrintOption
  141. def flatten_structured_array(a): ...
  142. class MaskedIterator:
  143. ma: Any
  144. dataiter: Any
  145. maskiter: Any
  146. def __init__(self, ma): ...
  147. def __iter__(self): ...
  148. def __getitem__(self, indx): ...
  149. def __setitem__(self, index, value): ...
  150. def __next__(self): ...
  151. class MaskedArray(ndarray[_ShapeType, _DType_co]):
  152. __array_priority__: Any
  153. def __new__(cls, data=..., mask=..., dtype=..., copy=..., subok=..., ndmin=..., fill_value=..., keep_mask=..., hard_mask=..., shrink=..., order=...): ...
  154. def __array_finalize__(self, obj): ...
  155. def __array_wrap__(self, obj, context=...): ...
  156. def view(self, dtype=..., type=..., fill_value=...): ...
  157. def __getitem__(self, indx): ...
  158. def __setitem__(self, indx, value): ...
  159. @property
  160. def dtype(self): ...
  161. @dtype.setter
  162. def dtype(self, dtype): ...
  163. @property
  164. def shape(self): ...
  165. @shape.setter
  166. def shape(self, shape): ...
  167. def __setmask__(self, mask, copy=...): ...
  168. @property
  169. def mask(self): ...
  170. @mask.setter
  171. def mask(self, value): ...
  172. @property
  173. def recordmask(self): ...
  174. @recordmask.setter
  175. def recordmask(self, mask): ...
  176. def harden_mask(self): ...
  177. def soften_mask(self): ...
  178. @property
  179. def hardmask(self): ...
  180. def unshare_mask(self): ...
  181. @property
  182. def sharedmask(self): ...
  183. def shrink_mask(self): ...
  184. @property
  185. def baseclass(self): ...
  186. data: Any
  187. @property
  188. def flat(self): ...
  189. @flat.setter
  190. def flat(self, value): ...
  191. @property
  192. def fill_value(self): ...
  193. @fill_value.setter
  194. def fill_value(self, value=...): ...
  195. get_fill_value: Any
  196. set_fill_value: Any
  197. def filled(self, fill_value=...): ...
  198. def compressed(self): ...
  199. def compress(self, condition, axis=..., out=...): ...
  200. def __eq__(self, other): ...
  201. def __ne__(self, other): ...
  202. def __ge__(self, other): ...
  203. def __gt__(self, other): ...
  204. def __le__(self, other): ...
  205. def __lt__(self, other): ...
  206. def __add__(self, other): ...
  207. def __radd__(self, other): ...
  208. def __sub__(self, other): ...
  209. def __rsub__(self, other): ...
  210. def __mul__(self, other): ...
  211. def __rmul__(self, other): ...
  212. def __div__(self, other): ...
  213. def __truediv__(self, other): ...
  214. def __rtruediv__(self, other): ...
  215. def __floordiv__(self, other): ...
  216. def __rfloordiv__(self, other): ...
  217. def __pow__(self, other): ...
  218. def __rpow__(self, other): ...
  219. def __iadd__(self, other): ...
  220. def __isub__(self, other): ...
  221. def __imul__(self, other): ...
  222. def __idiv__(self, other): ...
  223. def __ifloordiv__(self, other): ...
  224. def __itruediv__(self, other): ...
  225. def __ipow__(self, other): ...
  226. def __float__(self): ...
  227. def __int__(self): ...
  228. @property # type: ignore[misc]
  229. def imag(self): ...
  230. get_imag: Any
  231. @property # type: ignore[misc]
  232. def real(self): ...
  233. get_real: Any
  234. def count(self, axis=..., keepdims=...): ...
  235. def ravel(self, order=...): ...
  236. def reshape(self, *s, **kwargs): ...
  237. def resize(self, newshape, refcheck=..., order=...): ...
  238. def put(self, indices, values, mode=...): ...
  239. def ids(self): ...
  240. def iscontiguous(self): ...
  241. def all(self, axis=..., out=..., keepdims=...): ...
  242. def any(self, axis=..., out=..., keepdims=...): ...
  243. def nonzero(self): ...
  244. def trace(self, offset=..., axis1=..., axis2=..., dtype=..., out=...): ...
  245. def dot(self, b, out=..., strict=...): ...
  246. def sum(self, axis=..., dtype=..., out=..., keepdims=...): ...
  247. def cumsum(self, axis=..., dtype=..., out=...): ...
  248. def prod(self, axis=..., dtype=..., out=..., keepdims=...): ...
  249. product: Any
  250. def cumprod(self, axis=..., dtype=..., out=...): ...
  251. def mean(self, axis=..., dtype=..., out=..., keepdims=...): ...
  252. def anom(self, axis=..., dtype=...): ...
  253. def var(self, axis=..., dtype=..., out=..., ddof=..., keepdims=...): ...
  254. def std(self, axis=..., dtype=..., out=..., ddof=..., keepdims=...): ...
  255. def round(self, decimals=..., out=...): ...
  256. def argsort(self, axis=..., kind=..., order=..., endwith=..., fill_value=...): ...
  257. def argmin(self, axis=..., fill_value=..., out=..., *, keepdims=...): ...
  258. def argmax(self, axis=..., fill_value=..., out=..., *, keepdims=...): ...
  259. def sort(self, axis=..., kind=..., order=..., endwith=..., fill_value=...): ...
  260. def min(self, axis=..., out=..., fill_value=..., keepdims=...): ...
  261. # NOTE: deprecated
  262. # def tostring(self, fill_value=..., order=...): ...
  263. def max(self, axis=..., out=..., fill_value=..., keepdims=...): ...
  264. def ptp(self, axis=..., out=..., fill_value=..., keepdims=...): ...
  265. def partition(self, *args, **kwargs): ...
  266. def argpartition(self, *args, **kwargs): ...
  267. def take(self, indices, axis=..., out=..., mode=...): ...
  268. copy: Any
  269. diagonal: Any
  270. flatten: Any
  271. repeat: Any
  272. squeeze: Any
  273. swapaxes: Any
  274. T: Any
  275. transpose: Any
  276. def tolist(self, fill_value=...): ...
  277. def tobytes(self, fill_value=..., order=...): ...
  278. def tofile(self, fid, sep=..., format=...): ...
  279. def toflex(self): ...
  280. torecords: Any
  281. def __reduce__(self): ...
  282. def __deepcopy__(self, memo=...): ...
  283. class mvoid(MaskedArray[_ShapeType, _DType_co]):
  284. def __new__(
  285. self,
  286. data,
  287. mask=...,
  288. dtype=...,
  289. fill_value=...,
  290. hardmask=...,
  291. copy=...,
  292. subok=...,
  293. ): ...
  294. def __getitem__(self, indx): ...
  295. def __setitem__(self, indx, value): ...
  296. def __iter__(self): ...
  297. def __len__(self): ...
  298. def filled(self, fill_value=...): ...
  299. def tolist(self): ...
  300. def isMaskedArray(x): ...
  301. isarray = isMaskedArray
  302. isMA = isMaskedArray
  303. # 0D float64 array
  304. class MaskedConstant(MaskedArray[Any, dtype[float64]]):
  305. def __new__(cls): ...
  306. __class__: Any
  307. def __array_finalize__(self, obj): ...
  308. def __array_prepare__(self, obj, context=...): ...
  309. def __array_wrap__(self, obj, context=...): ...
  310. def __format__(self, format_spec): ...
  311. def __reduce__(self): ...
  312. def __iop__(self, other): ...
  313. __iadd__: Any
  314. __isub__: Any
  315. __imul__: Any
  316. __ifloordiv__: Any
  317. __itruediv__: Any
  318. __ipow__: Any
  319. def copy(self, *args, **kwargs): ...
  320. def __copy__(self): ...
  321. def __deepcopy__(self, memo): ...
  322. def __setattr__(self, attr, value): ...
  323. masked: MaskedConstant
  324. masked_singleton: MaskedConstant
  325. masked_array = MaskedArray
  326. def array(
  327. data,
  328. dtype=...,
  329. copy=...,
  330. order=...,
  331. mask=...,
  332. fill_value=...,
  333. keep_mask=...,
  334. hard_mask=...,
  335. shrink=...,
  336. subok=...,
  337. ndmin=...,
  338. ): ...
  339. def is_masked(x): ...
  340. class _extrema_operation(_MaskedUFunc):
  341. compare: Any
  342. fill_value_func: Any
  343. def __init__(self, ufunc, compare, fill_value): ...
  344. # NOTE: in practice `b` has a default value, but users should
  345. # explicitly provide a value here as the default is deprecated
  346. def __call__(self, a, b): ...
  347. def reduce(self, target, axis=...): ...
  348. def outer(self, a, b): ...
  349. def min(obj, axis=..., out=..., fill_value=..., keepdims=...): ...
  350. def max(obj, axis=..., out=..., fill_value=..., keepdims=...): ...
  351. def ptp(obj, axis=..., out=..., fill_value=..., keepdims=...): ...
  352. class _frommethod:
  353. __name__: Any
  354. __doc__: Any
  355. reversed: Any
  356. def __init__(self, methodname, reversed=...): ...
  357. def getdoc(self): ...
  358. def __call__(self, a, *args, **params): ...
  359. all: _frommethod
  360. anomalies: _frommethod
  361. anom: _frommethod
  362. any: _frommethod
  363. compress: _frommethod
  364. cumprod: _frommethod
  365. cumsum: _frommethod
  366. copy: _frommethod
  367. diagonal: _frommethod
  368. harden_mask: _frommethod
  369. ids: _frommethod
  370. mean: _frommethod
  371. nonzero: _frommethod
  372. prod: _frommethod
  373. product: _frommethod
  374. ravel: _frommethod
  375. repeat: _frommethod
  376. soften_mask: _frommethod
  377. std: _frommethod
  378. sum: _frommethod
  379. swapaxes: _frommethod
  380. trace: _frommethod
  381. var: _frommethod
  382. count: _frommethod
  383. argmin: _frommethod
  384. argmax: _frommethod
  385. minimum: _extrema_operation
  386. maximum: _extrema_operation
  387. def take(a, indices, axis=..., out=..., mode=...): ...
  388. def power(a, b, third=...): ...
  389. def argsort(a, axis=..., kind=..., order=..., endwith=..., fill_value=...): ...
  390. def sort(a, axis=..., kind=..., order=..., endwith=..., fill_value=...): ...
  391. def compressed(x): ...
  392. def concatenate(arrays, axis=...): ...
  393. def diag(v, k=...): ...
  394. def left_shift(a, n): ...
  395. def right_shift(a, n): ...
  396. def put(a, indices, values, mode=...): ...
  397. def putmask(a, mask, values): ...
  398. def transpose(a, axes=...): ...
  399. def reshape(a, new_shape, order=...): ...
  400. def resize(x, new_shape): ...
  401. def ndim(obj): ...
  402. def shape(obj): ...
  403. def size(obj, axis=...): ...
  404. def where(condition, x=..., y=...): ...
  405. def choose(indices, choices, out=..., mode=...): ...
  406. def round_(a, decimals=..., out=...): ...
  407. round = round_
  408. def inner(a, b): ...
  409. innerproduct = inner
  410. def outer(a, b): ...
  411. outerproduct = outer
  412. def correlate(a, v, mode=..., propagate_mask=...): ...
  413. def convolve(a, v, mode=..., propagate_mask=...): ...
  414. def allequal(a, b, fill_value=...): ...
  415. def allclose(a, b, masked_equal=..., rtol=..., atol=...): ...
  416. def asarray(a, dtype=..., order=...): ...
  417. def asanyarray(a, dtype=...): ...
  418. def fromflex(fxarray): ...
  419. class _convert2ma:
  420. __doc__: Any
  421. def __init__(self, funcname, params=...): ...
  422. def getdoc(self): ...
  423. def __call__(self, *args, **params): ...
  424. arange: _convert2ma
  425. empty: _convert2ma
  426. empty_like: _convert2ma
  427. frombuffer: _convert2ma
  428. fromfunction: _convert2ma
  429. identity: _convert2ma
  430. ones: _convert2ma
  431. zeros: _convert2ma
  432. def append(a, b, axis=...): ...
  433. def dot(a, b, strict=..., out=...): ...
  434. def mask_rowcols(a, axis=...): ...