mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
[lint] simplify lint config for flake8-annotations (#12073)
Co-authored-by: daniel.eades <daniel.eades@seebyte.com> Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
This commit is contained in:
parent
92380e60d1
commit
d6f49f9c09
13
.ruff.toml
13
.ruff.toml
@ -15,6 +15,8 @@ exclude = [
|
|||||||
"doc/usage/extensions/example*.py",
|
"doc/usage/extensions/example*.py",
|
||||||
]
|
]
|
||||||
ignore = [
|
ignore = [
|
||||||
|
# flake8-annotations
|
||||||
|
"ANN401", # Dynamically typed expressions (typing.Any) are disallowed in `{name}`
|
||||||
# pycodestyle
|
# pycodestyle
|
||||||
"E741", # Ambiguous variable name: `{name}`
|
"E741", # Ambiguous variable name: `{name}`
|
||||||
# pyflakes
|
# pyflakes
|
||||||
@ -31,16 +33,7 @@ select = [
|
|||||||
# NOT YET USED
|
# NOT YET USED
|
||||||
# airflow ('AIR')
|
# airflow ('AIR')
|
||||||
# Airflow is not used in Sphinx
|
# Airflow is not used in Sphinx
|
||||||
# flake8-annotations ('ANN')
|
"ANN", # flake8-annotations ('ANN')
|
||||||
"ANN001", # Missing type annotation for function argument `{name}`
|
|
||||||
"ANN002", # Missing type annotation for `*{name}`
|
|
||||||
"ANN003", # Missing type annotation for `**{name}`
|
|
||||||
"ANN201", # Missing return type annotation for public function `{name}`
|
|
||||||
"ANN202", # Missing return type annotation for private function `{name}`
|
|
||||||
# "ANN204", # Missing return type annotation for special method `{name}`
|
|
||||||
"ANN205", # Missing return type annotation for staticmethod `{name}`
|
|
||||||
"ANN206", # Missing return type annotation for classmethod `{name}`
|
|
||||||
# "ANN401", # Dynamically typed expressions (typing.Any) are disallowed in `{name}`
|
|
||||||
# flake8-unused-arguments ('ARG')
|
# flake8-unused-arguments ('ARG')
|
||||||
"ARG004", # Unused static method argument: `{name}`
|
"ARG004", # Unused static method argument: `{name}`
|
||||||
# flake8-async ('ASYNC')
|
# flake8-async ('ASYNC')
|
||||||
|
@ -332,7 +332,7 @@ class desc_sig_element(nodes.inline, _desc_classes_injector):
|
|||||||
super().__init__(rawsource, text, *children, **attributes)
|
super().__init__(rawsource, text, *children, **attributes)
|
||||||
self['classes'].extend(self.classes)
|
self['classes'].extend(self.classes)
|
||||||
|
|
||||||
def __init_subclass__(cls, *, _sig_element: bool = False, **kwargs: Any):
|
def __init_subclass__(cls, *, _sig_element: bool = False, **kwargs: Any) -> None:
|
||||||
super().__init_subclass__(**kwargs)
|
super().__init_subclass__(**kwargs)
|
||||||
if _sig_element:
|
if _sig_element:
|
||||||
# add the class to the SIG_ELEMENTS set if asked
|
# add the class to the SIG_ELEMENTS set if asked
|
||||||
|
@ -40,7 +40,7 @@ logger = logging.getLogger(__name__)
|
|||||||
class Message:
|
class Message:
|
||||||
"""An entry of translatable message."""
|
"""An entry of translatable message."""
|
||||||
|
|
||||||
def __init__(self, text: str, locations: list[tuple[str, int]], uuids: list[str]):
|
def __init__(self, text: str, locations: list[tuple[str, int]], uuids: list[str]) -> None:
|
||||||
self.text = text
|
self.text = text
|
||||||
self.locations = locations
|
self.locations = locations
|
||||||
self.uuids = uuids
|
self.uuids = uuids
|
||||||
|
@ -363,7 +363,7 @@ class Config:
|
|||||||
if name not in self._options:
|
if name not in self._options:
|
||||||
logger.warning(__('unknown config value %r in override, ignoring'), name)
|
logger.warning(__('unknown config value %r in override, ignoring'), name)
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self) -> str:
|
||||||
values = []
|
values = []
|
||||||
for opt_name in self._options:
|
for opt_name in self._options:
|
||||||
try:
|
try:
|
||||||
|
@ -247,7 +247,7 @@ class ASTStringLiteral(ASTLiteral):
|
|||||||
|
|
||||||
|
|
||||||
class ASTIdExpression(ASTExpression):
|
class ASTIdExpression(ASTExpression):
|
||||||
def __init__(self, name: ASTNestedName):
|
def __init__(self, name: ASTNestedName) -> None:
|
||||||
# note: this class is basically to cast a nested name as an expression
|
# note: this class is basically to cast a nested name as an expression
|
||||||
self.name = name
|
self.name = name
|
||||||
|
|
||||||
@ -344,7 +344,7 @@ class ASTPostfixMemberOfPointer(ASTPostfixOp):
|
|||||||
|
|
||||||
|
|
||||||
class ASTPostfixExpr(ASTExpression):
|
class ASTPostfixExpr(ASTExpression):
|
||||||
def __init__(self, prefix: ASTExpression, postFixes: list[ASTPostfixOp]):
|
def __init__(self, prefix: ASTExpression, postFixes: list[ASTPostfixOp]) -> None:
|
||||||
self.prefix = prefix
|
self.prefix = prefix
|
||||||
self.postFixes = postFixes
|
self.postFixes = postFixes
|
||||||
|
|
||||||
@ -362,7 +362,7 @@ class ASTPostfixExpr(ASTExpression):
|
|||||||
################################################################################
|
################################################################################
|
||||||
|
|
||||||
class ASTUnaryOpExpr(ASTExpression):
|
class ASTUnaryOpExpr(ASTExpression):
|
||||||
def __init__(self, op: str, expr: ASTExpression):
|
def __init__(self, op: str, expr: ASTExpression) -> None:
|
||||||
self.op = op
|
self.op = op
|
||||||
self.expr = expr
|
self.expr = expr
|
||||||
|
|
||||||
@ -398,7 +398,7 @@ class ASTSizeofType(ASTExpression):
|
|||||||
|
|
||||||
|
|
||||||
class ASTSizeofExpr(ASTExpression):
|
class ASTSizeofExpr(ASTExpression):
|
||||||
def __init__(self, expr: ASTExpression):
|
def __init__(self, expr: ASTExpression) -> None:
|
||||||
self.expr = expr
|
self.expr = expr
|
||||||
|
|
||||||
def _stringify(self, transform: StringifyTransform) -> str:
|
def _stringify(self, transform: StringifyTransform) -> str:
|
||||||
@ -412,7 +412,7 @@ class ASTSizeofExpr(ASTExpression):
|
|||||||
|
|
||||||
|
|
||||||
class ASTAlignofExpr(ASTExpression):
|
class ASTAlignofExpr(ASTExpression):
|
||||||
def __init__(self, typ: ASTType):
|
def __init__(self, typ: ASTType) -> None:
|
||||||
self.typ = typ
|
self.typ = typ
|
||||||
|
|
||||||
def _stringify(self, transform: StringifyTransform) -> str:
|
def _stringify(self, transform: StringifyTransform) -> str:
|
||||||
@ -430,7 +430,7 @@ class ASTAlignofExpr(ASTExpression):
|
|||||||
################################################################################
|
################################################################################
|
||||||
|
|
||||||
class ASTCastExpr(ASTExpression):
|
class ASTCastExpr(ASTExpression):
|
||||||
def __init__(self, typ: ASTType, expr: ASTExpression):
|
def __init__(self, typ: ASTType, expr: ASTExpression) -> None:
|
||||||
self.typ = typ
|
self.typ = typ
|
||||||
self.expr = expr
|
self.expr = expr
|
||||||
|
|
||||||
@ -450,7 +450,7 @@ class ASTCastExpr(ASTExpression):
|
|||||||
|
|
||||||
|
|
||||||
class ASTBinOpExpr(ASTBase):
|
class ASTBinOpExpr(ASTBase):
|
||||||
def __init__(self, exprs: list[ASTExpression], ops: list[str]):
|
def __init__(self, exprs: list[ASTExpression], ops: list[str]) -> None:
|
||||||
assert len(exprs) > 0
|
assert len(exprs) > 0
|
||||||
assert len(exprs) == len(ops) + 1
|
assert len(exprs) == len(ops) + 1
|
||||||
self.exprs = exprs
|
self.exprs = exprs
|
||||||
@ -481,7 +481,7 @@ class ASTBinOpExpr(ASTBase):
|
|||||||
|
|
||||||
|
|
||||||
class ASTAssignmentExpr(ASTExpression):
|
class ASTAssignmentExpr(ASTExpression):
|
||||||
def __init__(self, exprs: list[ASTExpression], ops: list[str]):
|
def __init__(self, exprs: list[ASTExpression], ops: list[str]) -> None:
|
||||||
assert len(exprs) > 0
|
assert len(exprs) > 0
|
||||||
assert len(exprs) == len(ops) + 1
|
assert len(exprs) == len(ops) + 1
|
||||||
self.exprs = exprs
|
self.exprs = exprs
|
||||||
@ -512,7 +512,7 @@ class ASTAssignmentExpr(ASTExpression):
|
|||||||
|
|
||||||
|
|
||||||
class ASTFallbackExpr(ASTExpression):
|
class ASTFallbackExpr(ASTExpression):
|
||||||
def __init__(self, expr: str):
|
def __init__(self, expr: str) -> None:
|
||||||
self.expr = expr
|
self.expr = expr
|
||||||
|
|
||||||
def _stringify(self, transform: StringifyTransform) -> str:
|
def _stringify(self, transform: StringifyTransform) -> str:
|
||||||
@ -784,7 +784,7 @@ class ASTDeclSpecs(ASTBase):
|
|||||||
|
|
||||||
class ASTArray(ASTBase):
|
class ASTArray(ASTBase):
|
||||||
def __init__(self, static: bool, const: bool, volatile: bool, restrict: bool,
|
def __init__(self, static: bool, const: bool, volatile: bool, restrict: bool,
|
||||||
vla: bool, size: ASTExpression):
|
vla: bool, size: ASTExpression) -> None:
|
||||||
self.static = static
|
self.static = static
|
||||||
self.const = const
|
self.const = const
|
||||||
self.volatile = volatile
|
self.volatile = volatile
|
||||||
@ -895,7 +895,7 @@ class ASTDeclaratorNameParam(ASTDeclarator):
|
|||||||
|
|
||||||
|
|
||||||
class ASTDeclaratorNameBitField(ASTDeclarator):
|
class ASTDeclaratorNameBitField(ASTDeclarator):
|
||||||
def __init__(self, declId: ASTNestedName, size: ASTExpression):
|
def __init__(self, declId: ASTNestedName, size: ASTExpression) -> None:
|
||||||
self.declId = declId
|
self.declId = declId
|
||||||
self.size = size
|
self.size = size
|
||||||
|
|
||||||
|
@ -13,6 +13,8 @@ from sphinx.util import logging
|
|||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from collections.abc import Generator, Iterator
|
from collections.abc import Generator, Iterator
|
||||||
|
|
||||||
|
from typing_extensions import Self
|
||||||
|
|
||||||
from sphinx.environment import BuildEnvironment
|
from sphinx.environment import BuildEnvironment
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
@ -52,7 +54,7 @@ class Symbol:
|
|||||||
debug_lookup = False
|
debug_lookup = False
|
||||||
debug_show_tree = False
|
debug_show_tree = False
|
||||||
|
|
||||||
def __copy__(self):
|
def __copy__(self) -> Self:
|
||||||
raise AssertionError # shouldn't happen
|
raise AssertionError # shouldn't happen
|
||||||
|
|
||||||
def __deepcopy__(self, memo: Any) -> Symbol:
|
def __deepcopy__(self, memo: Any) -> Symbol:
|
||||||
|
@ -411,7 +411,7 @@ class ASTCharLiteral(ASTLiteral):
|
|||||||
|
|
||||||
|
|
||||||
class ASTUserDefinedLiteral(ASTLiteral):
|
class ASTUserDefinedLiteral(ASTLiteral):
|
||||||
def __init__(self, literal: ASTLiteral, ident: ASTIdentifier):
|
def __init__(self, literal: ASTLiteral, ident: ASTIdentifier) -> None:
|
||||||
self.literal = literal
|
self.literal = literal
|
||||||
self.ident = ident
|
self.ident = ident
|
||||||
|
|
||||||
@ -505,7 +505,7 @@ class ASTFoldExpr(ASTExpression):
|
|||||||
|
|
||||||
|
|
||||||
class ASTParenExpr(ASTExpression):
|
class ASTParenExpr(ASTExpression):
|
||||||
def __init__(self, expr: ASTExpression):
|
def __init__(self, expr: ASTExpression) -> None:
|
||||||
self.expr = expr
|
self.expr = expr
|
||||||
|
|
||||||
def _stringify(self, transform: StringifyTransform) -> str:
|
def _stringify(self, transform: StringifyTransform) -> str:
|
||||||
@ -522,7 +522,7 @@ class ASTParenExpr(ASTExpression):
|
|||||||
|
|
||||||
|
|
||||||
class ASTIdExpression(ASTExpression):
|
class ASTIdExpression(ASTExpression):
|
||||||
def __init__(self, name: ASTNestedName):
|
def __init__(self, name: ASTNestedName) -> None:
|
||||||
# note: this class is basically to cast a nested name as an expression
|
# note: this class is basically to cast a nested name as an expression
|
||||||
self.name = name
|
self.name = name
|
||||||
|
|
||||||
@ -550,7 +550,7 @@ class ASTPostfixOp(ASTBase):
|
|||||||
|
|
||||||
|
|
||||||
class ASTPostfixArray(ASTPostfixOp):
|
class ASTPostfixArray(ASTPostfixOp):
|
||||||
def __init__(self, expr: ASTExpression):
|
def __init__(self, expr: ASTExpression) -> None:
|
||||||
self.expr = expr
|
self.expr = expr
|
||||||
|
|
||||||
def _stringify(self, transform: StringifyTransform) -> str:
|
def _stringify(self, transform: StringifyTransform) -> str:
|
||||||
@ -567,7 +567,7 @@ class ASTPostfixArray(ASTPostfixOp):
|
|||||||
|
|
||||||
|
|
||||||
class ASTPostfixMember(ASTPostfixOp):
|
class ASTPostfixMember(ASTPostfixOp):
|
||||||
def __init__(self, name: ASTNestedName):
|
def __init__(self, name: ASTNestedName) -> None:
|
||||||
self.name = name
|
self.name = name
|
||||||
|
|
||||||
def _stringify(self, transform: StringifyTransform) -> str:
|
def _stringify(self, transform: StringifyTransform) -> str:
|
||||||
@ -583,7 +583,7 @@ class ASTPostfixMember(ASTPostfixOp):
|
|||||||
|
|
||||||
|
|
||||||
class ASTPostfixMemberOfPointer(ASTPostfixOp):
|
class ASTPostfixMemberOfPointer(ASTPostfixOp):
|
||||||
def __init__(self, name: ASTNestedName):
|
def __init__(self, name: ASTNestedName) -> None:
|
||||||
self.name = name
|
self.name = name
|
||||||
|
|
||||||
def _stringify(self, transform: StringifyTransform) -> str:
|
def _stringify(self, transform: StringifyTransform) -> str:
|
||||||
@ -643,7 +643,7 @@ class ASTPostfixCallExpr(ASTPostfixOp):
|
|||||||
|
|
||||||
|
|
||||||
class ASTPostfixExpr(ASTExpression):
|
class ASTPostfixExpr(ASTExpression):
|
||||||
def __init__(self, prefix: ASTType, postFixes: list[ASTPostfixOp]):
|
def __init__(self, prefix: ASTType, postFixes: list[ASTPostfixOp]) -> None:
|
||||||
self.prefix = prefix
|
self.prefix = prefix
|
||||||
self.postFixes = postFixes
|
self.postFixes = postFixes
|
||||||
|
|
||||||
@ -664,7 +664,7 @@ class ASTPostfixExpr(ASTExpression):
|
|||||||
|
|
||||||
|
|
||||||
class ASTExplicitCast(ASTExpression):
|
class ASTExplicitCast(ASTExpression):
|
||||||
def __init__(self, cast: str, typ: ASTType, expr: ASTExpression):
|
def __init__(self, cast: str, typ: ASTType, expr: ASTExpression) -> None:
|
||||||
assert cast in _id_explicit_cast
|
assert cast in _id_explicit_cast
|
||||||
self.cast = cast
|
self.cast = cast
|
||||||
self.typ = typ
|
self.typ = typ
|
||||||
@ -696,7 +696,7 @@ class ASTExplicitCast(ASTExpression):
|
|||||||
|
|
||||||
|
|
||||||
class ASTTypeId(ASTExpression):
|
class ASTTypeId(ASTExpression):
|
||||||
def __init__(self, typeOrExpr: ASTType | ASTExpression, isType: bool):
|
def __init__(self, typeOrExpr: ASTType | ASTExpression, isType: bool) -> None:
|
||||||
self.typeOrExpr = typeOrExpr
|
self.typeOrExpr = typeOrExpr
|
||||||
self.isType = isType
|
self.isType = isType
|
||||||
|
|
||||||
@ -719,7 +719,7 @@ class ASTTypeId(ASTExpression):
|
|||||||
################################################################################
|
################################################################################
|
||||||
|
|
||||||
class ASTUnaryOpExpr(ASTExpression):
|
class ASTUnaryOpExpr(ASTExpression):
|
||||||
def __init__(self, op: str, expr: ASTExpression):
|
def __init__(self, op: str, expr: ASTExpression) -> None:
|
||||||
self.op = op
|
self.op = op
|
||||||
self.expr = expr
|
self.expr = expr
|
||||||
|
|
||||||
@ -743,7 +743,7 @@ class ASTUnaryOpExpr(ASTExpression):
|
|||||||
|
|
||||||
|
|
||||||
class ASTSizeofParamPack(ASTExpression):
|
class ASTSizeofParamPack(ASTExpression):
|
||||||
def __init__(self, identifier: ASTIdentifier):
|
def __init__(self, identifier: ASTIdentifier) -> None:
|
||||||
self.identifier = identifier
|
self.identifier = identifier
|
||||||
|
|
||||||
def _stringify(self, transform: StringifyTransform) -> str:
|
def _stringify(self, transform: StringifyTransform) -> str:
|
||||||
@ -763,7 +763,7 @@ class ASTSizeofParamPack(ASTExpression):
|
|||||||
|
|
||||||
|
|
||||||
class ASTSizeofType(ASTExpression):
|
class ASTSizeofType(ASTExpression):
|
||||||
def __init__(self, typ: ASTType):
|
def __init__(self, typ: ASTType) -> None:
|
||||||
self.typ = typ
|
self.typ = typ
|
||||||
|
|
||||||
def _stringify(self, transform: StringifyTransform) -> str:
|
def _stringify(self, transform: StringifyTransform) -> str:
|
||||||
@ -781,7 +781,7 @@ class ASTSizeofType(ASTExpression):
|
|||||||
|
|
||||||
|
|
||||||
class ASTSizeofExpr(ASTExpression):
|
class ASTSizeofExpr(ASTExpression):
|
||||||
def __init__(self, expr: ASTExpression):
|
def __init__(self, expr: ASTExpression) -> None:
|
||||||
self.expr = expr
|
self.expr = expr
|
||||||
|
|
||||||
def _stringify(self, transform: StringifyTransform) -> str:
|
def _stringify(self, transform: StringifyTransform) -> str:
|
||||||
@ -798,7 +798,7 @@ class ASTSizeofExpr(ASTExpression):
|
|||||||
|
|
||||||
|
|
||||||
class ASTAlignofExpr(ASTExpression):
|
class ASTAlignofExpr(ASTExpression):
|
||||||
def __init__(self, typ: ASTType):
|
def __init__(self, typ: ASTType) -> None:
|
||||||
self.typ = typ
|
self.typ = typ
|
||||||
|
|
||||||
def _stringify(self, transform: StringifyTransform) -> str:
|
def _stringify(self, transform: StringifyTransform) -> str:
|
||||||
@ -816,7 +816,7 @@ class ASTAlignofExpr(ASTExpression):
|
|||||||
|
|
||||||
|
|
||||||
class ASTNoexceptExpr(ASTExpression):
|
class ASTNoexceptExpr(ASTExpression):
|
||||||
def __init__(self, expr: ASTExpression):
|
def __init__(self, expr: ASTExpression) -> None:
|
||||||
self.expr = expr
|
self.expr = expr
|
||||||
|
|
||||||
def _stringify(self, transform: StringifyTransform) -> str:
|
def _stringify(self, transform: StringifyTransform) -> str:
|
||||||
@ -883,7 +883,7 @@ class ASTNewExpr(ASTExpression):
|
|||||||
|
|
||||||
|
|
||||||
class ASTDeleteExpr(ASTExpression):
|
class ASTDeleteExpr(ASTExpression):
|
||||||
def __init__(self, rooted: bool, array: bool, expr: ASTExpression):
|
def __init__(self, rooted: bool, array: bool, expr: ASTExpression) -> None:
|
||||||
self.rooted = rooted
|
self.rooted = rooted
|
||||||
self.array = array
|
self.array = array
|
||||||
self.expr = expr
|
self.expr = expr
|
||||||
@ -921,7 +921,7 @@ class ASTDeleteExpr(ASTExpression):
|
|||||||
################################################################################
|
################################################################################
|
||||||
|
|
||||||
class ASTCastExpr(ASTExpression):
|
class ASTCastExpr(ASTExpression):
|
||||||
def __init__(self, typ: ASTType, expr: ASTExpression):
|
def __init__(self, typ: ASTType, expr: ASTExpression) -> None:
|
||||||
self.typ = typ
|
self.typ = typ
|
||||||
self.expr = expr
|
self.expr = expr
|
||||||
|
|
||||||
@ -944,7 +944,7 @@ class ASTCastExpr(ASTExpression):
|
|||||||
|
|
||||||
|
|
||||||
class ASTBinOpExpr(ASTExpression):
|
class ASTBinOpExpr(ASTExpression):
|
||||||
def __init__(self, exprs: list[ASTExpression], ops: list[str]):
|
def __init__(self, exprs: list[ASTExpression], ops: list[str]) -> None:
|
||||||
assert len(exprs) > 0
|
assert len(exprs) > 0
|
||||||
assert len(exprs) == len(ops) + 1
|
assert len(exprs) == len(ops) + 1
|
||||||
self.exprs = exprs
|
self.exprs = exprs
|
||||||
@ -985,7 +985,7 @@ class ASTBinOpExpr(ASTExpression):
|
|||||||
|
|
||||||
class ASTConditionalExpr(ASTExpression):
|
class ASTConditionalExpr(ASTExpression):
|
||||||
def __init__(self, ifExpr: ASTExpression, thenExpr: ASTExpression,
|
def __init__(self, ifExpr: ASTExpression, thenExpr: ASTExpression,
|
||||||
elseExpr: ASTExpression):
|
elseExpr: ASTExpression) -> None:
|
||||||
self.ifExpr = ifExpr
|
self.ifExpr = ifExpr
|
||||||
self.thenExpr = thenExpr
|
self.thenExpr = thenExpr
|
||||||
self.elseExpr = elseExpr
|
self.elseExpr = elseExpr
|
||||||
@ -1054,7 +1054,7 @@ class ASTBracedInitList(ASTBase):
|
|||||||
|
|
||||||
class ASTAssignmentExpr(ASTExpression):
|
class ASTAssignmentExpr(ASTExpression):
|
||||||
def __init__(self, leftExpr: ASTExpression, op: str,
|
def __init__(self, leftExpr: ASTExpression, op: str,
|
||||||
rightExpr: ASTExpression | ASTBracedInitList):
|
rightExpr: ASTExpression | ASTBracedInitList) -> None:
|
||||||
self.leftExpr = leftExpr
|
self.leftExpr = leftExpr
|
||||||
self.op = op
|
self.op = op
|
||||||
self.rightExpr = rightExpr
|
self.rightExpr = rightExpr
|
||||||
@ -1089,7 +1089,7 @@ class ASTAssignmentExpr(ASTExpression):
|
|||||||
|
|
||||||
|
|
||||||
class ASTCommaExpr(ASTExpression):
|
class ASTCommaExpr(ASTExpression):
|
||||||
def __init__(self, exprs: list[ASTExpression]):
|
def __init__(self, exprs: list[ASTExpression]) -> None:
|
||||||
assert len(exprs) > 0
|
assert len(exprs) > 0
|
||||||
self.exprs = exprs
|
self.exprs = exprs
|
||||||
|
|
||||||
@ -1115,7 +1115,7 @@ class ASTCommaExpr(ASTExpression):
|
|||||||
|
|
||||||
|
|
||||||
class ASTFallbackExpr(ASTExpression):
|
class ASTFallbackExpr(ASTExpression):
|
||||||
def __init__(self, expr: str):
|
def __init__(self, expr: str) -> None:
|
||||||
self.expr = expr
|
self.expr = expr
|
||||||
|
|
||||||
def _stringify(self, transform: StringifyTransform) -> str:
|
def _stringify(self, transform: StringifyTransform) -> str:
|
||||||
@ -1411,7 +1411,7 @@ class ASTTrailingTypeSpecDecltypeAuto(ASTTrailingTypeSpec):
|
|||||||
|
|
||||||
|
|
||||||
class ASTTrailingTypeSpecDecltype(ASTTrailingTypeSpec):
|
class ASTTrailingTypeSpecDecltype(ASTTrailingTypeSpec):
|
||||||
def __init__(self, expr: ASTExpression):
|
def __init__(self, expr: ASTExpression) -> None:
|
||||||
self.expr = expr
|
self.expr = expr
|
||||||
|
|
||||||
def _stringify(self, transform: StringifyTransform) -> str:
|
def _stringify(self, transform: StringifyTransform) -> str:
|
||||||
@ -1509,7 +1509,7 @@ class ASTFunctionParameter(ASTBase):
|
|||||||
|
|
||||||
|
|
||||||
class ASTNoexceptSpec(ASTBase):
|
class ASTNoexceptSpec(ASTBase):
|
||||||
def __init__(self, expr: ASTExpression | None):
|
def __init__(self, expr: ASTExpression | None) -> None:
|
||||||
self.expr = expr
|
self.expr = expr
|
||||||
|
|
||||||
def _stringify(self, transform: StringifyTransform) -> str:
|
def _stringify(self, transform: StringifyTransform) -> str:
|
||||||
@ -1870,7 +1870,7 @@ class ASTDeclSpecs(ASTBase):
|
|||||||
################################################################################
|
################################################################################
|
||||||
|
|
||||||
class ASTArray(ASTBase):
|
class ASTArray(ASTBase):
|
||||||
def __init__(self, size: ASTExpression):
|
def __init__(self, size: ASTExpression) -> None:
|
||||||
self.size = size
|
self.size = size
|
||||||
|
|
||||||
def _stringify(self, transform: StringifyTransform) -> str:
|
def _stringify(self, transform: StringifyTransform) -> str:
|
||||||
@ -2033,7 +2033,7 @@ class ASTDeclaratorNameParamQual(ASTDeclarator):
|
|||||||
|
|
||||||
|
|
||||||
class ASTDeclaratorNameBitField(ASTDeclarator):
|
class ASTDeclaratorNameBitField(ASTDeclarator):
|
||||||
def __init__(self, declId: ASTNestedName, size: ASTExpression):
|
def __init__(self, declId: ASTNestedName, size: ASTExpression) -> None:
|
||||||
self.declId = declId
|
self.declId = declId
|
||||||
self.size = size
|
self.size = size
|
||||||
|
|
||||||
@ -2490,7 +2490,7 @@ class ASTDeclaratorParen(ASTDeclarator):
|
|||||||
##############################################################################################
|
##############################################################################################
|
||||||
|
|
||||||
class ASTPackExpansionExpr(ASTExpression):
|
class ASTPackExpansionExpr(ASTExpression):
|
||||||
def __init__(self, expr: ASTExpression | ASTBracedInitList):
|
def __init__(self, expr: ASTExpression | ASTBracedInitList) -> None:
|
||||||
self.expr = expr
|
self.expr = expr
|
||||||
|
|
||||||
def _stringify(self, transform: StringifyTransform) -> str:
|
def _stringify(self, transform: StringifyTransform) -> str:
|
||||||
|
@ -146,7 +146,7 @@ class BuildEnvironment:
|
|||||||
|
|
||||||
# --------- ENVIRONMENT INITIALIZATION -------------------------------------
|
# --------- ENVIRONMENT INITIALIZATION -------------------------------------
|
||||||
|
|
||||||
def __init__(self, app: Sphinx):
|
def __init__(self, app: Sphinx) -> None:
|
||||||
self.app: Sphinx = app
|
self.app: Sphinx = app
|
||||||
self.doctreedir: Path = app.doctreedir
|
self.doctreedir: Path = app.doctreedir
|
||||||
self.srcdir: Path = app.srcdir
|
self.srcdir: Path = app.srcdir
|
||||||
|
@ -605,7 +605,7 @@ class ImportExceptionGroup(Exception):
|
|||||||
It contains an error messages and a list of exceptions as its arguments.
|
It contains an error messages and a list of exceptions as its arguments.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, message: str | None, exceptions: Sequence[BaseException]):
|
def __init__(self, message: str | None, exceptions: Sequence[BaseException]) -> None:
|
||||||
super().__init__(message)
|
super().__init__(message)
|
||||||
self.exceptions = list(exceptions)
|
self.exceptions = list(exceptions)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user