Skip to content

MPIBGC-TEE/sphinx-repaired

Repository files navigation

This is the sphinx documentation package with a bugfix of the autosummary extension. Now, standard functions and classes such as sympy.Matrix will NOT be documented even if they are imported. This was done by replacing the get_members method in sphinx/ext/autosummary/generate.py by

def get_members(obj, typ, include_public=[], imported=False):
    items = []
    for name in dir(obj):
        try:
            obj_name = safe_getattr(obj, name)
            documenter = get_documenter(obj_name, obj)
        except AttributeError:
            continue
        if documenter.objtype == typ:
            try:
                cond = (
                    imported or 
                    obj_name.__module__ == obj.__name__
                    )
            except AttributeError:
                cond = True
            if cond:
                items.append(name)
    public = [x for x in items
              if x in include_public or not x.startswith('_')]
    return public, items

Furthermore the templates in sphinx/ext/autosummary/templates/autosummary are slightly adapted.