mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Fix flake8 and mypy violations
This commit is contained in:
parent
b0a2e5cf04
commit
86eeee5031
@ -119,7 +119,7 @@ class toctree(nodes.General, nodes.Element, translatable):
|
||||
# Domain-specific object descriptions (class, function etc.)
|
||||
#############################################################
|
||||
|
||||
class _desc_classes_injector:
|
||||
class _desc_classes_injector(nodes.TextElement):
|
||||
"""Helper base class for injecting a fixes list of classes.
|
||||
|
||||
Use as the first base class.
|
||||
@ -127,7 +127,7 @@ class _desc_classes_injector:
|
||||
|
||||
classes = [] # type: List[str]
|
||||
|
||||
def __init__(self, *args, **kwargs) -> None:
|
||||
def __init__(self, *args: Any, **kwargs: Any) -> None:
|
||||
super().__init__(*args, **kwargs)
|
||||
self['classes'].extend(self.classes)
|
||||
|
||||
@ -197,7 +197,7 @@ class desc_inline(_desc_classes_injector, nodes.Inline, nodes.TextElement):
|
||||
"""
|
||||
classes = ['sig', 'sig-inline']
|
||||
|
||||
def __init__(self, domain: str, *args, **kwargs):
|
||||
def __init__(self, domain: str, *args: Any, **kwargs: Any) -> None:
|
||||
super().__init__(*args, **kwargs)
|
||||
self['classes'].append(domain)
|
||||
|
||||
@ -226,7 +226,8 @@ class desc_addname(_desc_classes_injector, nodes.Part, nodes.Inline, nodes.Fixed
|
||||
|
||||
This node always has the class ``sig-prename``.
|
||||
"""
|
||||
classes = ['sig-prename', 'descclassname'] # 'descclassname' is for backwards compatibility
|
||||
# 'descclassname' is for backwards compatibility
|
||||
classes = ['sig-prename', 'descclassname']
|
||||
|
||||
|
||||
# compatibility alias
|
||||
|
@ -9,7 +9,7 @@
|
||||
"""
|
||||
|
||||
import re
|
||||
from typing import (Any, Callable, Dict, Generator, Iterator, List, Optional, Tuple, Type,
|
||||
from typing import (Any, Callable, Dict, Generator, Iterator, List, Optional, Tuple,
|
||||
TypeVar, Union, cast)
|
||||
|
||||
from docutils import nodes
|
||||
@ -1623,9 +1623,9 @@ class ASTOperator(ASTBase):
|
||||
symbol: "Symbol") -> None:
|
||||
verify_description_mode(mode)
|
||||
if mode == 'lastIsName':
|
||||
identnode = addnodes.desc_name()
|
||||
self._describe_identifier(identnode, identnode, env, symbol)
|
||||
signode += identnode
|
||||
mainName = addnodes.desc_name()
|
||||
self._describe_identifier(mainName, mainName, env, symbol)
|
||||
signode += mainName
|
||||
elif mode == 'markType':
|
||||
targetText = prefix + str(self) + templateArgs
|
||||
pnode = addnodes.pending_xref('', refdomain='cpp',
|
||||
@ -1637,15 +1637,15 @@ class ASTOperator(ASTBase):
|
||||
# and make that the a link to this operator.
|
||||
# E.g., if it is 'operator SomeType', then 'SomeType' becomes
|
||||
# a link to the operator, not to 'SomeType'.
|
||||
identnode = nodes.literal()
|
||||
self._describe_identifier(signode, identnode, env, symbol)
|
||||
txt = identnode.astext()
|
||||
container = nodes.literal()
|
||||
self._describe_identifier(signode, container, env, symbol)
|
||||
txt = container.astext()
|
||||
pnode += addnodes.desc_name(txt, txt)
|
||||
signode += pnode
|
||||
else:
|
||||
identnode = addnodes.desc_addname()
|
||||
self._describe_identifier(identnode, identnode, env, symbol)
|
||||
signode += identnode
|
||||
addName = addnodes.desc_addname()
|
||||
self._describe_identifier(addName, addName, env, symbol)
|
||||
signode += addName
|
||||
|
||||
|
||||
class ASTOperatorBuildIn(ASTOperator):
|
||||
@ -7690,8 +7690,8 @@ class CPPDomain(Domain):
|
||||
# and reconstruct the title again
|
||||
contnode += nodes.Text(title)
|
||||
res = make_refnode(builder, fromdocname, docname,
|
||||
declaration.get_newest_id(), contnode, displayName
|
||||
), declaration.objectType
|
||||
declaration.get_newest_id(), contnode, displayName
|
||||
), declaration.objectType
|
||||
return res
|
||||
|
||||
def resolve_xref(self, env: BuildEnvironment, fromdocname: str, builder: Builder,
|
||||
|
Loading…
Reference in New Issue
Block a user