diff options
author | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2021-03-28 07:31:52 +0900 |
---|---|---|
committer | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2021-05-03 22:41:19 +0900 |
commit | 930bf6c327b31aec6112359695f35a2c77fbae21 (patch) | |
tree | 77ec4b549ad46ea2c52b9ba40a0f011451378305 /sphinx/util/docutils.py | |
parent | f31af4b8158e6142d918366aa0026e40575af914 (diff) | |
download | sphinx-git-930bf6c327b31aec6112359695f35a2c77fbae21.tar.gz |
refactor: Add Optional to type annotations
Diffstat (limited to 'sphinx/util/docutils.py')
-rw-r--r-- | sphinx/util/docutils.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/sphinx/util/docutils.py b/sphinx/util/docutils.py index 44483bdd8..c2e12e152 100644 --- a/sphinx/util/docutils.py +++ b/sphinx/util/docutils.py @@ -176,8 +176,8 @@ class sphinx_domains: """ def __init__(self, env: "BuildEnvironment") -> None: self.env = env - self.directive_func: Callable = None - self.roles_func: Callable = None + self.directive_func: Callable = lambda *args: (None, []) + self.roles_func: Callable = lambda *args: (None, []) def __enter__(self) -> None: self.enable() @@ -372,7 +372,7 @@ class SphinxRole: if name: self.name = name.lower() else: - self.name = self.env.temp_data.get('default_role') + self.name = self.env.temp_data.get('default_role', '') if not self.name: self.name = self.env.config.default_role if not self.name: @@ -491,7 +491,7 @@ class SphinxTranslator(nodes.NodeVisitor): # cache a vanilla instance of nodes.document # Used in new_document() function -__document_cache__: nodes.document = None +__document_cache__: Optional[nodes.document] = None def new_document(source_path: str, settings: Any = None) -> nodes.document: |