Skip to content

Commit

Permalink
style: pre-commit fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
pre-commit-ci[bot] committed Mar 6, 2024
1 parent 0c4b241 commit f1be8f8
Showing 1 changed file with 7 additions and 15 deletions.
22 changes: 7 additions & 15 deletions include/pybind11/numpy.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ struct PyArrayDescr2_Proxy {
PyObject *names;
};


struct PyArray_Proxy {
PyObject_HEAD
char *data;
Expand Down Expand Up @@ -648,8 +647,7 @@ class dtype : public object {
ssize_t itemsize() const {
if (detail::npy_api::get().PyArray_RUNTIME_VERSION_ < 0x12) {
return detail::array_descriptor1_proxy(m_ptr)->elsize;
}
else {
} else {
return detail::array_descriptor2_proxy(m_ptr)->elsize;
}
}
Expand All @@ -658,11 +656,9 @@ class dtype : public object {
bool has_fields() const {
if (detail::npy_api::get().PyArray_RUNTIME_VERSION_ < 0x12) {
return detail::array_descriptor1_proxy(m_ptr)->names != nullptr;
}
else if (num() < 0 || num() > 2000) {
} else if (num() < 0 || num() > 2000) {
return false;
}
else {
} else {
return detail::array_descriptor2_proxy(m_ptr)->names != nullptr;
}
}
Expand Down Expand Up @@ -695,18 +691,16 @@ class dtype : public object {
ssize_t alignment() const {
if (detail::npy_api::get().PyArray_RUNTIME_VERSION_ < 0x12) {
return detail::array_descriptor1_proxy(m_ptr)->alignment;
}
else {
} else {
return detail::array_descriptor2_proxy(m_ptr)->alignment;
}
}

/// Flags for the array descriptor
std::uint64_t flags() const {
if (detail::npy_api::get().PyArray_RUNTIME_VERSION_ < 0x12) {
return (unsigned char)detail::array_descriptor1_proxy(m_ptr)->flags;
}
else {
return (unsigned char) detail::array_descriptor1_proxy(m_ptr)->flags;
} else {
return detail::array_descriptor2_proxy(m_ptr)->flags;
}
}
Expand Down Expand Up @@ -876,9 +870,7 @@ class array : public buffer {
}

/// Byte size of a single element
ssize_t itemsize() const {
return dtype().itemsize();
}
ssize_t itemsize() const { return dtype().itemsize(); }

/// Total number of bytes
ssize_t nbytes() const { return size() * itemsize(); }
Expand Down

0 comments on commit f1be8f8

Please sign in to comment.