class documentation

class _EpydocLinker(DocstringLinker): (source)

Constructor: _EpydocLinker(obj)

View In Hierarchy

This linker implements the xref lookup logic.

Method __init__ Undocumented
Method link_to Format a link to a Python identifier. This will resolve the identifier like Python itself would.
Method link_xref Format a cross-reference link to a Python identifier. This will resolve the identifier to any reasonable target, even if it has to look in places where Python itself would not.
Method look_for_intersphinx Return link for `name` based on intersphinx inventory.
Method look_for_name Undocumented
Method switch_context Switch the context of the linker, keeping the same underlying lookup rules.
Instance Variable reporting_obj Object used for reporting link not found errors. Changed when the linker switch_context.
Property obj Object used for resolving the target name, it's NOT changed when the linker switch_context.
Property page_url URL of the page used to compute the relative links from. Can be an empty string to always generate full urls.
Method _resolve_identifier_xref Resolve a crossreference link to a Python identifier. This will resolve the identifier to any reasonable target, even if it has to look in places where Python itself would not.
Instance Variable _init_obj Undocumented
Instance Variable _page_object Undocumented
def __init__(self, obj: model.Documentable): (source)

Undocumented

def link_to(self, identifier: str, label: Flattenable, *, is_annotation: bool = False) -> Tag: (source)

Format a link to a Python identifier. This will resolve the identifier like Python itself would.

Parameters
identifier:strUndocumented
label:FlattenableThe label to show for the link.
is_annotation:boolUndocumented
targetThe name of the Python identifier that should be linked to.
Returns
TagThe link, or just the label if the target was not found.
def link_xref(self, target: str, label: Flattenable, lineno: int) -> Tag: (source)

Format a cross-reference link to a Python identifier. This will resolve the identifier to any reasonable target, even if it has to look in places where Python itself would not.

Parameters
target:strThe name of the Python identifier that should be linked to.
label:FlattenableThe label to show for the link.
lineno:intThe line number within the docstring at which the crossreference is located.
Returns
TagThe link, or just the label if the target was not found. In either case, the returned top-level tag will be <code>.
def look_for_intersphinx(self, name: str) -> str | None: (source)

Return link for `name` based on intersphinx inventory.

Return None if link is not found.

def look_for_name(self, name: str, candidates: Iterable[model.Documentable], lineno: int) -> model.Documentable | None: (source)

Undocumented

Switch the context of the linker, keeping the same underlying lookup rules.

Useful to resolve links with the right Documentable context but create correct - absolute or relative - links to be clicked on from another page rather than the initial page of the context. "Cannot find link target" errors will be reported relatively to the new context object.

Pass None to always generate full URLs (for summaries for example), in this case error will NOT be reported at all.

Object used for reporting link not found errors. Changed when the linker switch_context.

Object used for resolving the target name, it's NOT changed when the linker switch_context.

URL of the page used to compute the relative links from. Can be an empty string to always generate full urls.

def _resolve_identifier_xref(self, identifier: str, lineno: int) -> str | model.Documentable: (source)

Resolve a crossreference link to a Python identifier. This will resolve the identifier to any reasonable target, even if it has to look in places where Python itself would not.

Parameters
identifier:strThe name of the Python identifier that should be linked to.
lineno:intThe line number within the docstring at which the crossreference is located.
Returns
str | model.DocumentableThe referenced object within our system, or the URL of an external target (found via Intersphinx).
Raises
LookupErrorIf identifier could not be resolved.
_init_obj = (source)

Undocumented

Undocumented