diff options
author | Adam Turner <9087854+aa-turner@users.noreply.github.com> | 2023-01-01 20:43:59 +0000 |
---|---|---|
committer | Adam Turner <9087854+aa-turner@users.noreply.github.com> | 2023-01-01 20:48:39 +0000 |
commit | 14a9289d780240bbce78ad3640e8e1b1b12df43f (patch) | |
tree | fd753f5b0f8c7053923b78c8fef2b90b60f9c7fa /sphinx/util/docutils.py | |
parent | 26f79b0d2dd88b353ac65623897bdfbe8bc07cab (diff) | |
download | sphinx-git-14a9289d780240bbce78ad3640e8e1b1b12df43f.tar.gz |
Use PEP 604 types
Diffstat (limited to 'sphinx/util/docutils.py')
-rw-r--r-- | sphinx/util/docutils.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/sphinx/util/docutils.py b/sphinx/util/docutils.py index b4dde6ebb..e012470c7 100644 --- a/sphinx/util/docutils.py +++ b/sphinx/util/docutils.py @@ -9,7 +9,7 @@ from contextlib import contextmanager from copy import copy from os import path from types import ModuleType -from typing import IO, TYPE_CHECKING, Any, Callable, Generator, Optional, cast +from typing import IO, TYPE_CHECKING, Any, Callable, Generator, cast import docutils from docutils import nodes @@ -171,7 +171,7 @@ def patched_rst_get_language() -> Generator[None, None, None]: @contextmanager -def using_user_docutils_conf(confdir: Optional[str]) -> Generator[None, None, None]: +def using_user_docutils_conf(confdir: str | None) -> Generator[None, None, None]: """Let docutils know the location of ``docutils.conf`` for Sphinx.""" try: docutilsconfig = os.environ.get('DOCUTILSCONFIG', None) @@ -220,7 +220,7 @@ def du19_footnotes() -> Generator[None, None, None]: @contextmanager -def patch_docutils(confdir: Optional[str] = None) -> Generator[None, None, None]: +def patch_docutils(confdir: str | None = None) -> Generator[None, None, None]: """Patch to docutils temporarily.""" with patched_get_language(), \ patched_rst_get_language(), \ @@ -261,7 +261,7 @@ class CustomReSTDispatcher: def directive(self, directive_name: str, language_module: ModuleType, document: nodes.document - ) -> tuple[Optional[type[Directive]], list[system_message]]: + ) -> tuple[type[Directive] | None, list[system_message]]: return self.directive_func(directive_name, language_module, document) def role(self, role_name: str, language_module: ModuleType, lineno: int, reporter: Reporter @@ -313,7 +313,7 @@ class sphinx_domains(CustomReSTDispatcher): def directive(self, directive_name: str, language_module: ModuleType, document: nodes.document - ) -> tuple[Optional[type[Directive]], list[system_message]]: + ) -> tuple[type[Directive] | None, list[system_message]]: try: return self.lookup_domain_element('directive', directive_name) except ElementLookupError: |