ModuleDocumenter incorrectly uses getattr for submodules [patch,tests]

ciantic avatarciantic created an issue

1.) ModuleDocumenter.get_object_members does not include submodules, which it should.

2.) If all has submodule it tries to use getattr() failure point:

Imagine package with following:

__all__ = ['submodule', ...]

On this case the get_object_members fails, as it tries to use getattr for "submodule".

Following patch adds submodules to the get_object_members and does not use getattr for submodules listed in all.

There is also tests for this in patch, it seems to be passing on my computer.

--

I'm improving autosummary to be able to autodocument packages directly, this patch does not prevent me to continue whether it is added or not, but if this is added, there should be no warnings (of incorrectly tried imports) anymore, since sometimes (I have not yet found the position where) autodoc tries to import submodules that are not really submodules.

Comments (6)

  1. Log in to comment
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.