From 4b5d72bc26a4564a2620bb8abae793e28c50c265 Mon Sep 17 00:00:00 2001 From: Taras Savchyn Date: Wed, 7 Oct 2020 20:16:22 +0300 Subject: [PATCH] Disable cross-ref links for type annotations --- docs/source/conf.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/docs/source/conf.py b/docs/source/conf.py index 8bca8e3a0753..0ceb7346bd1c 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -192,3 +192,16 @@ # If true, `todo` and `todoList` produce output, else they produce nothing. todo_include_todos = True + +# -- Type hints configs ------------------------------------------------------ + +autodoc_typehints = "signature" + +# -- A patch that turns-off cross refs for type annotations ------------------ + +import sphinx.domains.python +from docutils import nodes +from sphinx import addnodes + +# replaces pending_xref node with desc_type for type annotations +sphinx.domains.python.type_to_xref = lambda t, e=None: addnodes.desc_type("", nodes.Text(t))