| 98 | """ |
| 99 | |
| 100 | class PatchedPythonDomain(PythonDomain): |
| 101 | def resolve_xref( # ruff:ignore[too-many-arguments, too-many-positional-arguments] |
| 102 | self, |
| 103 | env: BuildEnvironment, |
| 104 | fromdocname: str, |
| 105 | builder: Builder, |
| 106 | type: str, # ruff:ignore[builtin-argument-shadowing] |
| 107 | target: str, |
| 108 | node: pending_xref, |
| 109 | contnode: Element, |
| 110 | ) -> reference | None: |
| 111 | mapping = { |
| 112 | "_thread._local": ("threading.local", "local"), |
| 113 | "asyncio.events.AbstractEventLoop": ("asyncio.AbstractEventLoop", "AbstractEventLoop"), |
| 114 | "concurrent.futures._base.Executor": ("concurrent.futures.Executor", "Executor"), |
| 115 | } |
| 116 | if target in mapping: |
| 117 | of_type, with_name = mapping[target] |
| 118 | target = of_type |
| 119 | node["reftarget"] = of_type |
| 120 | contnode.replace(contnode.children[0], Text(with_name)) |
| 121 | return super().resolve_xref(env, fromdocname, builder, type, target, node, contnode) |
| 122 | |
| 123 | app.add_domain(PatchedPythonDomain, override=True) |
| 124 |
nothing calls this directly
no outgoing calls
no test coverage detected