-
Notifications
You must be signed in to change notification settings - Fork 51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pre-process parsed docstrings to add hints on how to resolve names #723
base: master
Are you sure you want to change the base?
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #723 +/- ##
==========================================
+ Coverage 92.69% 92.78% +0.08%
==========================================
Files 47 47
Lines 8337 8283 -54
Branches 1846 1984 +138
==========================================
- Hits 7728 7685 -43
+ Misses 349 338 -11
Partials 260 260 ☔ View full report in Codecov by Sentry. |
else: | ||
_ReferenceTransform(document, ctx).apply() | ||
|
||
def transform_parsed_names(node:'model.Module') -> None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should not be re-run on nodes that have been reparented. Meaning we must keep track of reparented nodes for every modules.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This issue will be fixed if we move the reparenting in post process and call transform_parsed_names()
after.
Also enamble msg(once=True) when using report().
…rsed_annotations, FunctionOverload.parsed_decorators, Attribute.parsed_decorators, Attribute.parsed_value. Fixes links in presentation of these components.
Fixing "Lookup of name in annotation fails on reparented object #295". | ||
The fix is not 100% complete at the moment: attribute values and decorators | ||
are not handled. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixing "Lookup of name in annotation fails on reparented object #295". | |
The fix is not 100% complete at the moment: attribute values and decorators | |
are not handled. | |
Fixing "Lookup of name in annotation fails on reparented object #295". |
_apply_reference_transform(dec, ob) | ||
elif isinstance(ob, model.Class): | ||
for base in get_parsed_bases(ob): | ||
_apply_reference_transform(base, ob) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
_apply_reference_transform(base, ob) | |
_apply_reference_transform(base, ob, is_annotation=True) |
if ob.parsed_docstring: | ||
_apply_reference_transform(ob.parsed_docstring, ob) | ||
for f in ob.parsed_docstring.fields: | ||
_apply_reference_transform(f.body(), ob) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since we're not using ensure_parsed_docstring
, we might miss some docs
@@ -176,6 +176,7 @@ def visit_Module(self, node: ast.Module) -> None: | |||
|
|||
def depart_Module(self, node: ast.Module) -> None: | |||
self.builder.pop(self.module) | |||
epydoc2stan.transform_parsed_names(self.module) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be done in post-processing
@@ -13,6 +13,7 @@ | |||
from docutils import nodes | |||
from twisted.web.template import Tag, tags | |||
|
|||
# TODO: this class should support to_node() like others. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should create an issue for that
annotation: Optional[ast.expr] = getattr(obj, 'annotation', None) | ||
if annotation is not None: | ||
return colorize_inline_pyval(annotation) | ||
def get_parsed_decorators(obj: Union[model.Attribute, model.Function, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Once #640 is merged, this should be changed to the following:
def get_parsed_decorators(obj: Union[model.Attribute, model.Function, | |
def get_parsed_decorators(obj: Union[model.Property, model.Function, |
@@ -392,7 +406,8 @@ def report(self, descr: str, section: str = 'parsing', lineno_offset: int = 0, t | |||
self.system.msg( | |||
section, | |||
f'{self.description}:{linenumber}: {descr}', | |||
thresh=thresh) | |||
# some warnings can be reported more that once. | |||
thresh=thresh, once=True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should probably not change this behaviour.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let’s revert that.
This comment has been minimized.
This comment has been minimized.
Diff from pydoctor_primer, showing the effect of this PR on open source code: bottle (https://github.com/bottlepy/bottle)
- /projects/bottle/bottle.py:889: Cannot find link target for "GET"
pycma (https://github.com/CMA-ES/pycma)
- /projects/pycma/cma/__init__.py:27: ambiguous ref to fmin, could be cma.evolution_strategy.fmin, cma.purecma.fmin
- /projects/pycma/cma/__init__.py:36: Cannot find link target for "numpy"
- /projects/pycma/cma/__init__.py:90: ambiguous ref to fmin, could be cma.evolution_strategy.fmin, cma.purecma.fmin
- /projects/pycma/cma/constraints_handler.py:275: Cannot find link target for "None"
- /projects/pycma/cma/constraints_handler.py:337: ambiguous ref to fmin, could be cma.evolution_strategy.fmin, cma.purecma.fmin
- /projects/pycma/cma/constraints_handler.py:396: Cannot find link target for "x"
- /projects/pycma/cma/constraints_handler.py:349: Cannot find link target for "None"
- /projects/pycma/cma/constraints_handler.py:540: Cannot find link target for "cma.constraints_handler.ConstrainedSolutionsArchive.archive.infos", resolved from "archive.infos"
+ /projects/pycma/cma/constraints_handler.py:540: Cannot find link target for "cma.constraints_handler.ConstrainedSolutionsArchive.archive.infos"
- /projects/pycma/cma/constraints_handler.py:642: Cannot find link target for "list"
+ /projects/pycma/cma/constraints_handler.py:642: Cannot find link target for "builtins.list" (you can link to external docs with --intersphinx)
- /projects/pycma/cma/constraints_handler.py:1050: Cannot find link target for "True"
+ /projects/pycma/cma/constraints_handler.py:1050: Cannot find link target for "builtins.True" (you can link to external docs with --intersphinx)
- /projects/pycma/cma/constraints_handler.py:940: Cannot find link target for "TypeError"
+ /projects/pycma/cma/constraints_handler.py:940: Cannot find link target for "builtins.TypeError" (you can link to external docs with --intersphinx)
- /projects/pycma/cma/constraints_handler.py:1255: Cannot find link target for "False"
+ /projects/pycma/cma/constraints_handler.py:1255: Cannot find link target for "builtins.False" (you can link to external docs with --intersphinx)
- /projects/pycma/cma/constraints_handler.py:1304: Cannot find link target for "False"
+ /projects/pycma/cma/constraints_handler.py:1304: Cannot find link target for "builtins.False" (you can link to external docs with --intersphinx)
- /projects/pycma/cma/evolution_strategy.py:522: Cannot find link target for "dict"
- /projects/pycma/cma/evolution_strategy.py:4683: Cannot find link target for "bipop"
- /projects/pycma/cma/evolution_strategy.py:244: Cannot find link target for "int"
- /projects/pycma/cma/evolution_strategy.py:245: Cannot find link target for "float"
- /projects/pycma/cma/evolution_strategy.py:558: Cannot find link target for "dict"
+ /projects/pycma/cma/evolution_strategy.py:244: Cannot find link target for "builtins.int" (you can link to external docs with --intersphinx)
+ /projects/pycma/cma/evolution_strategy.py:245: Cannot find link target for "builtins.float" (you can link to external docs with --intersphinx)
+ /projects/pycma/cma/evolution_strategy.py:558: Cannot find link target for "builtins.dict" (you can link to external docs with --intersphinx)
- /projects/pycma/cma/evolution_strategy.py:579: Cannot find link target for "tolstagnation"
- /projects/pycma/cma/evolution_strategy.py:853: Cannot find link target for "key"
- /projects/pycma/cma/evolution_strategy.py:906: Cannot find link target for "loc"
- /projects/pycma/cma/evolution_strategy.py:2415: Cannot find link target for "list"
- /projects/pycma/cma/evolution_strategy.py:2413: Cannot find link target for "numpy.ndarray" (you can link to external docs with --intersphinx)
- /projects/pycma/cma/evolution_strategy.py:2450: Cannot find link target for "func"
- /projects/pycma/cma/evolution_strategy.py:3665: Cannot find link target for "d"
- /projects/pycma/cma/evolution_strategy.py:2656: Cannot find link target for "function_values"
- /projects/pycma/cma/evolution_strategy.py:2663: Cannot find link target for "check_points"
- /projects/pycma/cma/fitness_models.py:184: Cannot find link target for "list"
+ /projects/pycma/cma/fitness_models.py:184: Cannot find link target for "builtins.list" (you can link to external docs with --intersphinx)
- /projects/pycma/cma/fitness_models.py:332: Cannot find link target for "cma.fitness_models.ModelInjectionCallback.model.xopt", resolved from "model.xopt"
+ /projects/pycma/cma/fitness_models.py:332: Cannot find link target for "cma.fitness_models.ModelInjectionCallback.model.xopt"
- /projects/pycma/cma/fitness_models.py:332: Cannot find link target for "cma.fitness_models.ModelInjectionCallback.model.xopt", resolved from "model.xopt"
+ /projects/pycma/cma/fitness_transformations.py:22: Cannot find link target for "builtins.callable" (you can link to external docs with --intersphinx)
+ /projects/pycma/cma/fitness_transformations.py:205: Cannot find link target for "builtins.callable" (you can link to external docs with --intersphinx)
- /projects/pycma/cma/fitness_transformations.py:509: Cannot find link target for "dict"
- /projects/pycma/cma/fitness_transformations.py:509: Cannot find link target for "list"
+ /projects/pycma/cma/fitness_transformations.py:509: Cannot find link target for "builtins.dict" (you can link to external docs with --intersphinx)
+ /projects/pycma/cma/fitness_transformations.py:509: Cannot find link target for "builtins.list" (you can link to external docs with --intersphinx)
- /projects/pycma/cma/logger.py:1855: ambiguous ref to name, could be cma.logger.LoggerDummy.name, cma.logger.Logger.name
- /projects/pycma/cma/logger.py:1855: Cannot find link target for "name"
- /projects/pycma/cma/logger.py:1644: Cannot find link target for "first"
- /projects/pycma/cma/logger.py:2205: Cannot find link target for "clear"
- /projects/pycma/cma/optimization_tools.py:22: Cannot find link target for "y"
- /projects/pycma/cma/optimization_tools.py:205: Cannot find link target for "list"
- /projects/pycma/cma/optimization_tools.py:205: Cannot find link target for "tuple"
+ /projects/pycma/cma/optimization_tools.py:205: Cannot find link target for "builtins.list" (you can link to external docs with --intersphinx)
+ /projects/pycma/cma/optimization_tools.py:205: Cannot find link target for "builtins.tuple" (you can link to external docs with --intersphinx)
- /projects/pycma/cma/optimization_tools.py:217: Cannot find link target for "multiprocessing"
- /projects/pycma/cma/optimization_tools.py:531: ambiguous ref to fmin, could be cma.evolution_strategy.fmin, cma.purecma.fmin
- /projects/pycma/cma/optimization_tools.py:536: ambiguous ref to fmin, could be cma.evolution_strategy.fmin, cma.purecma.fmin
- /projects/pycma/cma/optimization_tools.py:603: ambiguous ref to fmin, could be cma.evolution_strategy.fmin, cma.purecma.fmin
- /projects/pycma/cma/optimization_tools.py:627: ambiguous ref to fmin, could be cma.evolution_strategy.fmin, cma.purecma.fmin
- /projects/pycma/cma/optimization_tools.py:641: ambiguous ref to fmin, could be cma.evolution_strategy.fmin, cma.purecma.fmin
- /projects/pycma/cma/purecma.py:25: Cannot find link target for "numpy"
- /projects/pycma/cma/purecma.py:456: Cannot find link target for "tuple"
+ /projects/pycma/cma/purecma.py:456: Cannot find link target for "builtins.tuple" (you can link to external docs with --intersphinx)
- /projects/pycma/cma/interfaces.py:384: Cannot find link target for "dict"
- /projects/pycma/cma/recombination_weights.py:40: Cannot find link target for "True"
- /projects/pycma/cma/recombination_weights.py:42: Cannot find link target for "list"
- /projects/pycma/cma/recombination_weights.py:46: Cannot find link target for "True"
+ /projects/pycma/cma/recombination_weights.py:40: Cannot find link target for "builtins.True" (you can link to external docs with --intersphinx)
+ /projects/pycma/cma/recombination_weights.py:42: Cannot find link target for "builtins.list" (you can link to external docs with --intersphinx)
+ /projects/pycma/cma/recombination_weights.py:46: Cannot find link target for "builtins.True" (you can link to external docs with --intersphinx)
- /projects/pycma/cma/interfaces.py:336: Cannot find link target for "x"
- /projects/pycma/cma/sampler.py:632: Cannot find link target for "d"
- /projects/pycma/cma/sampler.py:662: Cannot find link target for "int"
+ /projects/pycma/cma/sampler.py:662: Cannot find link target for "builtins.int" (you can link to external docs with --intersphinx)
- /projects/pycma/cma/sampler.py:879: Cannot find link target for "d"
- /projects/pycma/cma/transformations.py:511: Cannot find link target for "numpy.diag(scaling)", resolved from "np.diag(scaling)" (you can link to external docs with --intersphinx)
- /projects/pycma/cma/utilities/math.py:67: Cannot find link target for "w"
- /projects/pycma/cma/utilities/math.py:118: Cannot find link target for "list"
+ /projects/pycma/cma/utilities/math.py:118: Cannot find link target for "builtins.list" (you can link to external docs with --intersphinx)
- /projects/pycma/cma/utilities/math.py:573: Cannot find link target for "x"
- /projects/pycma/cma/utilities/python3for2.py:3: Cannot find link target for "builtins.range", resolved from "range" (you can link to external docs with --intersphinx)
+ /projects/pycma/cma/utilities/python3for2.py:3: Cannot find link target for "builtins.range" (you can link to external docs with --intersphinx)
- /projects/pycma/cma/utilities/python3for2.py:3: Cannot find link target for "builtins.input", resolved from "input" (you can link to external docs with --intersphinx)
+ /projects/pycma/cma/utilities/python3for2.py:3: Cannot find link target for "builtins.input" (you can link to external docs with --intersphinx)
- /projects/pycma/cma/utilities/python3for2.py:3: Cannot find link target for "collections", resolved from "abc"
- /projects/pycma/cma/utilities/utils.py:169: Cannot find link target for "numpy.nan", resolved from "np.nan" (you can link to external docs with --intersphinx)
- /projects/pycma/cma/utilities/utils.py:452: Cannot find link target for "dict"
... (truncated 10 lines) ...
attrs (https://github.com/python-attrs/attrs)
- /projects/attrs/src/attr/_make.py:497: bad docstring: Inline interpreted text or phrase reference start-string without end-string.
- /projects/attrs/src/attr/_make.py:1441: bad docstring: No role entry for "term" in module "docutils.parsers.rst.languages.en".
- Trying "term" as canonical role name.
- /projects/attrs/src/attr/_make.py:1441: bad docstring: Unknown interpreted text role "term".
- /projects/attrs/src/attr/_funcs.py:216: Cannot find link target for "dict"
- /projects/attrs/src/attr/_make.py:194: Cannot find link target for "None"
- /projects/attrs/src/attr/_make.py:1527: Cannot find link target for "True"
- /projects/attrs/src/attr/_make.py:58: Cannot find link target for "None"
- /projects/attrs/src/attr/_make.py:87: Cannot find link target for "None"
+ /projects/attrs/src/attr/_make.py:58: Cannot find link target for "builtins.None" (you can link to external docs with --intersphinx)
+ /projects/attrs/src/attr/_make.py:87: Cannot find link target for "builtins.None" (you can link to external docs with --intersphinx)
- /projects/attrs/src/attr/exceptions.py:14: Cannot find link target for "AttributeError"
+ /projects/attrs/src/attr/exceptions.py:14: Cannot find link target for "builtins.AttributeError" (you can link to external docs with --intersphinx)
- /projects/attrs/src/attr/validators.py:156: Cannot find link target for "re.fullmatch" (you can link to external docs with --intersphinx)
- /projects/attrs/src/attr/validators.py:589: Cannot find link target for "ValueError"
- /projects/attrs/src/attr/_make.py:2571: Cannot find link target for "str"
- /projects/attrs/src/attr/_make.py:2572: Cannot find link target for "str"
- /projects/attrs/src/attr/_make.py:2574: Cannot find link target for "bool"
+ /projects/attrs/src/attr/_make.py:2571: Cannot find link target for "builtins.str" (you can link to external docs with --intersphinx)
+ /projects/attrs/src/attr/_make.py:2572: Cannot find link target for "builtins.str" (you can link to external docs with --intersphinx)
+ /projects/attrs/src/attr/_make.py:2574: Cannot find link target for "builtins.bool" (you can link to external docs with --intersphinx)
- /projects/attrs/src/attr/_make.py:2576: Cannot find link target for "None"
+ /projects/attrs/src/attr/_make.py:2576: Cannot find link target for "builtins.None" (you can link to external docs with --intersphinx)
astroid (https://github.com/pylint-dev/astroid)
- /projects/astroid/astroid/manager.py:418: Cannot find link target for "hook"
- /projects/astroid/astroid/manager.py:420: Cannot find link target for "astroid.nodes.Module", resolved from "astroid.Module"
twine (https://github.com/pypa/twine)
- /projects/twine/twine/settings.py:38: Cannot find link target for "TypeError"
+ /projects/twine/twine/settings.py:38: Cannot find link target for "builtins.TypeError" (you can link to external docs with --intersphinx)
coco (https://github.com/numbbo/coco)
- /projects/coco/code-postprocessing/cocopp/findfiles.py:8: bad docstring: No role entry for "file" in module "docutils.parsers.rst.languages.en".
- Trying "file" as canonical role name.
- /projects/coco/code-postprocessing/cocopp/findfiles.py:8: bad docstring: Unknown interpreted text role "file".
- /projects/coco/code-postprocessing/cocopp/findfiles.py:45: bad docstring: No role entry for "file" in module "docutils.parsers.rst.languages.en".
- Trying "file" as canonical role name.
- /projects/coco/code-postprocessing/cocopp/findfiles.py:45: bad docstring: Unknown interpreted text role "file".
- /projects/coco/code-postprocessing/cocopp/pproc.py:3241: bad docstring: No role entry for "file" in module "docutils.parsers.rst.languages.en".
- Trying "file" as canonical role name.
- /projects/coco/code-postprocessing/cocopp/pproc.py:3241: bad docstring: Unknown interpreted text role "file".
- /projects/coco/code-postprocessing/cocopp/cococommands.py:74: bad docstring: No role entry for "file" in module "docutils.parsers.rst.languages.en".
- Trying "file" as canonical role name.
- /projects/coco/code-postprocessing/cocopp/cococommands.py:74: bad docstring: Unknown interpreted text role "file".
- /projects/coco/code-postprocessing/cocopp/cococommands.py:74: bad docstring: No role entry for "file" in module "docutils.parsers.rst.languages.en".
- Trying "file" as canonical role name.
- /projects/coco/code-postprocessing/cocopp/cococommands.py:74: bad docstring: Unknown interpreted text role "file".
- /projects/coco/code-postprocessing/cocopp/rungeneric.py:136: bad docstring: No role entry for "file" in module "docutils.parsers.rst.languages.en".
- Trying "file" as canonical role name.
- /projects/coco/code-postprocessing/cocopp/rungeneric.py:136: bad docstring: Unknown interpreted text role "file".
- /projects/coco/code-postprocessing/cocopp/rungeneric.py:138: bad docstring: No role entry for "file" in module "docutils.parsers.rst.languages.en".
- Trying "file" as canonical role name.
- /projects/coco/code-postprocessing/cocopp/rungeneric.py:138: bad docstring: Unknown interpreted text role "file".
- /projects/coco/code-postprocessing/cocopp/rungeneric.py:140: bad docstring: No role entry for "file" in module "docutils.parsers.rst.languages.en".
- Trying "file" as canonical role name.
- /projects/coco/code-postprocessing/cocopp/rungeneric.py:140: bad docstring: Unknown interpreted text role "file".
- /projects/coco/code-postprocessing/cocopp/rungeneric.py:170: bad docstring: No role entry for "file" in module "docutils.parsers.rst.languages.en".
- Trying "file" as canonical role name.
- /projects/coco/code-postprocessing/cocopp/rungeneric.py:170: bad docstring: Unknown interpreted text role "file".
- /projects/coco/code-postprocessing/cocopp/rungeneric.py:227: bad docstring: No role entry for "file" in module "docutils.parsers.rst.languages.en".
- Trying "file" as canonical role name.
- /projects/coco/code-postprocessing/cocopp/rungeneric.py:227: bad docstring: Unknown interpreted text role "file".
- /projects/coco/code-postprocessing/cocopp/rungeneric.py:227: bad docstring: No role entry for "file" in module "docutils.parsers.rst.languages.en".
- Trying "file" as canonical role name.
- /projects/coco/code-postprocessing/cocopp/rungeneric.py:227: bad docstring: Unknown interpreted text role "file".
- /projects/coco/code-postprocessing/cocopp/rungeneric.py:227: bad docstring: No role entry for "file" in module "docutils.parsers.rst.languages.en".
- Trying "file" as canonical role name.
- /projects/coco/code-postprocessing/cocopp/rungeneric.py:227: bad docstring: Unknown interpreted text role "file".
- /projects/coco/code-postprocessing/cocopp/__init__.py:82: Cannot find link target for "None"
+ /projects/coco/code-postprocessing/cocopp/__init__.py:82: Cannot find link target for "builtins.None" (you can link to external docs with --intersphinx)
- /projects/coco/code-postprocessing/cocopp/archiving.py:423: Cannot find link target for "list"
+ /projects/coco/code-postprocessing/cocopp/archiving.py:423: Cannot find link target for "builtins.list" (you can link to external docs with --intersphinx)
- /projects/coco/code-postprocessing/cocopp/archiving.py:438: Cannot find link target for "print"
+ /projects/coco/code-postprocessing/cocopp/archiving.py:438: Cannot find link target for "builtins.print" (you can link to external docs with --intersphinx)
- /projects/coco/code-postprocessing/cocopp/archiving.py:456: Cannot find link target for "list"
+ /projects/coco/code-postprocessing/cocopp/archiving.py:456: Cannot find link target for "builtins.list" (you can link to external docs with --intersphinx)
- /projects/coco/code-postprocessing/cocopp/archiving.py:472: Cannot find link target for "list"
+ /projects/coco/code-postprocessing/cocopp/archiving.py:472: Cannot find link target for "builtins.list" (you can link to external docs with --intersphinx)
- /projects/coco/code-postprocessing/cocopp/archiving.py:472: Cannot find link target for "None"
+ /projects/coco/code-postprocessing/cocopp/archiving.py:472: Cannot find link target for "builtins.None" (you can link to external docs with --intersphinx)
- /projects/coco/code-postprocessing/cocopp/archiving.py:716: Cannot find link target for "*"
- /projects/coco/code-postprocessing/cocopp/archiving.py:773: Cannot find link target for "list"
+ /projects/coco/code-postprocessing/cocopp/archiving.py:773: Cannot find link target for "builtins.list" (you can link to external docs with --intersphinx)
- /projects/coco/code-postprocessing/cocopp/archiving.py:933: Cannot find link target for "list"
+ /projects/coco/code-postprocessing/cocopp/archiving.py:933: Cannot find link target for "builtins.list" (you can link to external docs with --intersphinx)
- /projects/coco/code-postprocessing/cocopp/archiving.py:984: Cannot find link target for "list"
+ /projects/coco/code-postprocessing/cocopp/archiving.py:984: Cannot find link target for "builtins.list" (you can link to external docs with --intersphinx)
- /projects/coco/code-postprocessing/cocopp/archiving.py:1151: Cannot find link target for "self"
- /projects/coco/code-postprocessing/cocopp/archiving.py:1174: Cannot find link target for "list"
+ /projects/coco/code-postprocessing/cocopp/archiving.py:1174: Cannot find link target for "builtins.list" (you can link to external docs with --intersphinx)
- /projects/coco/code-postprocessing/cocopp/archiving.py:1177: Cannot find link target for "list"
+ /projects/coco/code-postprocessing/cocopp/archiving.py:1177: Cannot find link target for "builtins.list" (you can link to external docs with --intersphinx)
- /projects/coco/code-postprocessing/cocopp/cococommands.py:7: ambiguous ref to DataSet, could be cocopp.algportfolio.DataSet, cocopp.pproc.DataSet
- /projects/coco/code-postprocessing/cocopp/cococommands.py:7: Cannot find link target for "DataSet"
- /projects/coco/code-postprocessing/cocopp/cococommands.py:7: ambiguous ref to DataSet, could be cocopp.algportfolio.DataSet, cocopp.pproc.DataSet
- /projects/coco/code-postprocessing/cocopp/cococommands.py:7: ambiguous ref to DataSet, could be cocopp.algportfolio.DataSet, cocopp.pproc.DataSet
- /projects/coco/code-postprocessing/cocopp/cococommands.py:39: ambiguous ref to DataSet, could be cocopp.algportfolio.DataSet, cocopp.pproc.DataSet
- /projects/coco/code-postprocessing/cocopp/cococommands.py:85: Cannot find link target for "dict"
- /projects/coco/code-postprocessing/cocopp/comp2/ppscatter.py:13: ambiguous ref to targets, could be cocopp.firstsession.targets, cocopp.pprldistr2009_hardestRLB.targets
- /projects/coco/code-postprocessing/cocopp/compall/ppperfprof.py:127: ambiguous ref to targets, could be cocopp.firstsession.targets, cocopp.pprldistr2009_hardestRLB.targets
- /projects/coco/code-postprocessing/cocopp/compall/pprldmany.py:414: ambiguous ref to targets, could be cocopp.firstsession.targets, cocopp.pprldistr2009_hardestRLB.targets
- /projects/coco/code-postprocessing/cocopp/dataformatsettings.py:10: ambiguous ref to DataSet, could be cocopp.algportfolio.DataSet, cocopp.pproc.DataSet
- /projects/coco/code-postprocessing/cocopp/dataformatsettings.py:27: Cannot find link target for "dataset"
- /projects/coco/code-postprocessing/cocopp/dataformatsettings.py:32: Cannot find link target for "aligner"
- /projects/coco/code-postprocessing/cocopp/pproc.py:2067: Cannot find link target for "nan"
- /projects/coco/code-postprocessing/cocopp/pproc.py:1852: Cannot find link target for "numpy.array" (you can link to external docs with --intersphinx)
+ /projects/coco/code-postprocessing/cocopp/pproc.py:1912: Cannot find link target for "builtins.True" (you can link to external docs with --intersphinx)
- /projects/coco/code-postprocessing/cocopp/pproc.py:1912: Cannot find link target for "True"
- /projects/coco/code-postprocessing/cocopp/pproc.py:1293: Cannot find link target for "numpy.array", resolved from "np.array" (you can link to external docs with --intersphinx)
+ /projects/coco/code-postprocessing/cocopp/pproc.py:1293: Cannot find link target for "numpy.array" (you can link to external docs with --intersphinx)
- /projects/coco/code-postprocessing/cocopp/pproc.py:1738: Cannot find link target for "evals_row"
- /projects/coco/code-postprocessing/cocopp/pproc.py:988: Cannot find link target for "precision"
- /projects/coco/code-postprocessing/cocopp/testbedsettings.py:103: ambiguous ref to DataSet, could be cocopp.algportfolio.DataSet, cocopp.pproc.DataSet
- /projects/coco/code-postprocessing/cocopp/toolsdivers.py:118: Cannot find link target for "str"
+ /projects/coco/code-postprocessing/cocopp/toolsdivers.py:118: Cannot find link target for "builtins.str" (you can link to external docs with --intersphinx)
- /projects/coco/code-postprocessing/cocopp/toolsdivers.py:224: Cannot find link target for "list"
... (truncated 6 lines) ...
pylint (https://github.com/pylint-dev/pylint)
- /projects/pylint/pylint/pyreverse/utils.py:239: bad docstring: Inline emphasis start-string without end-string.
- /projects/pylint/pylint/checkers/classes/class_checker.py:451: Cannot find link target for "property"
- /projects/pylint/pylint/checkers/classes/class_checker.py:451: Cannot find link target for "property"
- /projects/pylint/pylint/checkers/deprecated.py:181: Cannot find link target for "arg2"
- /projects/pylint/pylint/checkers/deprecated.py:181: Cannot find link target for "arg4"
urllib3 (https://github.com/urllib3/urllib3)
- /projects/urllib3/src/urllib3/__init__.py:144: Cannot find link target for "str"
- /projects/urllib3/src/urllib3/__init__.py:144: Cannot find link target for "bytes"
- /projects/urllib3/src/urllib3/_request_methods.py:96: Cannot find link target for "str"
- /projects/urllib3/src/urllib3/_request_methods.py:96: Cannot find link target for "bytes"
- /projects/urllib3/src/urllib3/exceptions.py:92: Cannot find link target for "Exception"
+ /projects/urllib3/src/urllib3/exceptions.py:92: Cannot find link target for "builtins.Exception" (you can link to external docs with --intersphinx)
- /projects/urllib3/src/urllib3/util/url.py:166: Cannot find link target for ".parse_url" (you can link to external docs with --intersphinx)
- /projects/urllib3/src/urllib3/connectionpool.py:628: Cannot find link target for "preload_content=False"
- /projects/urllib3/src/urllib3/connectionpool.py:639: Cannot find link target for "str"
- /projects/urllib3/src/urllib3/connectionpool.py:639: Cannot find link target for "bytes"
- /projects/urllib3/src/urllib3/connectionpool.py:408: Cannot find link target for "str"
- /projects/urllib3/src/urllib3/connectionpool.py:408: Cannot find link target for "bytes"
ConfigArgParse (https://github.com/bw2/ConfigArgParse)
- /projects/ConfigArgParse/configargparse.py:99: Cannot find link target for "IO"
- /projects/ConfigArgParse/configargparse.py:99: Cannot find link target for "IO"
- /projects/ConfigArgParse/configargparse.py:99: Cannot find link target for "IO"
- /projects/ConfigArgParse/configargparse.py:99: Cannot find link target for "IO"
scrapy (https://github.com/scrapy/scrapy)
- /projects/scrapy/scrapy/core/scheduler.py:133: bad docstring: No role entry for "setting" in module "docutils.parsers.rst.languages.en".
- Trying "setting" as canonical role name.
- /projects/scrapy/scrapy/core/scheduler.py:133: bad docstring: Unknown interpreted text role "setting".
- /projects/scrapy/scrapy/core/scheduler.py:133: bad docstring: No role entry for "setting" in module "docutils.parsers.rst.languages.en".
- Trying "setting" as canonical role name.
- /projects/scrapy/scrapy/core/scheduler.py:133: bad docstring: Unknown interpreted text role "setting".
- /projects/scrapy/scrapy/loader/__init__.py:16: bad docstring: No role entry for "ref" in module "docutils.parsers.rst.languages.en".
- Trying "ref" as canonical role name.
- /projects/scrapy/scrapy/loader/__init__.py:16: bad docstring: Unknown interpreted text role "ref".
- /projects/scrapy/scrapy/loader/__init__.py:16: bad docstring: No role entry for "ref" in module "docutils.parsers.rst.languages.en".
- Trying "ref" as canonical role name.
- /projects/scrapy/scrapy/loader/__init__.py:16: bad docstring: Unknown interpreted text role "ref".
- /projects/scrapy/scrapy/http/request/__init__.py:206: bad docstring: No role entry for "ref" in module "docutils.parsers.rst.languages.en".
- Trying "ref" as canonical role name.
- /projects/scrapy/scrapy/http/request/__init__.py:206: bad docstring: Unknown interpreted text role "ref".
- /projects/scrapy/scrapy/utils/defer.py:367: bad docstring: No role entry for "ref" in module "docutils.parsers.rst.languages.en".
- Trying "ref" as canonical role name.
- /projects/scrapy/scrapy/utils/defer.py:367: bad docstring: Unknown interpreted text role "ref".
- /projects/scrapy/scrapy/crawler.py:426: bad docstring: No role entry for "setting" in module "docutils.parsers.rst.languages.en".
- Trying "setting" as canonical role name.
- /projects/scrapy/scrapy/crawler.py:426: bad docstring: Unknown interpreted text role "setting".
- /projects/scrapy/scrapy/crawler.py:426: bad docstring: No role entry for "setting" in module "docutils.parsers.rst.languages.en".
- Trying "setting" as canonical role name.
- /projects/scrapy/scrapy/crawler.py:426: bad docstring: Unknown interpreted text role "setting".
- /projects/scrapy/scrapy/downloadermiddlewares/retry.py:85: bad docstring: No role entry for "ref" in module "docutils.parsers.rst.languages.en".
- Trying "ref" as canonical role name.
- /projects/scrapy/scrapy/downloadermiddlewares/retry.py:85: bad docstring: Unknown interpreted text role "ref".
- /projects/scrapy/scrapy/downloadermiddlewares/retry.py:93: bad docstring: No role entry for "reqmeta" in module "docutils.parsers.rst.languages.en".
- Trying "reqmeta" as canonical role name.
- /projects/scrapy/scrapy/downloadermiddlewares/retry.py:93: bad docstring: Unknown interpreted text role "reqmeta".
- /projects/scrapy/scrapy/core/scheduler.py:151: Cannot find link target for "str"
+ /projects/scrapy/scrapy/core/scheduler.py:151: Cannot find link target for "builtins.str" (you can link to external docs with --intersphinx)
- /projects/scrapy/scrapy/exporters.py:310: Cannot find link target for "bytes"
+ /projects/scrapy/scrapy/exporters.py:310: Cannot find link target for "builtins.bytes" (you can link to external docs with --intersphinx)
- /projects/scrapy/scrapy/http/response/text.py:251: Cannot find link target for "~.Request" (you can link to external docs with --intersphinx)
- /projects/scrapy/scrapy/http/response/__init__.py:56: Cannot find link target for "str"
- /projects/scrapy/scrapy/loader/__init__.py:36: Cannot find link target for "scrapy.item.Item", resolved from "default_item_class"
- /projects/scrapy/scrapy/loader/__init__.py:31: Cannot find link target for "scrapy.selector.Selector", resolved from "default_selector_class"
- /projects/scrapy/scrapy/robotstxt.py:48: Cannot find link target for "~scrapy.crawler.Crawler" (you can link to external docs with --intersphinx)
- /projects/scrapy/scrapy/robotstxt.py:48: Cannot find link target for "~scrapy.crawler.Crawler" (you can link to external docs with --intersphinx)
- /projects/scrapy/scrapy/robotstxt.py:48: Cannot find link target for "~scrapy.crawler.Crawler" (you can link to external docs with --intersphinx)
- /projects/scrapy/scrapy/robotstxt.py:48: Cannot find link target for "~scrapy.crawler.Crawler" (you can link to external docs with --intersphinx)
- /projects/scrapy/scrapy/utils/request.py:126: Cannot find link target for "scrapy.http.request.Request.url", resolved from "scrapy.http.Request.url"
- /projects/scrapy/scrapy/utils/request.py:127: Cannot find link target for "scrapy.http.request.Request.method", resolved from "scrapy.http.Request.method"
... (truncated 330 lines) ...``` |
Fixes #295.
We're running a docutils transformer on the parsed docstrings to resolve locally existing names early, it sets a
refuri
attribute on reference nodes. This means all parsed docstrings must be cached as a Documentable attribute: so I’ve create a little memoize function for that. The transform is ran at the time we're leaving the module (but it should run in post-processing when #724 is merged), so stuff inside the module have not been reparented yet (or never will be). The linker also got updated to be able to link to an object with it's outdated (before reparenting) fullname, which could be what we stored in therefuri
attribute earlier by our transformer.There are a couple of blind spot:
decorator, attribute values and function annotations within the parameter table do not have theirparsed_*
attribute to storeParsedDocstring
instance, so no transformation is possible at the moment. These ParsedDocstring are create at the time of the stan generation, it's worthless to apply the transformation at this step of processing since we already loose the original code model structure. So we really need to have the ParsedDocstring stored in Documentable attributes.names that are both defined in a class level and at the module level will not be expanded because of ambiguity. Basically that would require to mimic the logic implemented in Fix name resolving issues #663 into the._ReferenceTransform
we loose the formatting detail of the reference, we don't know anymore at the time of resolving the link if the developer wrote.L{split}
orL{split <os.path.split>}
links to builtins are broken in reparented class inside a module that shadows some of the builtinsparsed_docstring
attribute set at the time we're transforming links, because the docstring can come from inherited members. To fix this situation all the reparenting should be taking place in post-processing (Rework reparenting and allobjects attribute #725) and link transformation as well (after MRO computing and before reparenting).This PR does not cover all improvements cited in #295. Especially a new issue should be created to actually separate our code model VS our view model. The view model would be initiated in post-processing. The separation between the two models could firstly be done with
Protocol
classes (so we keep a unique structure at first) defining all required attributes byastbuilder
andtemplatewriter
. Classes that would be used to annotateDocumentable
to restrict the attributes that can be accessed. Then we could look at creating two sets of concrete classes.The main challenge of that operation (and probably the reason it has not been done a long time ago) is that the code model is strongly couple with the docstring parsing. Namely:
@ivar
-like fields which creates model instance withparsed_docstring
attribute already populated.Function.signature
attribute which stores ast values as ParsedDocstring in _ValueFormatter.parsed_docstring
attribute already populated.The main goal being not perform docstring parsing until we have the final state for all objects.