autodoc: autodata fails to find the documentation

Victor Stinner avatarVictor Stinner created an issue

I have two Python modules: enum.py and interfaces.py. The enum module defines a Enum class (which has a docstring), interfaces defines a CLOSED constant which is an instance of Enum and has its own documentation (using "#: documentation of my constant" syntax). The autodoc extension fails to find CLOSED documentation, and fallback to Enum docstring.

Documenter.add_content() uses self.analyzer to locate the documentation of CLOSED, but it looks in enum module namespace instead of of interfaces namespace. CLOSED is a Enum object and Enum is defined in the enum module.

Documenter.generate() creates the analyzer using:

self.analyzer = ModuleAnalyzer.for_module(self.real_modname)

I suppose that it is useful to search in the namespace of "real" module, but in my case, we should also search in the namespace of the "local" module. Attached patch adds a new analyzer to search in the "local" module. It fixes my issue.

Comments (3)

  1. Anonymous

    I had this problem too but I decided that the problem stemmed from incorrectly identifying the real module. Adding a get_real_modname method to DataDocumenter more like the one in AttributeDocumenter solves it.

  2. Victor Stinner

    Oh, this link has been blacklisted in Google thanks to the DMCA! http://www.chillingeffects.org/notice.cgi?sID=192703

    The website is down, you can get a copy in Google Cache: http://webcache.googleusercontent.com/search?q=cache:9-rmazECTEAJ:https://www.chillingeffects.org/notice.cgi%3FsID%3D192703%26print%3Dyes+

    "Autodata Ltd. French Solutions, Ltd GB" owning http://www.autodata.ltd.uk asked (January 24, 2012) to blacklist 205 warez URLs including this github issue.

  3. 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.