class documentation

This linker implements the xref lookup logic.

Exception LookupFailed Encapsulate a link tag that is not actually a link because we count not resolve the name.
Method __init__ Undocumented
Method disable_same_page_optimazation By default, when linkng to an object on the same page, the linker will generate an URL that links to the anchor only, this will avoid reloading the page needlessly. But sometimes we're using a linker to present the content on another page...
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 resolve_identifier Resolve a Python identifier. This will resolve the identifier like Python itself would.
Instance Variable obj Undocumented
Instance Variable same_page_optimization Undocumented
Instance Variable strict Undocumented
Static Method _create_intersphinx_link Create a link with the special 'intersphinx-link' CSS class.
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.
def __init__(self, obj, same_page_optimization, strict=False): (source)

Undocumented

Parameters
obj:model.DocumentableUndocumented
same_page_optimization:boolUndocumented
strict:boolUndocumented
@contextlib.contextmanager
def disable_same_page_optimazation(self): (source)

By default, when linkng to an object on the same page, the linker will generate an URL that links to the anchor only, this will avoid reloading the page needlessly. But sometimes we're using a linker to present the content on another page. This context manager will make the linker always generate full URLs.

Returns
Iterator[None]Undocumented
def link_to(self, identifier, label): (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.
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, label, lineno): (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): (source)

Return link for `name` based on intersphinx inventory.

Return None if link is not found.

Parameters
name:strUndocumented
Returns
Optional[str]Undocumented
def look_for_name(self, name, candidates, lineno): (source)

Undocumented

Parameters
name:strUndocumented
candidates:Iterable[model.Documentable]Undocumented
lineno:intUndocumented
Returns
Optional[model.Documentable]Undocumented
def resolve_identifier(self, identifier): (source)

Resolve a Python identifier. This will resolve the identifier like Python itself would.

Parameters
identifier:strThe name of the Python identifier that should be linked to.
Returns
Optional[str]The URL of the target, or None if not found.

Undocumented

same_page_optimization = (source)

Undocumented

Undocumented

@staticmethod
def _create_intersphinx_link(label, url): (source)

Create a link with the special 'intersphinx-link' CSS class.

Parameters
label:FlattenableUndocumented
url:strUndocumented
Returns
TagUndocumented
def _resolve_identifier_xref(self, identifier, lineno): (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
Union[str, model.Documentable]The referenced object within our system, or the URL of an external target (found via Intersphinx).
Raises
LookupErrorIf identifier could not be resolved.