Closed tristanlatr closed 9 months ago
Patch coverage: 91.92
% and no project coverage change.
Comparison is base (
965ed95
) 92.62% compared to head (d617603
) 92.62%.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.
This PR could and should be splitted in two: first the allobject refactor, then the reparenting refactor. So I'll mark it as draft for now.
Rework reparenting in post-processing. It ensures that for all time of visiting the ASTs, the model represent the real code structure, since no reparenting is done before post processing.
This patch changes some of the core pydoctor logic, so it should be carefully reviewed.
This changes will help fixing #295 as well as improve our capacity to fix #184 and other
__all__
related problems. Together with #723 it will finally fix #295.Introduces the
Module.imports
attribute holding a list of resolved imports (likeast.alias
but with full module names), this is required by the re-exporting process since only imported names should be reparented.Introduces the
System.modules
attribute that is a dict from the module full names to the Module instances. This dict is not changed during reparenting. It's populated when the modules are added to the system. This behaviour better matches the python import system and makes us differentiate a module vs an object with the same fullname as the module in the parent package__init__.py
for instance.Switch from using of a actual dict to hold values of
System.allobjects
attribute; insteadallobject
is a proxy that lazily get the documentable having the requested fullname based on system'srootobjects
andmodules
attributes. It simplifies drastically the reparenting code since the only thing left to handle is the new name of object and it'sparent.contents
links. This switch also introduces diff in handling of duplicate objects since there is no need to explicitly handleallobjects
mapping.This PR should not introduce any changes in behaviour, except it fixes a bug in reparenting process when there as duplicates (see new tests).