diff --git a/pydoctor/astbuilder.py b/pydoctor/astbuilder.py index a4ad88679..dce2bd3a4 100644 --- a/pydoctor/astbuilder.py +++ b/pydoctor/astbuilder.py @@ -242,21 +242,17 @@ def processReExports(system: model.System) -> None: msg += f" as {local_name!r}" msg += f"from origin module {imported_name.orgmodule!r}" mod.report(msg, lineno_offset=imported_name.linenumber) - elif isinstance(origin, model.Module): - if local_name != '*': - if orgname: - # only 'import from' statements can be used in re-exporting currently. - _handleReExport(mod, orgname, local_name, origin, - linenumber=imported_name.linenumber) - else: - for n in getPublicNames(origin): - if n in exports: - _handleReExport(mod, n, n, origin, - linenumber=imported_name.linenumber) + elif local_name != '*': + if orgname: + # only 'import from' statements can be used in re-exporting currently. + _handleReExport(mod, orgname, local_name, origin, + linenumber=imported_name.linenumber) else: - msg = f"origin module {imported_name.orgmodule!r} should be Module, got {type(origin).__name__}" - mod.report(msg, lineno_offset=imported_name.linenumber) - + for n in getPublicNames(origin): + if n in exports: + _handleReExport(mod, n, n, origin, + linenumber=imported_name.linenumber) + def postProcessClasses(system: model.System) -> None: for cls in system.objectsOfType(model.Class): diff --git a/pydoctor/model.py b/pydoctor/model.py index 5173a3dc2..ee762fe97 100644 --- a/pydoctor/model.py +++ b/pydoctor/model.py @@ -12,7 +12,6 @@ from collections import defaultdict import datetime import importlib -import platform import sys import textwrap import types