From 2ee634bfdada724bccd56b372670538f2f20b3bc Mon Sep 17 00:00:00 2001 From: Takeshi KOMIYA Date: Mon, 3 May 2021 23:17:30 +0900 Subject: refactor: Add Optional to type annotations --- sphinx/domains/python.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'sphinx/domains/python.py') diff --git a/sphinx/domains/python.py b/sphinx/domains/python.py index 4464895ef..dbe2c87ca 100644 --- a/sphinx/domains/python.py +++ b/sphinx/domains/python.py @@ -15,7 +15,7 @@ import sys import typing import warnings from inspect import Parameter -from typing import Any, Dict, Iterable, Iterator, List, NamedTuple, Tuple, Type, cast +from typing import Any, Dict, Iterable, Iterator, List, NamedTuple, Optional, Tuple, Type, cast from docutils import nodes from docutils.nodes import Element, Node @@ -1246,7 +1246,7 @@ class PythonDomain(Domain): def resolve_xref(self, env: BuildEnvironment, fromdocname: str, builder: Builder, type: str, target: str, node: pending_xref, contnode: Element - ) -> Element: + ) -> Optional[Element]: modname = node.get('py:module') clsname = node.get('py:class') searchmode = 1 if node.hasattr('refspecific') else 0 @@ -1340,7 +1340,7 @@ class PythonDomain(Domain): else: yield (refname, refname, obj.objtype, obj.docname, obj.node_id, 1) - def get_full_qualified_name(self, node: Element) -> str: + def get_full_qualified_name(self, node: Element) -> Optional[str]: modname = node.get('py:module') clsname = node.get('py:class') target = node.get('reftarget') -- cgit v1.2.1