Skip to content

Commit

Permalink
Satisfy ruff (which I tried to run locally, but did not complain)
Browse files Browse the repository at this point in the history
  • Loading branch information
aeisenbarth committed Apr 11, 2024
1 parent 200575b commit 5419638
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions sphinx/ext/autosummary/generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,11 +276,13 @@ def generate_autosummary_content(name: str, obj: Any, parent: Any,
imported_members = imported_members or ('__all__' in dir(obj) and respect_module_all)

members_by_obj_type = _get_members_by_objtype(doc, app, obj, imported=imported_members)
for objtype in app.registry.documenters.keys():
for objtype in app.registry.documenters:
ns[objtype] = members_by_obj_type.get(objtype, [])
# TODO: Clash between objtype "module" and variable for current module name, defined below
# TODO: Clash between objtype "module" and variable for current module name,
# defined below
attributes_public, ns['attribute'] = _get_module_attrs(name, ns['members'])
ns['public'] = _get_public_members(doc, app, obj, imported=imported_members) + attributes_public
ns['public'] = (_get_public_members(doc, app, obj, imported=imported_members) +
attributes_public)

# Define legacy variables for compatibility
ns['functions'] = [item for item in ns['function'] if item in ns['public']]
Expand All @@ -296,7 +298,11 @@ def generate_autosummary_content(name: str, obj: Any, parent: Any,
if ispackage and recursive:
# Use members that are not modules as skip list, because it would then mean
# that module was overwritten in the package namespace
skip = [item for objtype, items in members_by_obj_type.items() if objtype != "module" for item in items]
skip = [
item for objtype, items in members_by_obj_type.items()
if objtype != "module"
for item in items
]

# If respect_module_all and module has a __all__ attribute, first get
# modules that were explicitly imported. Next, find the rest with the
Expand Down

0 comments on commit 5419638

Please sign in to comment.