Skip to content
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

Handle aliases as Documentables #775

Draft
wants to merge 71 commits into
base: master
Choose a base branch
from
Draft

Conversation

tristanlatr
Copy link
Contributor

Fix #313, Replaces PR #414

tristanlatr and others added 30 commits June 26, 2021 02:26
…l alias. An module-level alias must be defined at the top level of the module.
…computing it from AST all the time.

Consider variables that are not on the root level as aliases, too. And warns only when they are actually overriden.

Move node2fullname to astutils module.

Delete overridenInCount from ClassPage since it was unused.

Re-export names that are not part of the current system with an alias.

Cleanup expandName() and associated.

Use directly taglink() in format_alias_value() when possible.

Add Documentable.aliases property. This is somewhat working in the tests but not always in real life.

Rename the redirected_from parameter to "indirections".

Speaking of tests, this commit also adds A LOT of new tests for the expandName() method.
…astbuilder tests, mostly related to alias handling... I'll fix that after merging.

This comment has been minimized.

self.debug(f'Linker finds {part0} in {src} resolving name into {target}', lineno)
if (target is not None
and target not in potential_targets
and not any(target in t.aliases for t in potential_targets)):
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to be smarter here: replace an alias with its definition and ignore aliases that point to a definition already in the collection

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The linker seems still unable to correctly handle the aliases, diff from pydoctor_primer:

  • /projects/twisted/src/twisted/python/urlpath.py:179: ambiguous ref to URL, could be twisted.python._url.URL, twisted.python.url.URL
  • /projects/twisted/src/twisted/python/urlpath.py:179: ambiguous ref to URL, could be twisted.protocols.sip.URL, twisted.python._url.URL, twisted.python.url.URL
  • /projects/twisted/src/twisted/python/urlpath.py:179: Cannot find link target for "URL"
  • /projects/twisted/src/twisted/python/urlpath.py:180: ambiguous ref to URL, could be twisted.python._url.URL, twisted.python.url.URL
  • /projects/twisted/src/twisted/python/urlpath.py:180: ambiguous ref to URL, could be twisted.protocols.sip.URL, twisted.python._url.URL, twisted.python.url.URL
  • /projects/twisted/src/twisted/python/urlpath.py:180: Cannot find link target for "URL"
  • /projects/twisted/src/twisted/python/win32.py:46: Failed to resolve alias (found same alias again)

This comment has been minimized.

This comment has been minimized.

This comment has been minimized.

This comment has been minimized.

This comment has been minimized.

… can filter out duplicated external interdirections

This comment has been minimized.

This comment has been minimized.

This comment has been minimized.

Copy link

Diff from pydoctor_primer, showing the effect of this PR on open source code:

