@@ -3,9 +3,7 @@
Loading
3 3
import re
4 4
import os
5 5
from warnings import warn
6 -
from distutils.version import LooseVersion
7 6
8 -
from sphinx import __version__
9 7
from sphinx.ext.autosummary.generate import find_autosummary_in_docstring
10 8
11 9
__all__ = ['cleanup_whitespace',
@@ -58,9 +56,10 @@
Loading
58 56
    ----------
59 57
    modname : str
60 58
        The name of the module to search.
61 -
    onlylocals : bool
59 +
    onlylocals : bool or list
62 60
        If True, only attributes that are either members of `modname` OR one of
63 -
        its modules or subpackages will be included.
61 +
        its modules or subpackages will be included.  If a list, only members
62 +
        of packages in the list are included. If `False`, selection is done.
64 63
65 64
    Returns
66 65
    -------
@@ -82,10 +81,12 @@
Loading
82 81
    __import__(modname)
83 82
    mod = sys.modules[modname]
84 83
84 +
    # Note: use getattr instead of mod.__dict__[k] for modules that
85 +
    # define their own __getattr__ and __dir__.
85 86
    if hasattr(mod, '__all__'):
86 -
        pkgitems = [(k, mod.__dict__[k]) for k in mod.__all__]
87 +
        pkgitems = [(k, getattr(mod, k)) for k in mod.__all__]
87 88
    else:
88 -
        pkgitems = [(k, mod.__dict__[k]) for k in dir(mod) if k[0] != '_']
89 +
        pkgitems = [(k, getattr(mod, k)) for k in dir(mod) if k[0] != '_']
89 90
90 91
    # filter out modules and pull the names and objs out
91 92
    ismodule = inspect.ismodule
@@ -101,6 +102,8 @@
Loading
101 102
            fqnames.append(modname + '.' + lnm)
102 103
103 104
    if onlylocals:
105 +
        if isinstance(onlylocals, (tuple, list)):
106 +
            modname = tuple(onlylocals)
104 107
        valids = [fqn.startswith(modname) for fqn in fqnames]
105 108
        localnames = [e for i, e in enumerate(localnames) if valids[i]]
106 109
        fqnames = [e for i, e in enumerate(fqnames) if valids[i]]

@@ -256,7 +256,7 @@
Loading
256 256
                elif opname == 'no-heading':
257 257
                    top_head = False
258 258
                elif opname == 'allowed-package-names':
259 -
                    allowedpkgnms.append(args.strip())
259 +
                    allowedpkgnms.extend(arg.strip() for arg in args.split(','))
260 260
                elif opname == 'inherited-members':
261 261
                    inherited_members = True
262 262
                elif opname == 'no-inherited-members':
@@ -271,8 +271,8 @@
Loading
271 271
                allowedpkgnms = ''
272 272
                onlylocals = True
273 273
            else:
274 -
                allowedpkgnms = ':allowed-package-names: ' + ','.join(allowedpkgnms)
275 274
                onlylocals = allowedpkgnms
275 +
                allowedpkgnms = ':allowed-package-names: ' + ','.join(allowedpkgnms)
276 276
277 277
            # get the two heading chars
278 278
            hds = hds.strip()
Files Coverage
sphinx_automodapi 88.06%
Project Totals (5 files) 88.06%
Sunburst
The inner-most circle is the entire project, moving away from the center are folders then, finally, a single file. The size and color of each slice is representing the number of statements and the coverage, respectively.
Icicle
The top section represents the entire project. Proceeding with folders and finally individual files. The size and color of each slice is representing the number of statements and the coverage, respectively.
Grid
Each block represents a single file in the project. The size and color of each block is represented by the number of statements and the coverage, respectively.
Loading