From d3a6abe4689ece564c9ce91ba96699f2f48db2db Mon Sep 17 00:00:00 2001 From: Antony Lee Date: Thu, 8 Aug 2019 11:08:42 +0200 Subject: [PATCH] Provide signatures to some C-level classes and methods. Compare e.g. an excerpt of the docs of matplotlib._tri.Triangulation before ``` | calculate_plane_coefficients(...) | calculate_plane_coefficients(z, plane_coefficients) | | Calculate plane equation coefficients for all unmasked triangles | | get_edges(...) | get_edges() | | Return edges array ``` and after ``` | calculate_plane_coefficients(z, plane_coefficients) | Calculate plane equation coefficients for all unmasked triangles | | get_edges() | Return edges array ``` The convention of using "func_name(arg, ...)--\n\n" for C-level signatures is admittedly undocumented, but comes from https://bugs.python.org/issue20530. --- src/_contour_wrapper.cpp | 6 +++--- src/tri/_tri_wrapper.cpp | 14 +++++++------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/_contour_wrapper.cpp b/src/_contour_wrapper.cpp index 6464a3748daf..687123e8f918 100644 --- a/src/_contour_wrapper.cpp +++ b/src/_contour_wrapper.cpp @@ -23,7 +23,7 @@ static PyObject* PyQuadContourGenerator_new(PyTypeObject* type, PyObject* args, const char* PyQuadContourGenerator_init__doc__ = "QuadContourGenerator(x, y, z, mask, corner_mask, chunk_size)\n" - "\n" + "--\n\n" "Create a new C++ QuadContourGenerator object\n"; static int PyQuadContourGenerator_init(PyQuadContourGenerator* self, PyObject* args, PyObject* kwds) @@ -78,7 +78,7 @@ static void PyQuadContourGenerator_dealloc(PyQuadContourGenerator* self) const char* PyQuadContourGenerator_create_contour__doc__ = "create_contour(level)\n" - "\n" + "--\n\n" "Create and return a non-filled contour."; static PyObject* PyQuadContourGenerator_create_contour(PyQuadContourGenerator* self, PyObject* args, PyObject* kwds) @@ -95,7 +95,7 @@ static PyObject* PyQuadContourGenerator_create_contour(PyQuadContourGenerator* s const char* PyQuadContourGenerator_create_filled_contour__doc__ = "create_filled_contour(lower_level, upper_level)\n" - "\n" + "--\n\n" "Create and return a filled contour"; static PyObject* PyQuadContourGenerator_create_filled_contour(PyQuadContourGenerator* self, PyObject* args, PyObject* kwds) diff --git a/src/tri/_tri_wrapper.cpp b/src/tri/_tri_wrapper.cpp index 8ebbadc80c75..40e054d73515 100644 --- a/src/tri/_tri_wrapper.cpp +++ b/src/tri/_tri_wrapper.cpp @@ -23,7 +23,7 @@ static PyObject* PyTriangulation_new(PyTypeObject* type, PyObject* args, PyObjec const char* PyTriangulation_init__doc__ = "Triangulation(x, y, triangles, mask, edges, neighbors)\n" - "\n" + "--\n\n" "Create a new C++ Triangulation object\n" "This should not be called directly, instead use the python class\n" "matplotlib.tri.Triangulation instead.\n"; @@ -100,7 +100,7 @@ static void PyTriangulation_dealloc(PyTriangulation* self) const char* PyTriangulation_calculate_plane_coefficients__doc__ = "calculate_plane_coefficients(z, plane_coefficients)\n" - "\n" + "--\n\n" "Calculate plane equation coefficients for all unmasked triangles"; static PyObject* PyTriangulation_calculate_plane_coefficients(PyTriangulation* self, PyObject* args, PyObject* kwds) @@ -125,7 +125,7 @@ static PyObject* PyTriangulation_calculate_plane_coefficients(PyTriangulation* s const char* PyTriangulation_get_edges__doc__ = "get_edges()\n" - "\n" + "--\n\n" "Return edges array"; static PyObject* PyTriangulation_get_edges(PyTriangulation* self, PyObject* args, PyObject* kwds) @@ -142,7 +142,7 @@ static PyObject* PyTriangulation_get_edges(PyTriangulation* self, PyObject* args const char* PyTriangulation_get_neighbors__doc__ = "get_neighbors()\n" - "\n" + "--\n\n" "Return neighbors array"; static PyObject* PyTriangulation_get_neighbors(PyTriangulation* self, PyObject* args, PyObject* kwds) @@ -159,7 +159,7 @@ static PyObject* PyTriangulation_get_neighbors(PyTriangulation* self, PyObject* const char* PyTriangulation_set_mask__doc__ = "set_mask(mask)\n" - "\n" + "--\n\n" "Set or clear the mask array."; static PyObject* PyTriangulation_set_mask(PyTriangulation* self, PyObject* args, PyObject* kwds) @@ -234,7 +234,7 @@ static PyObject* PyTriContourGenerator_new(PyTypeObject* type, PyObject* args, P const char* PyTriContourGenerator_init__doc__ = "TriContourGenerator(triangulation, z)\n" - "\n" + "--\n\n" "Create a new C++ TriContourGenerator object\n" "This should not be called directly, instead use the functions\n" "matplotlib.axes.tricontour and tricontourf instead.\n"; @@ -369,7 +369,7 @@ static PyObject* PyTrapezoidMapTriFinder_new(PyTypeObject* type, PyObject* args, const char* PyTrapezoidMapTriFinder_init__doc__ = "TrapezoidMapTriFinder(triangulation)\n" - "\n" + "--\n\n" "Create a new C++ TrapezoidMapTriFinder object\n" "This should not be called directly, instead use the python class\n" "matplotlib.tri.TrapezoidMapTriFinder instead.\n";