From 42f682906da4c5388769126467319855d288e0dc Mon Sep 17 00:00:00 2001 From: Christian Herdtweck Date: Wed, 19 Aug 2015 14:39:44 +0200 Subject: [PATCH] updated autodoc conf: allow __init__ to show but not __dict__ and others --- doc/conf.py | 13 +++++++++++++ 1 files changed, 13 insertions(+), 0 deletions(-) diff --git a/doc/conf.py b/doc/conf.py index f06f6d2..875c9d0 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -297,7 +297,20 @@ intersphinx_mapping = {'https://docs.python.org/': None} # show doc of class AND of constructor autoclass_content = 'class' # 'both' not needed if special-members is used + # as default flag autodoc_default_flags = ['members', 'special-members', 'undoc-members', 'show-inheritance'] autodoc_member_order = 'bysource' + +# want to keep __init__ members but exclude other special members +def skip_class_members(app, what, name, obj, skip, options): + exclude = name in ('__weakref__', '__dict__', '__module__', '__doc__') \ + and what == 'class' + if exclude: + print('excluding {0}'.format(name)) + return skip or exclude + +def setup(app): + print('running custom setup in conf.py') + app.connect('autodoc-skip-member', skip_class_members) -- 1.7.1