mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
fix #2336 autosummary imported members
This commit is contained in:
parent
92a9c653f7
commit
2390c5549c
@ -165,16 +165,18 @@ def generate_autosummary_docs(sources, output_dir=None, suffix='.rst',
|
|||||||
except TemplateNotFound:
|
except TemplateNotFound:
|
||||||
template = template_env.get_template('autosummary/base.rst')
|
template = template_env.get_template('autosummary/base.rst')
|
||||||
|
|
||||||
def get_members(obj, typ, include_public=[]):
|
def get_members(obj, typ, include_public=[], imported=False):
|
||||||
# type: (Any, unicode, List[unicode]) -> Tuple[List[unicode], List[unicode]]
|
# type: (Any, unicode, List[unicode]) -> Tuple[List[unicode], List[unicode]]
|
||||||
items = [] # type: List[unicode]
|
items = [] # type: List[unicode]
|
||||||
for name in dir(obj):
|
for name in dir(obj):
|
||||||
try:
|
try:
|
||||||
documenter = get_documenter(safe_getattr(obj, name),
|
value = safe_getattr(obj, name)
|
||||||
obj)
|
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
continue
|
continue
|
||||||
|
documenter = get_documenter(value, obj)
|
||||||
if documenter.objtype == typ:
|
if documenter.objtype == typ:
|
||||||
|
if imported or getattr(value, '__module__', None) == obj.__name__:
|
||||||
|
|
||||||
items.append(name)
|
items.append(name)
|
||||||
public = [x for x in items
|
public = [x for x in items
|
||||||
if x in include_public or not x.startswith('_')]
|
if x in include_public or not x.startswith('_')]
|
||||||
|
Loading…
Reference in New Issue
Block a user