Skip to content

Commit

Permalink
DOC: hack to numpydoc to avoid warnings for Categorical (not includin…
Browse files Browse the repository at this point in the history
…g members)

The Categorical docstring in api.rst uses a seperate template to not
include an autosummary table with toctrees of all members. But
numpydoc still includes a list by default (which will gives thousands of
warnings). This hack ensures that for Categorical class docstring this
list is not included.
  • Loading branch information
jorisvandenbossche committed Oct 7, 2015
1 parent e8339f7 commit cf40991
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 2 additions & 1 deletion doc/sphinxext/numpydoc/docscrape_sphinx.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ def __init__(self, docstring, config={}):
def load_config(self, config):
self.use_plots = config.get('use_plots', False)
self.class_members_toctree = config.get('class_members_toctree', True)
self.class_members_list = config.get('class_members_list', True)

# string conversion routines
def _str_header(self, name, symbol='`'):
Expand Down Expand Up @@ -95,7 +96,7 @@ def _str_member_list(self, name):
"""
out = []
if self[name]:
if self[name] and self.class_members_list:
out += ['.. rubric:: %s' % name, '']
prefix = getattr(self, '_name', '')

Expand Down
4 changes: 4 additions & 0 deletions doc/sphinxext/numpydoc/numpydoc.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ def mangle_docstrings(app, what, name, obj, options, lines,
class_members_toctree=app.config.numpydoc_class_members_toctree,
)

# PANDAS HACK (to remove the list of methods/attributes for Categorical)
if what == "class" and name.endswith(".Categorical"):
cfg['class_members_list'] = False

if what == 'module':
# Strip top title
title_re = re.compile(sixu('^\\s*[#*=]{4,}\\n[a-z0-9 -]+\\n[#*=]{4,}\\s*'),
Expand Down

0 comments on commit cf40991

Please sign in to comment.