From b70001f6c03dabe043148bd2e420e97fb06299e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Mon, 24 Apr 2023 18:35:00 +0200 Subject: [PATCH] python: don't be lazy and name container API arguments. --- src/python/corrade/containers.cpp | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/python/corrade/containers.cpp b/src/python/corrade/containers.cpp index a42649c..22d24bd 100644 --- a/src/python/corrade/containers.cpp +++ b/src/python/corrade/containers.cpp @@ -143,7 +143,7 @@ template void arrayView(py::class_, Containers throw py::error_already_set{}; } return self[i]; - }, "Value at given position") + }, "Value at given position", py::arg("i")) /* Slicing */ .def("__getitem__", [](const Containers::ArrayView& self, py::slice slice) -> py::object { @@ -160,7 +160,7 @@ template void arrayView(py::class_, Containers /* Usual business */ auto sliced = self.slice(calculated.start, calculated.stop); return pyCastButNotShitty(Containers::pyArrayViewHolder(sliced, sliced.size() ? pyObjectHolderFor(self).owner : py::none{})); - }, "Slice the view"); + }, "Slice the view", py::arg("slice")); enableBetterBufferProtocol, arrayViewBufferProtocol>(c); } @@ -173,7 +173,7 @@ template void mutableArrayView(py::class_, Con throw py::error_already_set{}; } self[i] = value; - }, "Set a value at given position"); + }, "Set a value at given position", py::arg("i"), py::arg("value")); } /* Tuple for given dimension */ @@ -461,15 +461,15 @@ template void stridedArrayView(py::class_{self.size()}[0]); const auto sliced = self.slice(calculated.start, calculated.stop).every(calculated.step); return Containers::pyArrayViewHolder(sliced, calculated.start == calculated.stop ? py::none{} : pyObjectHolderFor(self).owner); - }, "Slice the view") + }, "Slice the view", py::arg("slice")) /* Fancy operations */ .def("flipped", [](const Containers::PyStridedArrayView& self, const std::size_t dimension) { return Containers::pyArrayViewHolder(StridedOperation::flipped(self, dimension), pyObjectHolderFor(self).owner); - }, "Flip a dimension") + }, "Flip a dimension", py::arg("dimension")) .def("broadcasted", [](const Containers::PyStridedArrayView& self, const std::size_t dimension, std::size_t size) { return Containers::pyArrayViewHolder(StridedOperation::broadcasted(self, dimension, size), pyObjectHolderFor(self).owner); - }, "Broadcast a dimension"); + }, "Broadcast a dimension", py::arg("dimension"), py::arg("size")); enableBetterBufferProtocol, stridedArrayViewBufferProtocol>(c); } @@ -484,7 +484,7 @@ template void stridedArrayView1D(py::class_ void stridedArrayViewND(py::class_, Containers::PyArrayViewHolder>>& c) { @@ -497,7 +497,7 @@ template void stridedArrayViewND(py::class_(self).owner); - }, "Sub-view at given position") + }, "Sub-view at given position", py::arg("i")) .def("__getitem__", [](const Containers::PyStridedArrayView& self, const typename DimensionsTuple::Type& iTuple) { Containers::Size iSize{NoInit}; for(std::size_t j = 0; j != dimensions; ++j) { @@ -509,7 +509,7 @@ template void stridedArrayViewND(py::class_& self, const typename DimensionsTuple::Type& slice) { @@ -529,12 +529,12 @@ template void stridedArrayViewND(py::class_(self).owner); - }, "Slice the view") + }, "Slice the view", py::arg("slice")) /* Fancy operations */ .def("transposed", [](const Containers::PyStridedArrayView& self, const std::size_t a, std::size_t b) { return Containers::pyArrayViewHolder(StridedOperation::transposed(self, a, b), pyObjectHolderFor(self).owner); - }, "Transpose two dimensions"); + }, "Transpose two dimensions", py::arg("a"), py::arg("b")); } void mutableStridedArrayView1D(py::class_, Containers::PyArrayViewHolder>>& c) { @@ -545,7 +545,7 @@ void mutableStridedArrayView1D(py::class_ void mutableStridedArrayViewND(py::class_, Containers::PyArrayViewHolder>>& c) { @@ -561,7 +561,7 @@ template void mutableStridedArrayViewND(py::class_