bottle (https://github.com/bottlepy/bottle)
- /projects/bottle/bottle.py:892: Cannot find link target for "GET"
- /projects/bottle/bottle.py:892: Cannot find link target for "GET"

scrapy (https://github.com/scrapy/scrapy)
+ /projects/scrapy/scrapy/exporters.py:337: Cannot find link target for "json"
- /projects/scrapy/scrapy/loader/__init__.py:43: Cannot find link target for "scrapy.item.Item", resolved from "default_item_class"
- /projects/scrapy/scrapy/loader/__init__.py:38: Cannot find link target for "scrapy.selector.Selector", resolved from "default_selector_class"
- /projects/scrapy/scrapy/utils/request.py:128: Cannot find link target for "scrapy.http.request.Request.url", resolved from "scrapy.http.Request.url"
- /projects/scrapy/scrapy/utils/request.py:129: Cannot find link target for "scrapy.http.request.Request.method", resolved from "scrapy.http.Request.method"
- /projects/scrapy/scrapy/utils/request.py:130: Cannot find link target for "scrapy.http.request.Request.body", resolved from "scrapy.http.Request.body"

astroid (https://github.com/pylint-dev/astroid)
- /projects/astroid/astroid/manager.py:436: Cannot find link target for "astroid.nodes.Module", resolved from "astroid.Module"

pycma (https://github.com/CMA-ES/pycma)
- /projects/pycma/cma/constraints_handler.py:1336: Cannot find link target for "es"
+ /projects/pycma/cma/fitness_functions.py:584: Cannot find link target for "cma.fitness_functions._F_0.fun.final_target_hit", resolved from "fun.final_target_hit"
- /projects/pycma/cma/fitness_models.py:267: Cannot find link target for "cma.fitness_models.SurrogatePopulation.settings.max_absolute_size", resolved from "model.settings.max_absolute_size"
+ /projects/pycma/cma/fitness_models.py:267: Cannot find link target for "cma.fitness_models.SurrogatePopulation.model.settings.max_absolute_size", resolved from "model.settings.max_absolute_size"
- /projects/pycma/cma/fitness_models.py:267: Cannot find link target for "cma.fitness_models.SurrogatePopulation.settings.truncation_ratio", resolved from "model.settings.truncation_ratio"
+ /projects/pycma/cma/fitness_models.py:267: Cannot find link target for "cma.fitness_models.SurrogatePopulation.model.settings.truncation_ratio", resolved from "model.settings.truncation_ratio"
- /projects/pycma/cma/purecma.py:875: Cannot find link target for "eval"
- /projects/pycma/cma/purecma.py:879: Cannot find link target for "eval"
- /projects/pycma/cma/purecma.py:543: Cannot find link target for "es"
- /projects/pycma/cma/sigma_adaptation.py:93: Cannot find link target for "es"
- /projects/pycma/cma/sigma_adaptation.py:241: Cannot find link target for "es"
- /projects/pycma/cma/sigma_adaptation.py:204: Cannot find link target for "es"
- /projects/pycma/cma/transformations.py:915: Cannot find link target for "tf"
- /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.input", resolved from "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"

attrs (https://github.com/python-attrs/attrs)
+ /projects/attrs/src/attr/__init__.py:31: Failed to resolve alias (found same alias again)
+ /projects/attrs/src/attr/__init__.py:31: Failed to resolve alias (found same alias again)
+ /projects/attrs/src/attr/__init__.py:31: Failed to resolve alias (found same alias again)
+ /projects/attrs/src/attr/__init__.py:31: Failed to resolve alias (found same alias again)
+ /projects/attrs/src/attr/__init__.py:31: Failed to resolve alias (found same alias again)
+ /projects/attrs/src/attr/_funcs.py:32: Cannot find link target for "attr.attrs.Attribute", resolved from "attrs.Attribute"
+ /projects/attrs/src/attr/_funcs.py:384: Cannot find link target for "attr.attrs.evolve", resolved from "attrs.evolve"
+ /projects/attrs/src/attr/_funcs.py:384: Cannot find link target for "attr.attrs.evolve", resolved from "attrs.evolve"
+ /projects/attrs/src/attr/_funcs.py:228: Cannot find link target for "attr.attrs.Attribute", resolved from "attrs.Attribute"
+ /projects/attrs/src/attr/_make.py:121: Cannot find link target for "attr.attrs.field", resolved from "attrs.field"
+ /projects/attrs/src/attr/_make.py:123: Cannot find link target for "attr.attrs.field", resolved from "attrs.field"
+ /projects/attrs/src/attr/_make.py:1202: Cannot find link target for "attr.attrs.define", resolved from "attrs.define"
+ /projects/attrs/src/attr/_make.py:1202: Cannot find link target for "attr.attrs.frozen", resolved from "attrs.frozen"
+ /projects/attrs/src/attr/_make.py:1213: Cannot find link target for "attr.attrs.define", resolved from "attrs.define"
+ /projects/attrs/src/attr/_cmp.py:23: Cannot find link target for "attr.attrs.field", resolved from "attrs.field"
+ /projects/attrs/src/attr/_next_gen.py:111: Cannot find link target for "attr.attrs.setters.pipe", resolved from "attrs.setters.pipe"
+ /projects/attrs/src/attr/_next_gen.py:199: Cannot find link target for "attr.attrs.exceptions.FrozenInstanceError", resolved from "attrs.exceptions.FrozenInstanceError"
+ /projects/attrs/src/attr/_next_gen.py:275: Cannot find link target for "attr.attrs.field", resolved from "attrs.field"
+ /projects/attrs/src/attr/_next_gen.py:277: Cannot find link target for "attr.attrs.field", resolved from "attrs.field"
+ /projects/attrs/src/attr/_next_gen.py:282: Cannot find link target for "attr.attrs.exceptions.UnannotatedAttributeError", resolved from "attrs.exceptions.UnannotatedAttributeError"
+ /projects/attrs/src/attr/_next_gen.py:440: Cannot find link target for "attr.attrs.define", resolved from "attrs.define"
+ /projects/attrs/src/attr/_next_gen.py:448: Cannot find link target for "attr.attrs.Factory", resolved from "attrs.Factory"
+ /projects/attrs/src/attr/_next_gen.py:452: Cannot find link target for "attr.attrs.NOTHING", resolved from "attrs.NOTHING"
+ /projects/attrs/src/attr/_next_gen.py:474: Cannot find link target for "attr.attrs.validators.get_disabled", resolved from "attrs.validators.get_disabled"
+ /projects/attrs/src/attr/_next_gen.py:474: Cannot find link target for "attr.attrs.validators.set_disabled", resolved from "attrs.validators.set_disabled"
+ /projects/attrs/src/attr/_next_gen.py:567: Cannot find link target for "attr.attrs.setters.NO_OP", resolved from "attrs.setters.NO_OP"
+ /projects/attrs/src/attr/_next_gen.py:582: Cannot find link target for "attr.attrs.make_class", resolved from "attrs.make_class"
+ /projects/attrs/src/attr/_make.py:1710: Cannot find link target for "attr.attrs.Attribute", resolved from "attrs.Attribute"
+ /projects/attrs/src/attr/_make.py:2800: Cannot find link target for "attr.attrs.field", resolved from "attrs.field"
+ /projects/attrs/src/attr/_funcs.py:495: Cannot find link target for "attr.attrs.define", resolved from "attrs.define"
+ /projects/attrs/src/attr/_funcs.py:495: Cannot find link target for "attr.attrs.define", resolved from "attrs.define"
+ /projects/attrs/src/attr/_make.py:81: Cannot find link target for "None"
+ /projects/attrs/src/attr/_config.py:30: Cannot find link target for "attrs.validators.get_disabled" (you can link to external docs with --intersphinx)
+ /projects/attrs/src/attr/_config.py:15: Cannot find link target for "attrs.validators.set_disabled" (you can link to external docs with --intersphinx)
+ /projects/attrs/src/attr/converters.py:62: Cannot find link target for "attrs.Factory" (you can link to external docs with --intersphinx)
+ /projects/attrs/src/attr/converters.py:75: Cannot find link target for "attrs.Factory" (you can link to external docs with --intersphinx)
+ /projects/attrs/src/attr/filters.py:4: Cannot find link target for "attrs.asdict" (you can link to external docs with --intersphinx)
+ /projects/attrs/src/attr/filters.py:4: Cannot find link target for "attrs.astuple" (you can link to external docs with --intersphinx)
+ /projects/attrs/src/attr/filters.py:58: Cannot find link target for "attrs.asdict" (you can link to external docs with --intersphinx)
+ /projects/attrs/src/attr/filters.py:59: Cannot find link target for "attrs.astuple" (you can link to external docs with --intersphinx)
+ /projects/attrs/src/attr/filters.py:31: Cannot find link target for "attrs.asdict" (you can link to external docs with --intersphinx)
+ /projects/attrs/src/attr/filters.py:32: Cannot find link target for "attrs.astuple" (you can link to external docs with --intersphinx)
+ /projects/attrs/src/attr/validators.py:274: Cannot find link target for "attr.attrs.Attribute", resolved from "attrs.Attribute"
+ /projects/attrs/src/attr/validators.py:123: Cannot find link target for "attr.attrs.Attribute", resolved from "attrs.Attribute"
+ /projects/attrs/src/attr/validators.py:316: Cannot find link target for "attr.attrs.exceptions.NotCallableError", resolved from "attrs.exceptions.NotCallableError"
+ /projects/attrs/src/attr/validators.py:325: Cannot find link target for "attr.attrs.Attribute", resolved from "attrs.Attribute"
+ /projects/attrs/src/attr/validators.py:655: Cannot find link target for "attr.attrs.Attribute", resolved from "attrs.Attribute"
+ /projects/attrs/src/attr/validators.py:589: Cannot find link target for "attr.attrs.Attribute", resolved from "attrs.Attribute"
+ /projects/attrs/src/attr/_make.py:2388: Cannot find link target for "attr.attrs.evolve", resolved from "attrs.evolve"
+ /projects/attrs/src/attr/_make.py:2614: Cannot find link target for "attr.attrs.field", resolved from "attrs.field"

coco (https://github.com/numbbo/coco)
- /projects/coco/code-postprocessing/cocopp/pproc.py:1122: Cannot find link target for "samplesize"
- /projects/coco/code-postprocessing/cocopp/pproc.py:1131: Cannot find link target for "samplesize"
- /projects/coco/code-postprocessing/cocopp/pproc.py:1153: Cannot find link target for "samplesize"
- /projects/coco/code-postprocessing/cocopp/toolsstats.py:191: Cannot find link target for "samplesize"
- /projects/coco/code-postprocessing/cocopp/toolsstats.py:342: Cannot find link target for "samplesize"

sphinx (https://github.com/sphinx-doc/sphinx)
+ /projects/sphinx/sphinx/domains/__init__.py:77: Cannot find link target for "domain.name" (you can link to external docs with --intersphinx)
- /projects/sphinx/sphinx/ext/autosummary/__init__.py:752: ambiguous ref to text, could be sphinx.builders.text, sphinx.writers.text
- /projects/sphinx/sphinx/ext/autosummary/__init__.py:752: ambiguous ref to text, could be sphinx.builders.text, sphinx.writers.text
- /projects/sphinx/sphinx/testing/path.py:162: ambiguous ref to text, could be sphinx.builders.text, sphinx.writers.text

docutils (https://github.com/docutils/docutils)
- /projects/docutils/docutils/docutils/core.py:741: ambiguous ref to parser_name, could be docutils.parsers.commonmark_wrapper.parser_name, docutils.parsers.rst.directives.parser_name
- /projects/docutils/docutils/docutils/core.py:741: Cannot find link target for "parser_name"
+ /projects/docutils/docutils/docutils/io.py:56: Cannot find link target for "encoding"
+ /projects/docutils/docutils/docutils/io.py:60: Cannot find link target for "encoding"
+ /projects/docutils/docutils/docutils/io.py:62: Cannot find link target for "encoding"
+ /projects/docutils/docutils/docutils/statemachine.py:549: Cannot find link target for "re"
- /projects/docutils/docutils/docutils/readers/pep.py:45: ambiguous ref to parser_name, could be docutils.parsers.commonmark_wrapper.parser_name, docutils.parsers.rst.directives.parser_name
- /projects/docutils/docutils/docutils/readers/pep.py:45: Cannot find link target for "parser_name"
+ /projects/docutils/docutils/docutils/utils/__init__.py:392: Cannot find link target for "path"
+ /projects/docutils/docutils/docutils/utils/__init__.py:637: Cannot find link target for "path"
+ /projects/docutils/docutils/docutils/utils/__init__.py:848: Cannot find link target for "path"
+ /projects/docutils/docutils/docutils/writers/_html_base.py:500: Cannot find link target for "path"
+ /projects/docutils/docutils/docutils/writers/latex2e/__init__.py:1392: Cannot find link target for "path"

sdk-python (https://github.com/temporalio/sdk-python)
- /projects/sdk-python/temporalio/client.py:1172: ambiguous ref to update, could be temporalio.api.update, temporalio.workflow.update
- /projects/sdk-python/temporalio/client.py:1172: Cannot find link target for "update"

numpy (https://github.com/numpy/numpy)
+ /projects/numpy/numpy/__init__.py:97: Too many aliases
- /projects/numpy/numpy/_core/_asarray.py:55: Cannot find link target for "ndarray"
- /projects/numpy/numpy/_core/_internal.py:435: Cannot find link target for "numpy._core.multiarray.ndarray", resolved from "ndarray"
- /projects/numpy/numpy/_core/_internal.py:438: Cannot find link target for "numpy._core.multiarray.ndarray", resolved from "ndarray"
- /projects/numpy/numpy/_core/_ufunc_config.py:4: Cannot find link target for "numpy._core.umath._get_extobj_dict", resolved from "_get_extobj_dict"
+ /projects/numpy/numpy/_core/_ufunc_config.py:4: Cannot find link target for "numpy._core._multiarray_umath._get_extobj_dict", resolved from "_get_extobj_dict"
- /projects/numpy/numpy/_core/_ufunc_config.py:4: Cannot find link target for "numpy._core.umath._make_extobj", resolved from "_make_extobj"
+ /projects/numpy/numpy/_core/_ufunc_config.py:4: Cannot find link target for "numpy._core._multiarray_umath._make_extobj", resolved from "_make_extobj"
- /projects/numpy/numpy/_core/_ufunc_config.py:5: Cannot find link target for "numpy._core.umath._extobj_contextvar", resolved from "_extobj_contextvar"
+ /projects/numpy/numpy/_core/_ufunc_config.py:5: Cannot find link target for "numpy._core._multiarray_umath._extobj_contextvar", resolved from "_extobj_contextvar"
+ /projects/numpy/numpy/_core/code_generators/generate_umath.py:59: Cannot find link target for "none"
+ /projects/numpy/numpy/_core/code_generators/generate_umath.py:73: Cannot find link target for "none"
- /projects/numpy/numpy/_core/defchararray.py:1254: Cannot find link target for "bytes"
- /projects/numpy/numpy/_core/strings.py:1105: Cannot find link target for "numpy._core.numeric.ndarray", resolved from "ndarray"
- /projects/numpy/numpy/_core/strings.py:643: Cannot find link target for "numpy._core.numeric.ndarray", resolved from "ndarray"
- /projects/numpy/numpy/_core/strings.py:378: Cannot find link target for "numpy._core.numeric.ndarray", resolved from "ndarray"
- /projects/numpy/numpy/_core/strings.py:503: Cannot find link target for "numpy._core.numeric.ndarray", resolved from "ndarray"
- /projects/numpy/numpy/_core/strings.py:550: Cannot find link target for "numpy._core.numeric.ndarray", resolved from "ndarray"
- /projects/numpy/numpy/_core/strings.py:464: Cannot find link target for "numpy._core.numeric.ndarray", resolved from "ndarray"
- /projects/numpy/numpy/_core/defchararray.py:75: Cannot find link target for "numpy._core.numeric.ndarray", resolved from "ndarray"
- /projects/numpy/numpy/_core/strings.py:599: Cannot find link target for "numpy._core.numeric.ndarray", resolved from "ndarray"
- /projects/numpy/numpy/_core/strings.py:234: Cannot find link target for "numpy._core.numeric.ndarray", resolved from "ndarray"
- /projects/numpy/numpy/_core/defchararray.py:212: Cannot find link target for "numpy._core.numeric.ndarray", resolved from "ndarray"
- /projects/numpy/numpy/_core/defchararray.py:144: Cannot find link target for "numpy._core.numeric.ndarray", resolved from "ndarray"
- /projects/numpy/numpy/_core/strings.py:311: Cannot find link target for "numpy._core.numeric.ndarray", resolved from "ndarray"
- /projects/numpy/numpy/_core/strings.py:1241: Cannot find link target for "numpy._core.numeric.ndarray", resolved from "ndarray"
- /projects/numpy/numpy/_core/defchararray.py:246: Cannot find link target for "numpy._core.numeric.ndarray", resolved from "ndarray"
- /projects/numpy/numpy/_core/defchararray.py:178: Cannot find link target for "numpy._core.numeric.ndarray", resolved from "ndarray"
- /projects/numpy/numpy/_core/strings.py:703: Cannot find link target for "numpy._core.numeric.ndarray", resolved from "ndarray"
- /projects/numpy/numpy/_core/strings.py:1029: Cannot find link target for "numpy._core.numeric.ndarray", resolved from "ndarray"
- /projects/numpy/numpy/_core/strings.py:861: Cannot find link target for "numpy._core.numeric.ndarray", resolved from "ndarray"
- /projects/numpy/numpy/_core/strings.py:195: Cannot find link target for "numpy._core.numeric.ndarray", resolved from "ndarray"
- /projects/numpy/numpy/_core/defchararray.py:279: Cannot find link target for "numpy._core.numeric.ndarray", resolved from "ndarray"
- /projects/numpy/numpy/_core/defchararray.py:109: Cannot find link target for "numpy._core.numeric.ndarray", resolved from "ndarray"
- /projects/numpy/numpy/_core/defchararray.py:336: Cannot find link target for "numpy._core.numeric.ndarray", resolved from "ndarray"
- /projects/numpy/numpy/_core/strings.py:1188: Cannot find link target for "numpy._core.numeric.ndarray", resolved from "ndarray"
- /projects/numpy/numpy/_core/strings.py:271: Cannot find link target for "numpy._core.numeric.ndarray", resolved from "ndarray"
- /projects/numpy/numpy/_core/strings.py:345: Cannot find link target for "numpy._core.numeric.ndarray", resolved from "ndarray"
- /projects/numpy/numpy/_core/strings.py:760: Cannot find link target for "numpy._core.numeric.ndarray", resolved from "ndarray"
- /projects/numpy/numpy/_core/defchararray.py:377: Cannot find link target for "numpy._core.numeric.ndarray", resolved from "ndarray"
- /projects/numpy/numpy/_core/strings.py:1327: Cannot find link target for "numpy._core.numeric.ndarray", resolved from "ndarray"
- /projects/numpy/numpy/_core/strings.py:908: Cannot find link target for "numpy._core.numeric.ndarray", resolved from "ndarray"
- /projects/numpy/numpy/_core/strings.py:1279: Cannot find link target for "numpy._core.numeric.ndarray", resolved from "ndarray"
- /projects/numpy/numpy/_core/strings.py:1366: Cannot find link target for "numpy._core.numeric.ndarray", resolved from "ndarray"
- /projects/numpy/numpy/_core/strings.py:424: Cannot find link target for "numpy._core.numeric.ndarray", resolved from "ndarray"
- /projects/numpy/numpy/_core/strings.py:950: Cannot find link target for "numpy._core.numeric.ndarray", resolved from "ndarray"
- /projects/numpy/numpy/_core/strings.py:1066: Cannot find link target for "numpy._core.numeric.ndarray", resolved from "ndarray"
- /projects/numpy/numpy/_core/strings.py:1146: Cannot find link target for "numpy._core.numeric.ndarray", resolved from "ndarray"
- /projects/numpy/numpy/_core/strings.py:1531: Cannot find link target for "numpy._core.numeric.ndarray", resolved from "ndarray"
- /projects/numpy/numpy/_core/strings.py:993: Cannot find link target for "numpy._core.numeric.ndarray", resolved from "ndarray"
- /projects/numpy/numpy/_core/strings.py:816: Cannot find link target for "numpy._core.numeric.ndarray", resolved from "ndarray"
- /projects/numpy/numpy/_core/defchararray.py:443: ambiguous ref to copy, could be numpy.lib._function_base_impl.copy, numpy.ma.core.copy
- /projects/numpy/numpy/_core/defchararray.py:443: Cannot find link target for "copy"
- /projects/numpy/numpy/_core/einsumfunc.py:1084: Cannot find link target for "ndarray"
- /projects/numpy/numpy/_core/einsumfunc.py:1115: Cannot find link target for "ndarray"
- /projects/numpy/numpy/_core/fromnumeric.py:2638: Cannot find link target for "ndarray"
- /projects/numpy/numpy/_core/fromnumeric.py:2645: Cannot find link target for "ndarray"
- /projects/numpy/numpy/_core/fromnumeric.py:2657: Cannot find link target for "ndarray"
- /projects/numpy/numpy/_core/fromnumeric.py:2525: Cannot find link target for "ndarray"
- /projects/numpy/numpy/_core/fromnumeric.py:2532: Cannot find link target for "ndarray"
- /projects/numpy/numpy/_core/fromnumeric.py:2542: Cannot find link target for "ndarray"
- /projects/numpy/numpy/_core/fromnumeric.py:2544: Cannot find link target for "ndarray"
+ /projects/numpy/numpy/_core/fromnumeric.py:1285: ambiguous ref to array, could be numpy._core.defchararray.array, numpy.ma.core.array, numpy._core.records.array
- /projects/numpy/numpy/_core/fromnumeric.py:1297: Cannot find link target for "ndarray"
+ /projects/numpy/numpy/_core/fromnumeric.py:1383: ambiguous ref to array, could be numpy._core.defchararray.array, numpy.ma.core.array, numpy._core.records.array
- /projects/numpy/numpy/_core/fromnumeric.py:1395: Cannot find link target for "ndarray"
- /projects/numpy/numpy/_core/fromnumeric.py:921: Cannot find link target for "ndarray"
- /projects/numpy/numpy/_core/fromnumeric.py:1189: Cannot find link target for "ndarray"
+ /projects/numpy/numpy/_core/fromnumeric.py:385: ambiguous ref to array, could be numpy._core.defchararray.array, numpy.ma.core.array, numpy._core.records.array
+ /projects/numpy/numpy/_core/fromnumeric.py:394: ambiguous ref to array, could be numpy._core.defchararray.array, numpy.ma.core.array, numpy._core.records.array
- /projects/numpy/numpy/_core/fromnumeric.py:2285: Cannot find link target for "ndarray"
- /projects/numpy/numpy/_core/fromnumeric.py:2306: Cannot find link target for "ndarray"
- /projects/numpy/numpy/_core/fromnumeric.py:2213: ambiguous ref to diag, could be numpy.lib._twodim_base_impl.diag, numpy.ma.core.diag
- /projects/numpy/numpy/_core/fromnumeric.py:2213: Cannot find link target for "diag"
- /projects/numpy/numpy/_core/fromnumeric.py:2205: Cannot find link target for "ndarray"
- /projects/numpy/numpy/_core/fromnumeric.py:2209: Cannot find link target for "ndarray"
- /projects/numpy/numpy/_core/fromnumeric.py:3525: Cannot find link target for "ndarray"
- /projects/numpy/numpy/_core/fromnumeric.py:3529: Cannot find link target for "ndarray"
- /projects/numpy/numpy/_core/fromnumeric.py:2948: ambiguous ref to diff, could be numpy.lib._function_base_impl.diff, numpy.ma.core.diff
- /projects/numpy/numpy/_core/fromnumeric.py:2948: Cannot find link target for "diff"
- /projects/numpy/numpy/_core/fromnumeric.py:2929: Cannot find link target for "ndarray"
- /projects/numpy/numpy/_core/fromnumeric.py:2767: Cannot find link target for "ndarray"
- /projects/numpy/numpy/_core/fromnumeric.py:2777: Cannot find link target for "ndarray"

... (truncated 831 lines) ...

twisted (https://github.com/twisted/twisted)
+ /projects/twisted/src/twisted/python/win32.py:46: Failed to resolve alias (found same alias again)
+ /projects/twisted/src/twisted/python/win32.py:46: Failed to resolve alias (found same alias again)
+ /projects/twisted/src/twisted/python/win32.py:46: Failed to resolve alias (found same alias again)
+ /projects/twisted/src/twisted/python/win32.py:46: Failed to resolve alias (found same alias again)
- /projects/twisted/src/twisted/spread/jelly.py:212: Cannot find link target for "twisted.spread.flavors.setUnjellyableForClass", resolved from "setUnjellyableForClass"
+ /projects/twisted/src/twisted/python/urlpath.py:179: ambiguous ref to URL, could be twisted.python._url.URL, twisted.python.url.URL
+ /projects/twisted/src/twisted/python/urlpath.py:179: ambiguous ref to URL, could be twisted.protocols.sip.URL, twisted.python._url.URL, twisted.python.url.URL
+ /projects/twisted/src/twisted/python/urlpath.py:179: Cannot find link target for "URL"
+ /projects/twisted/src/twisted/python/urlpath.py:180: ambiguous ref to URL, could be twisted.python._url.URL, twisted.python.url.URL
+ /projects/twisted/src/twisted/python/urlpath.py:180: ambiguous ref to URL, could be twisted.protocols.sip.URL, twisted.python._url.URL, twisted.python.url.URL
+ /projects/twisted/src/twisted/python/urlpath.py:180: Cannot find link target for "URL"
+ /projects/twisted/src/twisted/python/win32.py:46: Failed to resolve alias (found same alias again)
- /projects/twisted/src/twisted/trial/_dist/workerreporter.py:218: Cannot find link target for "f"
- /projects/twisted/src/twisted/web/static.py:295: Cannot find link target for "NoResource"

@@ -491,7 +494,12 @@ class D(C):
assert isinstance(D, model.Class)
# An older version of this test expected a.A as the result.
# Read the comment in test_aliasing() to learn why this was changed.
assert D.bases == ['c.C']
# ---
# Changed again in 2022, we require the object to be re-exported with __all__
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# Changed again in 2022, we require the object to be re-exported with __all__
# Changed again in 2024, we require the object to be re-exported with __all__

Comment on lines +544 to +547
# but the code
# currently doesn't support that. We should perhaps store aliases
# as Documentables as well, so we can change their 'kind' when
# an inline docstring follows the assignment.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# but the code
# currently doesn't support that. We should perhaps store aliases
# as Documentables as well, so we can change their 'kind' when
# an inline docstring follows the assignment.

can't be resolved because it's too complex.
"""
if indirections and len(indirections) > self._RESOLVE_ALIAS_MAX_RECURSE:
self.module.report("Too many aliases", lineno_offset=alias.linenumber, section='aliases')
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be best to raise an exception instead

P = mod.contents['Processor']
f = P.contents['clientFactory']
assert unwrap(f.parsed_docstring) == """Callable that returns a client."""
assert f.privacyClass is model.PrivacyClass.PUBLIC
assert f.kind is model.DocumentableKind.INSTANCE_VARIABLE
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This variable should not be marked as an alias because it's declared as an instance variable.
An instance variable cannot be an alias because they typically have several possible values.

self.debug(f'Linker finds {part0} in {src} resolving name into {target}', lineno)
if (target is not None
and target not in potential_targets
and not any(target in t.aliases for t in potential_targets)):
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The linker seems still unable to correctly handle the aliases, diff from pydoctor_primer:

  • /projects/twisted/src/twisted/python/urlpath.py:179: ambiguous ref to URL, could be twisted.python._url.URL, twisted.python.url.URL
  • /projects/twisted/src/twisted/python/urlpath.py:179: ambiguous ref to URL, could be twisted.protocols.sip.URL, twisted.python._url.URL, twisted.python.url.URL
  • /projects/twisted/src/twisted/python/urlpath.py:179: Cannot find link target for "URL"
  • /projects/twisted/src/twisted/python/urlpath.py:180: ambiguous ref to URL, could be twisted.python._url.URL, twisted.python.url.URL
  • /projects/twisted/src/twisted/python/urlpath.py:180: ambiguous ref to URL, could be twisted.protocols.sip.URL, twisted.python._url.URL, twisted.python.url.URL
  • /projects/twisted/src/twisted/python/urlpath.py:180: Cannot find link target for "URL"
  • /projects/twisted/src/twisted/python/win32.py:46: Failed to resolve alias (found same alias again)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Include documented aliases in output
1 participant