Skip to content

Commit

Permalink
Move Sphinx customizations to humanfriendly package
Browse files Browse the repository at this point in the history
  • Loading branch information
xolox committed Feb 20, 2016
1 parent b30d545 commit 121a24d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 19 deletions.
20 changes: 1 addition & 19 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
'sphinx.ext.doctest',
'sphinx.ext.intersphinx',
'sphinx.ext.viewcode',
'humanfriendly.sphinx',
]

# Paths that contain templates, relative to this directory.
Expand Down Expand Up @@ -85,22 +86,3 @@

# Sort members by the source order instead of alphabetically.
autodoc_member_order = 'bysource'


def setup(app):
"""Sphinx customizations applied through the API."""
app.connect('autodoc-skip-member', custom_skip_member)


def custom_skip_member(app, what, name, obj, skip, options):
"""Inspired by http://stackoverflow.com/a/5599712/788200."""
if skip and obj.__doc__:
# If Sphinx would skip this object but it concerns a function or method
# that does have documentation we tell Sphinx to reconsider. This
# enables documentation of e.g. __init__(), __str__(), __unicode__(),
# __enter__(), __exit__(), etc. The isinstance() check makes sure we
# don't include things like __doc__, __module__ and __weakref__ in the
# documentation.
return not isinstance(obj, (types.FunctionType, types.MethodType))
else:
return skip
6 changes: 6 additions & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@ The :mod:`executor` module
.. automodule:: executor
:members:

The :mod:`executor.cli` module
==============================

.. automodule:: executor.cli
:members:

The :mod:`executor.concurrent` module
=====================================

Expand Down

0 comments on commit 121a24d

Please sign in to comment.