summaryrefslogtreecommitdiff
path: root/sphinx/domains/python.py
diff options
context:
space:
mode:
authorTakeshi KOMIYA <i.tkomiya@gmail.com>2021-05-03 23:17:30 +0900
committerTakeshi KOMIYA <i.tkomiya@gmail.com>2021-05-10 02:01:24 +0900
commit2ee634bfdada724bccd56b372670538f2f20b3bc (patch)
tree8e25b41d538d5114a11d24810ba8d23dd4a55826 /sphinx/domains/python.py
parentb88187de34815977bb6f282f3cce7c2cd936e6a6 (diff)
downloadsphinx-git-2ee634bfdada724bccd56b372670538f2f20b3bc.tar.gz
refactor: Add Optional to type annotations
Diffstat (limited to 'sphinx/domains/python.py')
-rw-r--r--sphinx/domains/python.py6
1 files changed, 3 insertions, 3 deletions
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')