Remove `sphinx.domains.{c,cpp}` from the no-any-generics whitelist

This commit is contained in:
Adam Turner
2025-01-23 00:48:43 +00:00
parent 2bf08d6da4
commit 5921199189
3 changed files with 10 additions and 17 deletions

View File

@@ -229,13 +229,6 @@ module = [
]
strict_optional = false
[[tool.mypy.overrides]]
module = [
"sphinx.domains.c",
"sphinx.domains.cpp",
]
disallow_any_generics = false
[[tool.mypy.overrides]]
module = [
"imagesize",

View File

@@ -213,7 +213,7 @@ class CObject(ObjectDescription[ASTDeclaration]):
return parser.parse_declaration(self.object_type, self.objtype)
def describe_signature(
self, signode: TextElement, ast: ASTDeclaration, options: dict
self, signode: TextElement, ast: ASTDeclaration, options: dict[str, Any]
) -> None:
ast.describe_signature(signode, 'lastIsName', self.env, options)
@@ -472,7 +472,7 @@ class AliasNode(nodes.Element):
def __init__(
self,
sig: str,
aliasOptions: dict,
aliasOptions: dict[str, bool],
document: Any,
env: BuildEnvironment | None = None,
parentKey: LookupKey | None = None,
@@ -509,8 +509,8 @@ class AliasTransform(SphinxTransform):
s: Symbol,
maxdepth: int,
skip_this: bool,
alias_options: dict,
render_options: dict,
alias_options: dict[str, bool],
render_options: dict[str, bool],
document: Any,
) -> list[Node]:
if maxdepth == 0:
@@ -629,7 +629,7 @@ class AliasTransform(SphinxTransform):
node.replace_self(nodes)
class CAliasObject(ObjectDescription):
class CAliasObject(ObjectDescription[str]):
option_spec: ClassVar[OptionSpec] = {
'maxdepth': directives.nonnegative_int,
'noroot': directives.flag,

View File

@@ -304,7 +304,7 @@ class CPPObject(ObjectDescription[ASTDeclaration]):
return parser.parse_declaration(self.object_type, self.objtype)
def describe_signature(
self, signode: desc_signature, ast: ASTDeclaration, options: dict
self, signode: desc_signature, ast: ASTDeclaration, options: dict[str, Any]
) -> None:
ast.describe_signature(signode, 'lastIsName', self.env, options)
@@ -621,7 +621,7 @@ class AliasNode(nodes.Element):
def __init__(
self,
sig: str,
aliasOptions: dict,
aliasOptions: dict[str, bool],
env: BuildEnvironment | None = None,
parentKey: LookupKey | None = None,
) -> None:
@@ -653,8 +653,8 @@ class AliasTransform(SphinxTransform):
s: Symbol,
maxdepth: int,
skip_this: bool,
alias_options: dict,
render_options: dict,
alias_options: dict[str, bool],
render_options: dict[str, bool],
document: Any,
) -> list[Node]:
if maxdepth == 0:
@@ -799,7 +799,7 @@ class AliasTransform(SphinxTransform):
node.replace_self(nodes)
class CPPAliasObject(ObjectDescription):
class CPPAliasObject(ObjectDescription[str]):
option_spec: ClassVar[OptionSpec] = {
'maxdepth': directives.nonnegative_int,
'noroot': directives.flag,