Skip to content

Commit 5881f0f

Browse files
Implement PyStubType for PyArrayDescr (#183)
Closes: #182 --------- Co-authored-by: Toshiki Teramura <toshiki.teramura@gmail.com>
1 parent 04e794a commit 5881f0f

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

pyo3-stub-gen/src/stub_type/numpy.rs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
use super::{PyStubType, TypeInfo};
22
use maplit::hashset;
33
use numpy::{
4-
ndarray::Dimension, Element, PyArray, PyReadonlyArray, PyReadwriteArray, PyUntypedArray,
4+
ndarray::Dimension, Element, PyArray, PyArrayDescr, PyReadonlyArray, PyReadwriteArray,
5+
PyUntypedArray,
56
};
67

78
trait NumPyScalar {
@@ -73,3 +74,12 @@ where
7374
PyArray::<T, D>::type_output()
7475
}
7576
}
77+
78+
impl PyStubType for PyArrayDescr {
79+
fn type_output() -> TypeInfo {
80+
TypeInfo {
81+
name: "numpy.dtype".into(),
82+
import: hashset!["numpy".into()],
83+
}
84+
}
85+
}

0 commit comments

Comments
 (0)