Fixed AttributeError using inheritance diagrams on a module with plain imports

Fixes #289
pull/300/head
Ashley Whetter 3 years ago
parent 17ffa2d1b6
commit 26b7d729a2

@ -94,7 +94,7 @@ Breaking Changes
Features Features
^^^^^^^^ ^^^^^^^^
* Added support for using type hints as parameter types and return types * (Python) Added support for using type hints as parameter types and return types
via the ``sphinx.ext.autodoc.typehints`` extension. via the ``sphinx.ext.autodoc.typehints`` extension.
* `#191 <https://github.com/readthedocs/sphinx-autoapi/issues/191>`: * `#191 <https://github.com/readthedocs/sphinx-autoapi/issues/191>`:
Basic incremental build support is enabled ``autoapi_keep_files`` is enabled. Basic incremental build support is enabled ``autoapi_keep_files`` is enabled.
@ -109,16 +109,18 @@ Features
Bug Fixes Bug Fixes
^^^^^^^^^ ^^^^^^^^^
* `#246 <https://github.com/readthedocs/sphinx-autoapi/issues/246>`: * `#246 <https://github.com/readthedocs/sphinx-autoapi/issues/246>`: (Python)
Fixed TypeError when parsing a class that inherits from ``type``. Fixed TypeError when parsing a class that inherits from ``type``.
* `#244 <https://github.com/readthedocs/sphinx-autoapi/issues/244>`: * `#244 <https://github.com/readthedocs/sphinx-autoapi/issues/244>`:
Fixed an unnecessary deprecation warning being raised when running Fixed an unnecessary deprecation warning being raised when running
sphinx-build from the same directory as conf.py. sphinx-build from the same directory as conf.py.
* Fixed properties documented by Autodoc directives geting documented as methods. * (Python) Fixed properties documented by Autodoc directives geting documented as methods.
* `#293 <https://github.com/readthedocs/sphinx-autoapi/issues/293>`: * `#293 <https://github.com/readthedocs/sphinx-autoapi/issues/293>`:
Fixed failure to build out of source conf.py files. Fixed failure to build out of source conf.py files.
Configuration values using relative values are now relative to the source directory Configuration values using relative values are now relative to the source directory
instead of relative to the conf.py file. instead of relative to the conf.py file.
* `#289 <https://github.com/readthedocs/sphinx-autoapi/issues/289>`: (Python)
Fixed AttributeError using inheritance diagrams on a module with plain imports.
V1.5.1 (2020-10-01) V1.5.1 (2020-10-01)
@ -140,7 +142,7 @@ Features
* `#222 <https://github.com/readthedocs/sphinx-autoapi/issues/222>`: * `#222 <https://github.com/readthedocs/sphinx-autoapi/issues/222>`:
Declare the extension as parallel unsafe. Declare the extension as parallel unsafe.
* `#217 <https://github.com/readthedocs/sphinx-autoapi/issues/217>`: * `#217 <https://github.com/readthedocs/sphinx-autoapi/issues/217>`: (Python)
All overload signatures are documented. All overload signatures are documented.
* `#243 <https://github.com/readthedocs/sphinx-autoapi/issues/243>`: * `#243 <https://github.com/readthedocs/sphinx-autoapi/issues/243>`:
Files are found in order of preference according to ``autoapi_file_patterns``. Files are found in order of preference according to ``autoapi_file_patterns``.
@ -149,9 +151,9 @@ Features
Bug Fixes Bug Fixes
^^^^^^^^^ ^^^^^^^^^
* `#219 <https://github.com/readthedocs/sphinx-autoapi/issues/219>`: * `#219 <https://github.com/readthedocs/sphinx-autoapi/issues/219>`: (Python)
Fixed return types not showing for methods. Fixed return types not showing for methods.
* Fixed incorrect formatting of properties on generated method directives. * (Python) Fixed incorrect formatting of properties on generated method directives.
* Fixed every toctree entry getting added as a new list. * Fixed every toctree entry getting added as a new list.
* `#234 <https://github.com/readthedocs/sphinx-autoapi/issues/234>`: * `#234 <https://github.com/readthedocs/sphinx-autoapi/issues/234>`:
Fixed only some entries getting added to the toctree. Fixed only some entries getting added to the toctree.

@ -12,7 +12,7 @@ def _do_import_class(name, currmodule=None):
while target and path_stack: while target and path_stack:
path_part = path_stack.pop() path_part = path_stack.pop()
target = (target.getattr(path_part) or (None,))[0] target = (target.getattr(path_part) or (None,))[0]
while isinstance(target, astroid.ImportFrom): while isinstance(target, (astroid.ImportFrom, astroid.Import)):
try: try:
target = target.do_import_module(path_part) target = target.do_import_module(path_part)
except astroid.AstroidImportError: except astroid.AstroidImportError:

Loading…
Cancel
Save