summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBas van Beek <b.f.van.beek@vu.nl>2021-04-23 13:57:22 +0200
committerBas van Beek <b.f.van.beek@vu.nl>2021-04-23 14:21:50 +0200
commit7d79aecb0fe5a9ef1465f8ba46ed2dd3394bf90d (patch)
tree6dec35df97b10ffc74e6113063371bbce6ad0fcb
parent02555acfa39aad2802e98b5cd440d111279c5648 (diff)
downloadnumpy-7d79aecb0fe5a9ef1465f8ba46ed2dd3394bf90d.tar.gz
ENH: Add improved placeholder annotations for `np.rec`
-rw-r--r--numpy/__init__.pyi12
-rw-r--r--numpy/rec.pyi71
2 files changed, 71 insertions, 12 deletions
diff --git a/numpy/__init__.pyi b/numpy/__init__.pyi
index 4b93ce0f3..b0cfa6a0a 100644
--- a/numpy/__init__.pyi
+++ b/numpy/__init__.pyi
@@ -463,7 +463,6 @@ class format_parser:
aligned: Any = ...,
byteorder: Any = ...,
) -> None: ...
- def __getattr__(self, key: str) -> Any: ...
class iinfo:
def __init__(self, int_type: Any) -> None: ...
@@ -530,10 +529,17 @@ class recarray(ndarray[_ShapeType, _DType_co]):
aligned: Any = ...,
order: Any = ...,
) -> Any: ...
- def __getattr__(self, key: str) -> Any: ...
+ def __array_finalize__(self, obj): ...
+ def __getattribute__(self, attr): ...
+ def __setattr__(self, attr, val): ...
+ def __getitem__(self, indx): ...
+ def field(self, attr, val=...): ...
class record(void):
- def __getattr__(self, key: str) -> Any: ...
+ def __getattribute__(self, attr): ...
+ def __setattr__(self, attr, val): ...
+ def __getitem__(self, indx): ...
+ def pprint(self): ...
class vectorize:
def __init__(
diff --git a/numpy/rec.pyi b/numpy/rec.pyi
index 883e2dd5b..198636058 100644
--- a/numpy/rec.pyi
+++ b/numpy/rec.pyi
@@ -1,12 +1,65 @@
-from typing import Any, List
+from typing import List
+
+from numpy import (
+ format_parser as format_parser,
+ record as record,
+ recarray as recarray,
+)
__all__: List[str]
-record: Any
-recarray: Any
-format_parser: Any
-fromarrays: Any
-fromrecords: Any
-fromstring: Any
-fromfile: Any
-array: Any
+def fromarrays(
+ arrayList,
+ dtype=...,
+ shape=...,
+ formats=...,
+ names=...,
+ titles=...,
+ aligned=...,
+ byteorder=...,
+): ...
+def fromrecords(
+ recList,
+ dtype=...,
+ shape=...,
+ formats=...,
+ names=...,
+ titles=...,
+ aligned=...,
+ byteorder=...,
+): ...
+def fromstring(
+ datastring,
+ dtype=...,
+ shape=...,
+ offset=...,
+ formats=...,
+ names=...,
+ titles=...,
+ aligned=...,
+ byteorder=...,
+): ...
+def fromfile(
+ fd,
+ dtype=...,
+ shape=...,
+ offset=...,
+ formats=...,
+ names=...,
+ titles=...,
+ aligned=...,
+ byteorder=...,
+): ...
+def array(
+ obj,
+ dtype=...,
+ shape=...,
+ offset=...,
+ strides=...,
+ formats=...,
+ names=...,
+ titles=...,
+ aligned=...,
+ byteorder=...,
+ copy=...,
+): ...