图片解析应用
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

468 lines
14 KiB

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