This linker implements the xref lookup logic.
Method | __init__ |
Undocumented |
Method | link |
Format a link to a Python identifier. This will resolve the identifier like Python itself would. |
Method | link |
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 |
Return link for `name` based on intersphinx inventory. |
Method | look |
Undocumented |
Method | switch |
Switch the context of the linker, keeping the same underlying lookup rules. |
Instance Variable | reporting |
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 of the page used to compute the relative links from. Can be an empty string to always generate full urls. |
Method | _resolve |
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 |
Undocumented |
Instance Variable | _page |
Undocumented |
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:str | Undocumented |
label:Flattenable | The label to show for the link. |
isbool | Generated links will give precedence to the module defined variables rather the nested definitions when there are name collisions. |
target | The name of the Python identifier that should be linked to. |
Returns | |
Tag | The link, or just the label if the target was not found. |
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:str | The name of the Python identifier that should be linked to. |
label:Flattenable | The label to show for the link. |
lineno:int | The line number within the docstring at which the crossreference is located. |
Returns | |
Tag | The link, or just the label if the target was not found. In either case, the returned top-level tag will be <code>. |
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.
URL of the page used to compute the relative links from. Can be an empty string to always generate full urls.
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:str | The name of the Python identifier that should be linked to. |
lineno:int | The line number within the docstring at which the crossreference is located. |
Returns | |
str | model.Documentable | The referenced object within our system, or the URL of an external target (found via Intersphinx). |
Raises | |
LookupError | If identifier could not be resolved. |