Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Added sphinx documentation for Triangulation #1494

Merged
merged 1 commit into from Nov 15, 2012

Conversation

Projects
None yet
3 participants
Member

ianthomas23 commented Nov 13, 2012

Class matplotlib.tri.Triangulation was not in the sphinx documentation. This PR adds a page to the API documentation containing the class.

Member

dmcdougall commented Nov 14, 2012

+1

@pelson pelson commented on the diff Nov 14, 2012

lib/matplotlib/tri/triangulation.py
@@ -37,27 +37,6 @@ class Triangulation(object):
triangles[i,(j+1)%3].
"""
def __init__(self, x, y, triangles=None, mask=None):
- """
- Create a Triangulation object.
@pelson

pelson Nov 14, 2012

Member

This seems quite a useful docstring? Is it out of date?

@ianthomas23

ianthomas23 Nov 14, 2012

Member

No, it is still valid. I discovered that sphinx chains together the class and constructor docstrings under the constructor heading. If they are sufficiently different we get away with it (as in the Path class at http://matplotlib.org/api/path_api.html - the constructor docstring begins after the Note), but in this case everything in the constructor docstring is already in the class docstring causing unnecessarily duplication. I thought the best solution was to remove the constructor docstring.

@dmcdougall

dmcdougall Nov 14, 2012

Member

Good spot.

Member

pelson commented Nov 14, 2012

I noticed this the other day too - thanks @ianthomas23 !

@ianthomas23 ianthomas23 commented on the diff Nov 14, 2012

lib/matplotlib/tri/triangulation.py
@@ -106,10 +85,8 @@ def edges(self):
return self._edges
def get_cpp_triangulation(self):
- """
- Return the underlying C++ Triangulation object, creating it
- if necessary.
- """
+ # Return the underlying C++ Triangulation object, creating it
@ianthomas23

ianthomas23 Nov 14, 2012

Member

Note I have changed this function's docstring to a comment as I don't want the function appearing in the sphinx documentation. The function should really be private with a leading underscore, but as this is a documentation PR I didn't want to change any code that would require new testing. I have made a note to address this when I am next altering the class.

Member

dmcdougall commented Nov 14, 2012

@ianthomas23 Do you consider this good to go?

Member

ianthomas23 commented Nov 15, 2012

@dmcdougall: Yes, it is good to go.

Member

pelson commented Nov 15, 2012

👍 from me.

dmcdougall added a commit that referenced this pull request Nov 15, 2012

Merge pull request #1494 from ianthomas23/sphinx_triangulation
Added sphinx documentation for Triangulation

@dmcdougall dmcdougall merged commit 39b5c7b into matplotlib:master Nov 15, 2012

1 check passed

default The Travis build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment