From: Vladimír Vondruš Date: Wed, 5 Jan 2022 21:43:06 +0000 (+0100) Subject: documentation/python: try breaking the pybind11 docstring parser. X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~cjwatson/git?a=commitdiff_plain;h=d3003a7cb7b546a3b2d610538a70a21046995855;p=blog.git documentation/python: try breaking the pybind11 docstring parser. Yeah, not really great. --- diff --git a/documentation/test_python/pybind_signatures/pybind_signatures.cpp b/documentation/test_python/pybind_signatures/pybind_signatures.cpp index 1298708d..bc8c9c34 100644 --- a/documentation/test_python/pybind_signatures/pybind_signatures.cpp +++ b/documentation/test_python/pybind_signatures/pybind_signatures.cpp @@ -79,7 +79,17 @@ PYBIND11_MODULE(pybind_signatures, m) { .def("full_docstring", &voidFunction, R"(A summary -And a larger docstring as well.)"); +And a larger docstring as well.)") + .def("full_docstring_overloaded", &tenOverloads, R"(An overload summary + +This function takes a value of 2. full_docstring_overloaded(a: float, b: float) +takes just 3 instead.)") + .def("full_docstring_overloaded", &tenOverloads, R"(Another overload summary + +This overload, however, takes just a 32-bit (or 64-bit) floating point value of +3. full_docstring_overloaded(a: int, b: int) +takes just 2. There's nothing for 4. full_docstring_overloaded(a: poo, b: foo) +could be another, but it's not added yet.)"); py::class_(m, "MyClass", "My fun class!") .def_static("static_function", &MyClass::staticFunction, "Static method with positional-only args") diff --git a/documentation/test_python/pybind_signatures/pybind_signatures.html b/documentation/test_python/pybind_signatures/pybind_signatures.html index b4095cdc..687d6b00 100644 --- a/documentation/test_python/pybind_signatures/pybind_signatures.html +++ b/documentation/test_python/pybind_signatures/pybind_signatures.html @@ -67,6 +67,16 @@ def full_docstring(arg0: int, /) -> None
A summary
+
+ def full_docstring_overloaded(arg0: int, + arg1: int, /) -> None +
+
An overload summary
+
+ def full_docstring_overloaded(arg0: float, + arg1: float, /) -> None +
+
Another overload summary
def overloaded(arg0: int, /) -> str
@@ -162,6 +172,26 @@

A summary

And a larger docstring as well.

+
+

+ def pybind_signatures.full_docstring_overloaded(arg0: int, + arg1: int, /) -> None +

+

An overload summary

+

This function takes a value of 2. full_docstring_overloaded(a: float, b: float) +takes just 3 instead.

+
+
+

+ def pybind_signatures.full_docstring_overloaded(arg0: float, + arg1: float, /) -> None +

+

Another overload summary

+

This overload, however, takes just a 32-bit (or 64-bit) floating point value of +3. full_docstring_overloaded(a: int, b: int) +takes just 2. There's nothing for 4. full_docstring_overloaded(a: poo, b: foo) +could be another, but it's not added yet.

+