-
Notifications
You must be signed in to change notification settings - Fork 56
Pre-process parsed docstrings to add hints on how to resolve names #723
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
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( 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
@@ -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, > |
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.
This comment has been minimized.
This comment has been minimized.
for p in ob.signature.parameters.values(): | ||
ann = p.annotation if p.annotation is not inspect.Parameter.empty else None | ||
if isinstance(ann, astbuilder._ValueFormatter): | ||
_apply_reference_transform(ann.parsed, ob, is_annotation=True) | ||
default = p.default if p.default is not inspect.Parameter.empty else None | ||
if isinstance(default, astbuilder._ValueFormatter): | ||
_apply_reference_transform(default.parsed, 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.
This process might not be compatible with what's beeing proposed in #831.
I'll have to think about how to merge parsed docstrings while beeing able to transform the underlying docutils tree, or not merge docstrings in the model bu rather in the temaplatewriter...
This comment has been minimized.
This comment has been minimized.
# transform bare builtin name into builtins.<name> | ||
attribs['refuri'] = '.'.join(('builtins', name, *rest)) |
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 might not be necessary
Diff from pydoctor_primer, showing the effect of this PR on open source code: 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"
attrs (https://github.com/python-attrs/attrs)
- /projects/attrs/src/attr/_make.py:379: bad docstring: Inline interpreted text or phrase reference start-string without end-string.
- /projects/attrs/src/attr/_next_gen.py:49: bad docstring: No role entry for "term" in module "docutils.parsers.rst.languages.en".
- Trying "term" as canonical role name.
- /projects/attrs/src/attr/_next_gen.py:49: bad docstring: Unknown interpreted text role "term".
- /projects/attrs/src/attr/_next_gen.py:61: bad docstring: No role entry for "term" in module "docutils.parsers.rst.languages.en".
- Trying "term" as canonical role name.
- /projects/attrs/src/attr/_next_gen.py:61: bad docstring: Unknown interpreted text role "term".
- /projects/attrs/src/attr/_next_gen.py:435: bad docstring: No role entry for "term" in module "docutils.parsers.rst.languages.en".
- Trying "term" as canonical role name.
- /projects/attrs/src/attr/_next_gen.py:435: bad docstring: Unknown interpreted text role "term".
- /projects/attrs/src/attr/_funcs.py:236: Cannot find link target for "dict"
- /projects/attrs/src/attr/_make.py:62: Cannot find link target for "None"
- /projects/attrs/src/attr/_make.py:93: Cannot find link target for "None"
+ /projects/attrs/src/attr/_make.py:62: Cannot find link target for "builtins.None" (you can link to external docs with --intersphinx)
+ /projects/attrs/src/attr/_make.py:93: 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:164: Cannot find link target for "re.fullmatch" (you can link to external docs with --intersphinx)
- /projects/attrs/src/attr/validators.py:634: Cannot find link target for "ValueError"
- /projects/attrs/src/attr/_make.py:2317: Cannot find link target for "str"
- /projects/attrs/src/attr/_make.py:2318: Cannot find link target for "str"
- /projects/attrs/src/attr/_make.py:2320: Cannot find link target for "bool"
+ /projects/attrs/src/attr/_make.py:2317: Cannot find link target for "builtins.str" (you can link to external docs with --intersphinx)
+ /projects/attrs/src/attr/_make.py:2318: Cannot find link target for "builtins.str" (you can link to external docs with --intersphinx)
+ /projects/attrs/src/attr/_make.py:2320: Cannot find link target for "builtins.bool" (you can link to external docs with --intersphinx)
- /projects/attrs/src/attr/_make.py:2322: Cannot find link target for "None"
+ /projects/attrs/src/attr/_make.py:2322: Cannot find link target for "builtins.None" (you can link to external docs with --intersphinx)
- /projects/attrs/src/attr/_make.py:2756: Cannot find link target for "False"
- /projects/attrs/src/attr/_make.py:2760: Cannot find link target for "False"
+ /projects/attrs/src/attr/_make.py:2756: Cannot find link target for "builtins.False" (you can link to external docs with --intersphinx)
+ /projects/attrs/src/attr/_make.py:2760: Cannot find link target for "builtins.False" (you can link to external docs with --intersphinx)
pycma (https://github.com/CMA-ES/pycma)
- /projects/pycma/cma/__init__.py:36: Cannot find link target for "numpy"
- /projects/pycma/cma/constraints_handler.py:318: Cannot find link target for "None"
- /projects/pycma/cma/constraints_handler.py:439: Cannot find link target for "x"
- /projects/pycma/cma/constraints_handler.py:392: Cannot find link target for "None"
- /projects/pycma/cma/constraints_handler.py:583: Cannot find link target for "cma.constraints_handler.ConstrainedSolutionsArchive.archive.infos", resolved from "archive.infos"
+ /projects/pycma/cma/constraints_handler.py:583: Cannot find link target for "cma.constraints_handler.ConstrainedSolutionsArchive.archive.infos"
- /projects/pycma/cma/constraints_handler.py:687: Cannot find link target for "list"
+ /projects/pycma/cma/constraints_handler.py:687: Cannot find link target for "builtins.list" (you can link to external docs with --intersphinx)
- /projects/pycma/cma/constraints_handler.py:1099: Cannot find link target for "True"
+ /projects/pycma/cma/constraints_handler.py:1099: Cannot find link target for "builtins.True" (you can link to external docs with --intersphinx)
- /projects/pycma/cma/constraints_handler.py:985: Cannot find link target for "TypeError"
+ /projects/pycma/cma/constraints_handler.py:985: Cannot find link target for "builtins.TypeError" (you can link to external docs with --intersphinx)
- /projects/pycma/cma/constraints_handler.py:1309: Cannot find link target for "False"
+ /projects/pycma/cma/constraints_handler.py:1309: Cannot find link target for "builtins.False" (you can link to external docs with --intersphinx)
- /projects/pycma/cma/constraints_handler.py:1358: Cannot find link target for "False"
+ /projects/pycma/cma/constraints_handler.py:1358: Cannot find link target for "builtins.False" (you can link to external docs with --intersphinx)
- /projects/pycma/cma/evolution_strategy.py:3836: Cannot find link target for "dict"
- /projects/pycma/cma/evolution_strategy.py:3881: Cannot find link target for "bipop"
- /projects/pycma/cma/evolution_strategy.py:1768: Cannot find link target for "list"
- /projects/pycma/cma/evolution_strategy.py:1766: Cannot find link target for "numpy.ndarray" (you can link to external docs with --intersphinx)
- /projects/pycma/cma/evolution_strategy.py:1803: Cannot find link target for "func"
- /projects/pycma/cma/evolution_strategy.py:3078: Cannot find link target for "d"
- /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/fitness_transformations.py:632: Cannot find link target for "numpy.round", resolved from "np.round" (you can link to external docs with --intersphinx)
+ /projects/pycma/cma/fitness_transformations.py:632: Cannot find link target for "numpy.round" (you can link to external docs with --intersphinx)
- /projects/pycma/cma/fitness_transformations.py:681: Cannot find link target for "numpy.floor", resolved from "np.floor" (you can link to external docs with --intersphinx)
+ /projects/pycma/cma/fitness_transformations.py:681: Cannot find link target for "numpy.floor" (you can link to external docs with --intersphinx)
- /projects/pycma/cma/integer_centering.py:218: Cannot find link target for "tell"
- /projects/pycma/cma/integer_centering.py:272: Cannot find link target for "correct_bias"
- /projects/pycma/cma/integer_centering.py:380: Cannot find link target for "solution_list"
- /projects/pycma/cma/logger.py:1863: ambiguous ref to name, could be cma.logger.LoggerDummy.name, cma.logger.Logger.name
- /projects/pycma/cma/logger.py:1863: Cannot find link target for "name"
- /projects/pycma/cma/logger.py:1648: Cannot find link target for "first"
- /projects/pycma/cma/logger.py:2213: 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/options_parameters.py:135: Cannot find link target for "dict"
- /projects/pycma/cma/options_parameters.py:233: Cannot find link target for "dict"
+ /projects/pycma/cma/options_parameters.py:233: Cannot find link target for "builtins.dict" (you can link to external docs with --intersphinx)
- /projects/pycma/cma/options_parameters.py:254: Cannot find link target for "tolstagnation"
- /projects/pycma/cma/options_parameters.py:528: Cannot find link target for "key"
- /projects/pycma/cma/options_parameters.py:586: Cannot find link target for "loc"
- /projects/pycma/cma/options_parameters.py:1008: Cannot find link target for "int"
- /projects/pycma/cma/options_parameters.py:1009: Cannot find link target for "float"
+ /projects/pycma/cma/options_parameters.py:1008: Cannot find link target for "builtins.int" (you can link to external docs with --intersphinx)
+ /projects/pycma/cma/options_parameters.py:1009: Cannot find link target for "builtins.float" (you can link to external docs with --intersphinx)
- /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" (yo
10000
u 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:636: Cannot find link target for "d"
- /projects/pycma/cma/sampler.py:666: Cannot find link target for "int"
+ /projects/pycma/cma/sampler.py:666: Cannot find link target for "builtins.int" (you can link to external docs with --intersphinx)
- /projects/pycma/cma/sampler.py:883: 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:222: Cannot find link target for "list"
+ /projects/pycma/cma/utilities/math.py:222: Cannot find link target for "builtins.list" (you can link to external docs with --intersphinx)
- /projects/pycma/cma/utilities/math.py:677: 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:476: Cannot find link target for "dict"
+ /projects/pycma/cma/utilities/utils.py:476: Cannot find link target for "builtins.dict" (you can link to external docs with --intersphinx)
... (truncated 9 lines) ...
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)
astroid (https://github.com/pylint-dev/astroid)
- /projects/astroid/astroid/manager.py:430: Cannot find link target for "hook"
- /projects/astroid/astroid/manager.py:432: Cannot find link target for "astroid.nodes.Module", resolved from "astroid.Module"
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:90: Cannot find link target for "Exception"
+ /projects/urllib3/src/urllib3/exceptions.py:90: 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:623: Cannot find link target for "preload_content=False"
- /projects/urllib3/src/urllib3/connectionpool.py:634: Cannot find link target for "str"
- /projects/urllib3/src/urllib3/connectionpool.py:634: Cannot find link target for "bytes"
- /projects/urllib3/src/urllib3/connectionpool.py:406: Cannot find link target for "str"
- /projects/urllib3/src/urllib3/connectionpool.py:406: Cannot find link target for "bytes"
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:56: 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:56: bad docstring: Unknown interpreted text role "file".
- /projects/coco/code-postprocessing/cocopp/pproc.py:3415: 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:3415: bad docstring: Unknown interpreted text role "file".
- /projects/coco/code-postprocessing/cocopp/cococommands.py:219: 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:219: bad docstring: Unknown interpreted text role "file".
- /projects/coco/code-postprocessing/cocopp/cococommands.py:219: 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:219: 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:430: Cannot find link target for "list"
+ /projects/coco/code-postprocessing/cocopp/archiving.py:430: Cannot find link target for "builtins.list" (you can link to external docs with --intersphinx)
- /projects/coco/code-postprocessing/cocopp/archiving.py:445: Cannot find link target for "print"
+ /projects/coco/code-postprocessing/cocopp/archiving.py:445: Cannot find link target for "builtins.print" (you can link to external docs with --intersphinx)
- /projects/coco/code-postprocessing/cocopp/archiving.py:463: Cannot find link target for "list"
+ /projects/coco/code-postprocessing/cocopp/archiving.py:463: Cannot find link target for "builtins.list" (you can link to external docs with --intersphinx)
- /projects/coco/code-postprocessing/cocopp/archiving.py:479: Cannot find link target for "list"
+ /projects/coco/code-postprocessing/cocopp/archiving.py:479: Cannot find link target for "builtins.list" (you can link to external docs with --intersphinx)
- /projects/coco/code-postprocessing/cocopp/archiving.py:479: Cannot find link target for "None"
+ /projects/coco/code-postprocessing/cocopp/archiving.py:479: Cannot find link target for "builtins.None" (you can link to external docs with --intersphinx)
- /projects/coco/code-postprocessing/cocopp/archiving.py:721: Cannot find link target for "*"
- /projects/coco/code-postprocessing/cocopp/archiving.py:785: Cannot find link target for "list"
+ /projects/coco/code-postprocessing/cocopp/archiving.py:785: Cannot find link target for "builtins.list" (you can link to external docs with --intersphinx)
- /projects/coco/code-postprocessing/cocopp/archiving.py:945: Cannot find link target for "list"
+ /projects/coco/code-postprocessing/cocopp/archiving.py:945: Cannot find link target for "builtins.list" (you can link to external docs with --intersphinx)
- /projects/coco/code-postprocessing/cocopp/archiving.py:996: Cannot find link target for "list"
+ /projects/coco/code-postprocessing/cocopp/archiving.py:996: Cannot find link target for "builtins.list" (you can link to external docs with --intersphinx)
- /projects/coco/code-postprocessing/cocopp/archiving.py:1163: Cannot find link target for "self"
- /projects/coco/code-postprocessing/cocopp/archiving.py:1186: Cannot find link target for "list"
+ /projects/coco/code-postprocessing/cocopp/archiving.py:1186: Cannot find link target for "builtins.list" (you can link to external docs with --intersphinx)
- /projects/coco/code-postprocessing/cocopp/archiving.py:1189: Cannot find link target for "list"
+ /projects/coco/code-postprocessing/cocopp/archiving.py:1189: Cannot find link target for "builtins.list" (you can link to external docs with --intersphinx)
- /projects/coco/code-postprocessing/cocopp/cococommands.py:6: ambiguous ref to DataSet, could be cocopp.algportfolio.DataSet, cocopp.pproc.DataSet
- /projects/coco/code-postprocessing/cocopp/cococommands.py:6: Cannot find link target for "DataSet"
- /projects/coco/code-postprocessing/cocopp/cococommands.py:6: ambiguous ref to DataSet, could be cocopp.algportfolio.DataSet, cocopp.pproc.DataSet
- /projects/coco/code-postprocessing/cocopp/cococommands.py:6: ambiguous ref to DataSet, could be cocopp.algportfolio.DataSet, cocopp.pproc.DataSet
- /projects/coco/code-postprocessing/cocopp/cococommands.py:38: ambiguous ref to DataSet, could be cocopp.algportfolio.DataSet, cocopp.pproc.DataSet
- /projects/coco/code-postprocessing/cocopp/cococommands.py:230: Cannot find link target for "dict"
- /projects/coco/code-postprocessing/cocopp/cococommands.py:75: ambiguous ref to DataSet, could be cocopp.algportfolio.DataSet, cocopp.pproc.DataSet
- /projects/coco/code-postprocessing/cocopp/cococommands.py:84: Cannot find link target for "dict"
+ /projects/coco/code-postprocessing/cocopp/cococommands.py:84: Cannot find link target for "builtins.dict" (you can link to external docs with --intersphinx)
- /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:422: 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:1617: Cannot find link target for "raw_values"
- /projects/coco/code-postprocessing/cocopp/pproc.py:2141: Cannot find link target for "nan"
- /projects/coco/code-postprocessing/cocopp/pproc.py:2193: Cannot find link target for "collections.OrderedDict", resolved from "OrderedDict" (you can link to external docs with --intersphinx)
+ /projects/coco/code-postprocessing/cocopp/pproc.py:2193: Cannot find link target for "collections.OrderedDict" (you can link to external docs with --intersphinx)
- /projects/coco/code-postprocessing/cocopp/pproc.py:1924: Cannot find link target for "numpy.array" (you can link to external docs with --intersphinx)
+ /projects/coco/code-postprocessing/cocopp/pproc.py:1986: Cannot find link target for "builtins.True" (you can link to external docs with --intersphinx)
- /projects/coco/code-postprocessing/cocopp/pproc.py:1986: Cannot find link target for "True"
- /projects/coco/code-postprocessing/cocopp/pproc.py:1325: Cannot find link target for "numpy.array", resolved from "np.array" (you can link to external docs with --intersphinx)
... (truncated 17 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:183: Cannot find link target for "arg2"
- /projects/pylint/pylint/checkers/deprecated.py:183: Cannot find link target for "arg4"
scrapy (https://github.com/scrapy/scrapy)
- /projects/scrapy/scrapy/core/scheduler.py:134: 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:134: bad docstring: Unknown interpreted text role "setting".
- /projects/scrapy/scrapy/core/scheduler.py:134: 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:134: bad docstring: Unknown interpreted text role "setting".
- /projects/scrapy/scrapy/loader/__init__.py:23: 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:23: bad docstring: Unknown interpreted text role "ref".
- /projects/scrapy/scrapy/loader/__init__.py:23: 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:23: bad docstring: Unknown interpreted text role "ref".
- /projects/scrapy/scrapy/http/request/__init__.py:237: 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:237: bad docstring: Unknown interpreted text role "ref".
- /projects/scrapy/scrapy/utils/defer.py:420: 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:420: bad docstring: Unknown interpreted text role "ref".
- /projects/scrapy/scrapy/crawler.py:203: bad docstring: No role entry for "signal" in module "docutils.parsers.rst.languages.en".
- Trying "signal" as canonical role name.
- /projects/scrapy/scrapy/crawler.py:203: bad docstring: Unknown interpreted text role "signal".
- /projects/scrapy/scrapy/crawler.py:220: bad docstring: No role entry for "signal" in module "docutils.parsers.rst.languages.en".
- Trying "signal" as canonical role name.
- /projects/scrapy/scrapy/crawler.py:220: bad docstring: Unknown interpreted text role "signal".
- /projects/scrapy/scrapy/crawler.py:238: bad docstring: No role entry for "signal" in module "docutils.parsers.rst.languages.en".
- Trying "signal" as canonical role name.
- /projects/scrapy/scrapy/crawler.py:238: bad docstring: Unknown interpreted text role "signal".
- /projects/scrapy/scrapy/crawler.py:255: bad docstring: No role entry for "signal" in module "docutils.parsers.rst.languages.en".
- Trying "signal" as canonical role name.
- /projects/scrapy/scrapy/crawler.py:255: bad docstring: Unknown interpreted text role "signal".
- /projects/scrapy/scrapy/crawler.py:465: 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:465: bad docstring: Unknown interpreted text role "setting".
- /projects/scrapy/scrapy/crawler.py:465: 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:465: bad docstring: Unknown interpreted text role "setting".
- /projects/scrapy/scrapy/downloadermiddlewares/retry.py:65: 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:65: bad docstring: Unknown interpreted text role "ref".
- /projects/scrapy/scrapy/downloadermiddlewares/retry.py:73: 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:73: bad docstring: Unknown interpreted text role "reqmeta".
- /projects/scrapy/scrapy/core/scheduler.py:152: Cannot find link target for "str"
... (truncated 339 lines) ...``` |
# some warnings can be reported more that once. | ||
thresh=thresh, > |
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.
# some warnings can be reported more that once. | |
thresh=thresh, once=True) | |
thresh=thresh) |
That PR was wrongly closed |
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 something like #724 is merged - that moves the reparenting to the post processing step).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 the
refuri
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.