summaryrefslogtreecommitdiff
path: root/sphinx/directives/patches.py
diff options
context:
space:
mode:
authorAdam Turner <9087854+aa-turner@users.noreply.github.com>2022-12-30 21:13:29 +0000
committerAdam Turner <9087854+aa-turner@users.noreply.github.com>2023-01-01 20:48:38 +0000
commit26f79b0d2dd88b353ac65623897bdfbe8bc07cab (patch)
tree0d2f0c752cf1f49a45cde1d7f414d75a6114f1ce /sphinx/directives/patches.py
parentf4c8a0a68e0013808d169357c9f77ebdf19d0f4e (diff)
downloadsphinx-git-26f79b0d2dd88b353ac65623897bdfbe8bc07cab.tar.gz
Use PEP 595 types
Diffstat (limited to 'sphinx/directives/patches.py')
-rw-r--r--sphinx/directives/patches.py16
1 files changed, 8 insertions, 8 deletions
diff --git a/sphinx/directives/patches.py b/sphinx/directives/patches.py
index 4a38fd025..6e63308d5 100644
--- a/sphinx/directives/patches.py
+++ b/sphinx/directives/patches.py
@@ -2,7 +2,7 @@ from __future__ import annotations
import os
from os import path
-from typing import TYPE_CHECKING, Any, Dict, List, cast
+from typing import TYPE_CHECKING, Any, cast
from docutils import nodes
from docutils.nodes import Node, make_id
@@ -32,7 +32,7 @@ class Figure(images.Figure):
instead of the image node.
"""
- def run(self) -> List[Node]:
+ def run(self) -> list[Node]:
name = self.options.pop('name', None)
result = super().run()
if len(result) == 2 or isinstance(result[0], nodes.system_message):
@@ -58,7 +58,7 @@ class CSVTable(tables.CSVTable):
directory when an absolute path is given via :file: option.
"""
- def run(self) -> List[Node]:
+ def run(self) -> list[Node]:
if 'file' in self.options and self.options['file'].startswith((SEP, os.sep)):
env = self.state.document.settings.env
filename = self.options['file']
@@ -89,7 +89,7 @@ class Code(SphinxDirective):
}
has_content = True
- def run(self) -> List[Node]:
+ def run(self) -> list[Node]:
self.assert_has_content()
set_classes(self.options)
@@ -133,7 +133,7 @@ class MathDirective(SphinxDirective):
'nowrap': directives.flag,
}
- def run(self) -> List[Node]:
+ def run(self) -> list[Node]:
latex = '\n'.join(self.content)
if self.arguments and self.arguments[0]:
latex = self.arguments[0] + '\n\n' + latex
@@ -147,11 +147,11 @@ class MathDirective(SphinxDirective):
self.add_name(node)
self.set_source_info(node)
- ret: List[Node] = [node]
+ ret: list[Node] = [node]
self.add_target(ret)
return ret
- def add_target(self, ret: List[Node]) -> None:
+ def add_target(self, ret: list[Node]) -> None:
node = cast(nodes.math_block, ret[0])
# assign label automatically if math_number_all enabled
@@ -175,7 +175,7 @@ class MathDirective(SphinxDirective):
ret.insert(0, target)
-def setup(app: "Sphinx") -> Dict[str, Any]:
+def setup(app: "Sphinx") -> dict[str, Any]:
directives.register_directive('figure', Figure)
directives.register_directive('meta', Meta)
directives.register_directive('csv-table', CSVTable)