diff options
Diffstat (limited to 'sphinx/util/cfamily.py')
-rw-r--r-- | sphinx/util/cfamily.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/sphinx/util/cfamily.py b/sphinx/util/cfamily.py index 282499d70..e5337b0c2 100644 --- a/sphinx/util/cfamily.py +++ b/sphinx/util/cfamily.py @@ -4,7 +4,7 @@ from __future__ import annotations import re from copy import deepcopy -from typing import Any, Callable, Optional +from typing import Any, Callable from docutils import nodes from docutils.nodes import TextElement @@ -135,7 +135,7 @@ class ASTCPPAttribute(ASTAttribute): class ASTGnuAttribute(ASTBaseBase): - def __init__(self, name: str, args: Optional["ASTBaseParenExprList"]) -> None: + def __init__(self, name: str, args: ASTBaseParenExprList | None) -> None: self.name = name self.args = args @@ -201,7 +201,7 @@ class ASTAttributeList(ASTBaseBase): def __len__(self) -> int: return len(self.attrs) - def __add__(self, other: "ASTAttributeList") -> "ASTAttributeList": + def __add__(self, other: ASTAttributeList) -> ASTAttributeList: return ASTAttributeList(self.attrs + other.attrs) def _stringify(self, transform: StringifyTransform) -> str: @@ -237,7 +237,7 @@ class DefinitionError(Exception): class BaseParser: def __init__(self, definition: str, *, location: nodes.Node | tuple[str, int] | str, - config: "Config") -> None: + config: Config) -> None: self.definition = definition.strip() self.location = location # for warnings self.config = config @@ -280,7 +280,7 @@ class BaseParser: def status(self, msg: str) -> None: # for debugging indicator = '-' * self.pos + '^' - print("%s\n%s\n%s" % (msg, self.definition, indicator)) + print(f"{msg}\n{self.definition}\n{indicator}") def fail(self, msg: str) -> None: errors = [] |