Skip to content

DOC: update vendored numpydoc version #20383

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

Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
DOC: change to numpydoc: add option to use member listing for attributes
  • Loading branch information
jorisvandenbossche committed Mar 27, 2018
commit 914c59ff900be8724254ea75a00fbd931e62c062
7 changes: 5 additions & 2 deletions doc/sphinxext/numpydoc/docscrape_sphinx.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ def load_config(self, config):
self.use_plots = config.get('use_plots', False)
self.use_blockquotes = config.get('use_blockquotes', False)
self.class_members_toctree = config.get('class_members_toctree', True)
self.attributes_as_param_list = config.get('attributes_as_param_list', True)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will this ensure that Attributes is formatted like a table?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes (updated the top post). For now, that is the only change I made to the numpydoc source (it's in a separate commit).

But, if I am the only one that finds that better, I am OK to leave that.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, I prefer the attributes table. I just didn't realize there was an option for it.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, there isn't ;-) That's something I added here (but with only a few lines: 075438f), and that's what I proposed to do in numpy/numpydoc#106, so it would be nice to have this in upstream)

self.template = config.get('template', None)
if self.template is None:
template_dirs = [os.path.join(os.path.dirname(__file__), 'templates')]
Expand Down Expand Up @@ -366,8 +367,10 @@ def __str__(self, indent=0, func_role="obj"):
'notes': self._str_section('Notes'),
'references': self._str_references(),
'examples': self._str_examples(),
'attributes': self._str_param_list('Attributes',
fake_autosummary=True),
'attributes':
self._str_param_list('Attributes', fake_autosummary=True)
if self.attributes_as_param_list
else self._str_member_list('Attributes'),
'methods': self._str_member_list('Methods'),
}
ns = dict((k, '\n'.join(v)) for k, v in ns.items())
Expand Down
5 changes: 4 additions & 1 deletion doc/sphinxext/numpydoc/numpydoc.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,9 @@ def mangle_docstrings(app, what, name, obj, options, lines):
'show_class_members': app.config.numpydoc_show_class_members,
'show_inherited_class_members':
app.config.numpydoc_show_inherited_class_members,
'class_members_toctree': app.config.numpydoc_class_members_toctree}
'class_members_toctree': app.config.numpydoc_class_members_toctree,
'attributes_as_param_list':
app.config.numpydoc_attributes_as_param_list}

u_NL = sixu('\n')
if what == 'module':
Expand Down Expand Up @@ -146,6 +148,7 @@ def setup(app, get_doc_object_=get_doc_object):
app.add_config_value('numpydoc_show_inherited_class_members', True, True)
app.add_config_value('numpydoc_class_members_toctree', True, True)
app.add_config_value('numpydoc_citation_re', '[a-z0-9_.-]+', True)
app.add_config_value('numpydoc_attributes_as_param_list', True, True)

# Extra mangling domains
app.add_domain(NumpyPythonDomain)
Expand Down