Skip to content

Commit 72f500d

Browse files
Merge pull request #11257 from jorisvandenbossche/doc-hacks
DOC: some hacks to get rid of warnings
2 parents 576cbfb + 70c9d31 commit 72f500d

File tree

3 files changed

+18
-7
lines changed

3 files changed

+18
-7
lines changed

doc/source/api.rst

+5-1
Original file line numberDiff line numberDiff line change
@@ -611,7 +611,7 @@ strings and apply several methods to it. These can be acccessed like
611611

612612
..
613613
The following is needed to ensure the generated pages are created with the
614-
correct template (otherwise they would be created in the Series class page)
614+
correct template (otherwise they would be created in the Series/Index class page)
615615
616616
..
617617
.. autosummary::
@@ -621,6 +621,10 @@ strings and apply several methods to it. These can be acccessed like
621621
Series.str
622622
Series.cat
623623
Series.dt
624+
Index.str
625+
CategoricalIndex.str
626+
DatetimeIndex.str
627+
TimedeltaIndex.str
624628

625629

626630
.. _api.categorical:

doc/sphinxext/numpydoc/docscrape_sphinx.py

+9-6
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ def __init__(self, docstring, config={}):
1919
def load_config(self, config):
2020
self.use_plots = config.get('use_plots', False)
2121
self.class_members_toctree = config.get('class_members_toctree', True)
22+
self.class_members_list = config.get('class_members_list', True)
2223

2324
# string conversion routines
2425
def _str_header(self, name, symbol='`'):
@@ -95,7 +96,7 @@ def _str_member_list(self, name):
9596
9697
"""
9798
out = []
98-
if self[name]:
99+
if self[name] and self.class_members_list:
99100
out += ['.. rubric:: %s' % name, '']
100101
prefix = getattr(self, '_name', '')
101102

@@ -114,11 +115,13 @@ def _str_member_list(self, name):
114115
or inspect.isgetsetdescriptor(param_obj)):
115116
param_obj = None
116117

117-
if param_obj and (pydoc.getdoc(param_obj) or not desc):
118-
# Referenced object has a docstring
119-
autosum += [" %s%s" % (prefix, param)]
120-
else:
121-
others.append((param, param_type, desc))
118+
# pandas HACK - do not exclude attributes wich are None
119+
# if param_obj and (pydoc.getdoc(param_obj) or not desc):
120+
# # Referenced object has a docstring
121+
# autosum += [" %s%s" % (prefix, param)]
122+
# else:
123+
# others.append((param, param_type, desc))
124+
autosum += [" %s%s" % (prefix, param)]
122125

123126
if autosum:
124127
out += ['.. autosummary::']

doc/sphinxext/numpydoc/numpydoc.py

+4
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@ def mangle_docstrings(app, what, name, obj, options, lines,
4242
class_members_toctree=app.config.numpydoc_class_members_toctree,
4343
)
4444

45+
# PANDAS HACK (to remove the list of methods/attributes for Categorical)
46+
if what == "class" and name.endswith(".Categorical"):
47+
cfg['class_members_list'] = False
48+
4549
if what == 'module':
4650
# Strip top title
4751
title_re = re.compile(sixu('^\\s*[#*=]{4,}\\n[a-z0-9 -]+\\n[#*=]{4,}\\s*'),

0 commit comments

Comments
 (0)