updated autodoc conf: allow __init__ to show but not __dict__ and others
authorChristian Herdtweck <christian.herdtweck@intra2net.com>
Wed, 19 Aug 2015 12:39:44 +0000 (14:39 +0200)
committerChristian Herdtweck <christian.herdtweck@intra2net.com>
Wed, 19 Aug 2015 12:39:44 +0000 (14:39 +0200)
doc/conf.py

index f06f6d2..875c9d0 100644 (file)
@@ -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)