Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 50b9e1b

Browse files
committed
Only ignore class methods (no obvious use case for funcs/classes)
1 parent 12b65a5 commit 50b9e1b

File tree

2 files changed

+15
-18
lines changed

2 files changed

+15
-18
lines changed

sphinx_automodapi/automodapi.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,9 @@
5959
6060
* ``:ignore-emptydoc:`` or ``:no-ignore-emptydoc:``
6161
The global sphinx configuration option ``automodsumm_ignore_emptydoc``
62-
decides if functions, classes, and class methods with empty
63-
``__doc__`` attributes are included in the generated documentation. The flags
64-
``:ignore-emptydoc:`` or ``:no-ignore-emptydoc:`` allow the user to override
65-
the global setting.
62+
decides if class methods with empty ``__doc__`` attributes are included
63+
in the generated documentation. The flags ``:ignore-emptydoc:`` or
64+
``:no-ignore-emptydoc:`` allow the user to override the global setting.
6665
6766
6867
This extension also adds four sphinx configuration options:
@@ -333,15 +332,15 @@ def automodapi_replace(sourcestr, app, dotoctree=True, docname=None,
333332
clsfuncoptions.append(':skip: ' + ','.join(toskip))
334333
if allowedpkgnms:
335334
clsfuncoptions.append(allowedpkgnms)
336-
if ignore_emptydoc is True:
337-
clsfuncoptions.append(':ignore-emptydoc:')
338-
if ignore_emptydoc is False:
339-
clsfuncoptions.append(':no-ignore-emptydoc:')
340335
if hascls: # This makes no sense unless there are classes.
341336
if inherited_members is True:
342337
clsfuncoptions.append(':inherited-members:')
343338
if inherited_members is False:
344339
clsfuncoptions.append(':no-inherited-members:')
340+
if ignore_emptydoc is True:
341+
clsfuncoptions.append(':ignore-emptydoc:')
342+
if ignore_emptydoc is False:
343+
clsfuncoptions.append(':no-ignore-emptydoc:')
345344
clsfuncoptionstr = '\n '.join(clsfuncoptions)
346345

347346
if hasfuncs:

sphinx_automodapi/automodsumm.py

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,9 @@
4848
4949
* ``:ignore-emptydoc:`` or ``:no-ignore-emptydoc:``
5050
The global sphinx configuration option ``automodsumm_ignore_emptydoc``
51-
decides if functions, classes, and class methods with empty
52-
``__doc__`` attributes are included in the generated documentation. The flags
53-
``:ignore-emptydoc:`` or ``:no-ignore-emptydoc:`` allows overrriding this
54-
global setting.
51+
decides if class methods with empty ``__doc__`` attributes are included
52+
in the generated documentation. The flags ``:ignore-emptydoc:`` or
53+
``:no-ignore-emptydoc:`` allows overrriding this global setting.
5554
5655
This extension also adds three sphinx configuration options:
5756
@@ -70,11 +69,10 @@ class members that are inherited from a base class. This value can be
7069
``False``.
7170
7271
* ``automodsumm_ignore_emptydoc``
73-
Should be a bool, and if ``True``, will cause `automodsumm`_ to ignore
74-
functions, classes, and class methods with empty ``__doc__`` attributes.
75-
This value can be overridden for any particular automodsumm directive by including
76-
the ``:ignore-emptydoc:`` or ``:no-ignore-emptydoc:`` options. Defaults to
77-
``False``.
72+
Should be a bool, and if ``True``, will cause `automodsumm`_ to ignore class
73+
methods with empty ``__doc__`` attributes. This value can be overridden for any
74+
particular automodsumm directive by including the ``:ignore-emptydoc:`` or
75+
``:no-ignore-emptydoc:`` options. Defaults to ``False``.
7876
7977
.. _sphinx.ext.autosummary: http://sphinx-doc.org/latest/ext/autosummary.html
8078
.. _autosummary: http://sphinx-doc.org/latest/ext/autosummary.html#directive-autosummary
@@ -577,7 +575,7 @@ def get_members_class(obj, typ, include_public=[],
577575
continue
578576
if (
579577
ignore_emptydoc
580-
and documenter.objtype in ('method', 'class', 'function')
578+
and documenter.objtype == 'method'
581579
and not getattr(safe_getattr(obj, name), '__doc__', '')
582580
):
583581
continue

0 commit comments

Comments
 (0)