Skip to content
New issue

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

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DOC: Use official numpydoc extension #24098

Merged
merged 11 commits into from
Dec 15, 2018
Prev Previous commit
Next Next commit
Update comments to be more descriptive
Signed-off-by: Fabian Haase <haase.fabian@gmail.com>
  • Loading branch information
FHaase committed Dec 5, 2018
commit 7a730342bd30c659f7b207b524e7a9db1a5eec7e
11 changes: 7 additions & 4 deletions doc/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -413,9 +413,10 @@
]


# Modify numpydoc to show Attributes section like Methods section
# PANDAS HACK: Replace attributes param_list by member_list
def alternative_str(self, indent=0, func_role="obj"):
def sphinxdocstring_str(self, indent=0, func_role="obj"):
# Pandas displays Attributes section in style like Methods section

# Function is copy of `SphinxDocString.__str__`
ns = {
'signature': self._str_signature(),
'index': self._str_index(),
Expand All @@ -432,6 +433,8 @@ def alternative_str(self, indent=0, func_role="obj"):
'notes': self._str_section('Notes'),
'references': self._str_references(),
'examples': self._str_examples(),
# Replaced `self._str_param_list('Attributes', fake_autosummary=True)`
# with `self._str_member_list('Attributes')`
'attributes': self._str_member_list('Attributes'),
'methods': self._str_member_list('Methods'),
}
Expand All @@ -441,7 +444,7 @@ def alternative_str(self, indent=0, func_role="obj"):
return '\n'.join(self._str_indent(rendered.split('\n'), indent))


SphinxDocString.__str__ = alternative_str
SphinxDocString.__str__ = sphinxdocstring_str

# Add custom Documenter to handle attributes/methods of an AccessorProperty
# eg pandas.Series.str and pandas.Series.dt (see GH9322)
Expand Down