Skip to content

Commit 8f7ebda

Browse files
committed
(Cleanup of PyArrayDescr method docstrings)
1 parent 56e6f6f commit 8f7ebda

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

src/dtype.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ impl PyArrayDescr {
118118
unsafe { *self.as_dtype_ptr() }.elsize.max(0) as _
119119
}
120120

121-
/// Returns the required alignment (bytes) of this data-type according to the compiler
121+
/// Returns the required alignment (bytes) of this data-type according to the compiler.
122122
///
123123
/// Equivalent to [`np.dtype.alignment`](https://numpy.org/doc/stable/reference/generated/numpy.dtype.alignment.html).
124124
pub fn alignment(&self) -> usize {
@@ -138,7 +138,7 @@ impl PyArrayDescr {
138138
///
139139
/// Note: structured data types are categorized as `V` (void).
140140
///
141-
/// Equivalent to [`np.dtype.char`](https://numpy.org/doc/stable/reference/generated/numpy.dtype.char.html)
141+
/// Equivalent to [`np.dtype.char`](https://numpy.org/doc/stable/reference/generated/numpy.dtype.char.html).
142142
pub fn char(&self) -> u8 {
143143
unsafe { *self.as_dtype_ptr() }.type_.max(0) as _
144144
}
@@ -147,21 +147,21 @@ impl PyArrayDescr {
147147
///
148148
/// Note: structured data types are categorized as `V` (void).
149149
///
150-
/// Equivalent to [`np.dtype.kind`](https://numpy.org/doc/stable/reference/generated/numpy.dtype.kind.html)
150+
/// Equivalent to [`np.dtype.kind`](https://numpy.org/doc/stable/reference/generated/numpy.dtype.kind.html).
151151
pub fn kind(&self) -> u8 {
152152
unsafe { *self.as_dtype_ptr() }.kind.max(0) as _
153153
}
154154

155155
/// Returns bit-flags describing how this data type is to be interpreted.
156156
///
157-
/// Equivalent to [`np.dtype.flags`](https://numpy.org/doc/stable/reference/generated/numpy.dtype.flags.html)
157+
/// Equivalent to [`np.dtype.flags`](https://numpy.org/doc/stable/reference/generated/numpy.dtype.flags.html).
158158
pub fn flags(&self) -> c_char {
159159
unsafe { *self.as_dtype_ptr() }.flags
160160
}
161161

162162
/// Returns the number of dimensions if this data type describes a sub-array, and `0` otherwise.
163163
///
164-
/// Equivalent to [`np.dtype.ndim`](https://numpy.org/doc/stable/reference/generated/numpy.dtype.ndim.html)
164+
/// Equivalent to [`np.dtype.ndim`](https://numpy.org/doc/stable/reference/generated/numpy.dtype.ndim.html).
165165
pub fn ndim(&self) -> usize {
166166
if !self.has_subarray() {
167167
return 0;
@@ -181,7 +181,7 @@ impl PyArrayDescr {
181181

182182
/// Returns shape tuple of the sub-array if this dtype is a sub-array, and `None` otherwise.
183183
///
184-
/// Equivalent to [`np.dtype.shape`](https://numpy.org/doc/stable/reference/generated/numpy.dtype.shape.html)
184+
/// Equivalent to [`np.dtype.shape`](https://numpy.org/doc/stable/reference/generated/numpy.dtype.shape.html).
185185
pub fn shape(&self) -> Option<Vec<usize>> {
186186
if !self.has_subarray() {
187187
return None;
@@ -204,15 +204,15 @@ impl PyArrayDescr {
204204
/// If a field whose dtype object has this attribute is retrieved, then the extra dimensions
205205
/// implied by shape are tacked on to the end of the retrieved array.
206206
///
207-
/// Equivalent to [`np.dtype.subdtype`](https://numpy.org/doc/stable/reference/generated/numpy.dtype.subdtype.html)
207+
/// Equivalent to [`np.dtype.subdtype`](https://numpy.org/doc/stable/reference/generated/numpy.dtype.subdtype.html).
208208
pub fn subdtype(&self) -> Option<(&PyArrayDescr, Vec<usize>)> {
209209
self.shape()
210210
.and_then(|shape| self.base().map(|base| (base, shape)))
211211
}
212212

213213
/// Returns true if the dtype is a sub-array at the top level.
214214
///
215-
/// Equivalent to [`np.dtype.hasobject`](https://numpy.org/doc/stable/reference/generated/numpy.dtype.hasobject.html)
215+
/// Equivalent to [`np.dtype.hasobject`](https://numpy.org/doc/stable/reference/generated/numpy.dtype.hasobject.html).
216216
pub fn has_object(&self) -> bool {
217217
self.flags() & NPY_ITEM_HASOBJECT != 0
218218
}
@@ -222,7 +222,7 @@ impl PyArrayDescr {
222222
/// This flag is sticky, so when combining multiple structs together, it is preserved
223223
/// and produces new dtypes which are also aligned.
224224
///
225-
/// Equivalent to [`np.dtype.isalignedstruct`](https://numpy.org/doc/stable/reference/generated/numpy.dtype.isalignedstruct.html)
225+
/// Equivalent to [`np.dtype.isalignedstruct`](https://numpy.org/doc/stable/reference/generated/numpy.dtype.isalignedstruct.html).
226226
pub fn is_aligned_struct(&self) -> bool {
227227
self.flags() & NPY_ALIGNED_STRUCT != 0
228228
}
@@ -239,7 +239,7 @@ impl PyArrayDescr {
239239
unsafe { !(*self.as_dtype_ptr()).names.is_null() }
240240
}
241241

242-
/// Returns true if the data type is unsized
242+
/// Returns true if the data type is unsized.
243243
pub fn is_unsized(&self) -> bool {
244244
// equivalent to PyDataType_ISUNSIZED(self)
245245
self.itemsize() == 0 && !self.has_fields()

0 commit comments

Comments
 (0)