diff options
Diffstat (limited to 'sphinx/domains/cpp.py')
-rw-r--r-- | sphinx/domains/cpp.py | 58 |
1 files changed, 29 insertions, 29 deletions
diff --git a/sphinx/domains/cpp.py b/sphinx/domains/cpp.py index eff74116e..2ff81834e 100644 --- a/sphinx/domains/cpp.py +++ b/sphinx/domains/cpp.py @@ -340,7 +340,7 @@ _keywords = [ 'static_assert', 'static_cast', 'struct', 'switch', 'template', 'this', 'thread_local', 'throw', 'true', 'try', 'typedef', 'typeid', 'typename', 'union', 'unsigned', 'using', 'virtual', 'void', 'volatile', 'wchar_t', - 'while', 'xor', 'xor_eq' + 'while', 'xor', 'xor_eq', ] @@ -377,7 +377,7 @@ _id_fundamental_v1 = { 'long': 'l', 'signed long': 'l', 'unsigned long': 'L', - 'bool': 'b' + 'bool': 'b', } _id_shorthands_v1 = { 'std::string': 'ss', @@ -385,7 +385,7 @@ _id_shorthands_v1 = { 'std::istream': 'is', 'std::iostream': 'ios', 'std::vector': 'v', - 'std::map': 'm' + 'std::map': 'm', } _id_operator_v1 = { 'new': 'new-operator', @@ -434,7 +434,7 @@ _id_operator_v1 = { '->*': 'pointer-by-pointer-operator', '->': 'pointer-operator', '()': 'call-operator', - '[]': 'subscript-operator' + '[]': 'subscript-operator', } # ------------------------------------------------------------------------------ @@ -492,7 +492,7 @@ _id_fundamental_v2 = { '_Imaginary long double': 'e', 'auto': 'Da', 'decltype(auto)': 'Dc', - 'std::nullptr_t': 'Dn' + 'std::nullptr_t': 'Dn', } _id_operator_v2 = { 'new': 'nw', @@ -555,11 +555,11 @@ _id_operator_unary_v2 = { '+': 'ps', '-': 'ng', '!': 'nt', 'not': 'nt', - '~': 'co', 'compl': 'co' + '~': 'co', 'compl': 'co', } _id_char_from_prefix: dict[str | None, str] = { None: 'c', 'u8': 'c', - 'u': 'Ds', 'U': 'Di', 'L': 'w' + 'u': 'Ds', 'U': 'Di', 'L': 'w', } # these are ordered by preceedence _expression_bin_ops = [ @@ -573,7 +573,7 @@ _expression_bin_ops = [ ['<<', '>>'], ['+', '-'], ['*', '/', '%'], - ['.*', '->*'] + ['.*', '->*'], ] _expression_unary_ops = ["++", "--", "*", "&", "+", "-", "!", "not", "~", "compl"] _expression_assignment_ops = ["=", "*=", "/=", "%=", "+=", "-=", @@ -582,7 +582,7 @@ _id_explicit_cast = { 'dynamic_cast': 'dc', 'static_cast': 'sc', 'const_cast': 'cc', - 'reinterpret_cast': 'rc' + 'reinterpret_cast': 'rc', } @@ -3661,7 +3661,7 @@ class ASTTemplateParamTemplateType(ASTTemplateParam): return self.data.get_identifier() def get_id( - self, version: int, objectType: str | None = None, symbol: Symbol | None = None + self, version: int, objectType: str | None = None, symbol: Symbol | None = None, ) -> str: assert version >= 2 # this is not part of the normal name mangling in C++ @@ -4405,7 +4405,7 @@ class Symbol: def _find_first_named_symbol(self, identOrOp: ASTIdentifier | ASTOperator, templateParams: Any, templateArgs: ASTTemplateArgs, templateShorthand: bool, matchSelf: bool, - recurseInAnon: bool, correctPrimaryTemplateArgs: bool + recurseInAnon: bool, correctPrimaryTemplateArgs: bool, ) -> Symbol: if Symbol.debug_lookup: Symbol.debug_print("_find_first_named_symbol ->") @@ -4508,12 +4508,12 @@ class Symbol: nestedName: ASTNestedName, templateDecls: list[Any], onMissingQualifiedSymbol: Callable[ - [Symbol, ASTIdentifier | ASTOperator, Any, ASTTemplateArgs], Symbol + [Symbol, ASTIdentifier | ASTOperator, Any, ASTTemplateArgs], Symbol, ], strictTemplateParamArgLists: bool, ancestorLookupType: str, templateShorthand: bool, matchSelf: bool, recurseInAnon: bool, correctPrimaryTemplateArgs: bool, - searchInSiblings: bool + searchInSiblings: bool, ) -> SymbolLookupResult: # ancestorLookupType: if not None, specifies the target type of the lookup if Symbol.debug_lookup: @@ -4654,7 +4654,7 @@ class Symbol: def onMissingQualifiedSymbol(parentSymbol: Symbol, identOrOp: ASTIdentifier | ASTOperator, - templateParams: Any, templateArgs: ASTTemplateArgs + templateParams: Any, templateArgs: ASTTemplateArgs, ) -> Symbol: if Symbol.debug_lookup: Symbol.debug_indent += 1 @@ -4963,7 +4963,7 @@ class Symbol: return res def find_identifier(self, identOrOp: ASTIdentifier | ASTOperator, - matchSelf: bool, recurseInAnon: bool, searchInSiblings: bool + matchSelf: bool, recurseInAnon: bool, searchInSiblings: bool, ) -> Symbol: if Symbol.debug_lookup: Symbol.debug_indent += 1 @@ -5334,7 +5334,7 @@ class DefinitionParser(BaseParser): except DefinitionError as eExpr: raise self._make_multi_error([ (eFold, "If fold expression"), - (eExpr, "If parenthesized expression") + (eExpr, "If parenthesized expression"), ], "Error in fold expression or parenthesized expression.") from eExpr return ASTParenExpr(res) # now it definitely is a fold expression @@ -5374,7 +5374,7 @@ class DefinitionParser(BaseParser): return ASTIdExpression(nn) return None - def _parse_initializer_list(self, name: str, open: str, close: str + def _parse_initializer_list(self, name: str, open: str, close: str, ) -> tuple[list[ASTExpression | ASTBracedInitList], bool]: # Parse open and close with the actual initializer-list in between @@ -5435,7 +5435,7 @@ class DefinitionParser(BaseParser): return ASTBracedInitList(exprs, trailingComma) def _parse_expression_list_or_braced_init_list( - self + self, ) -> ASTParenExprList | ASTBracedInitList: paren = self._parse_paren_expression_list() if paren is not None: @@ -6375,7 +6375,7 @@ class DefinitionParser(BaseParser): return ASTDeclSpecs(outer, leftSpecs, rightSpecs, trailing) def _parse_declarator_name_suffix( - self, named: bool | str, paramMode: str, typed: bool + self, named: bool | str, paramMode: str, typed: bool, ) -> ASTDeclaratorNameParamQual | ASTDeclaratorNameBitField: # now we should parse the name, and then suffixes if named == 'maybe': @@ -6430,7 +6430,7 @@ class DefinitionParser(BaseParser): paramQual=paramQual) def _parse_declarator(self, named: bool | str, paramMode: str, - typed: bool = True + typed: bool = True, ) -> ASTDeclarator: # 'typed' here means 'parse return type stuff' if paramMode not in ('type', 'function', 'operatorCast', 'new'): @@ -6544,7 +6544,7 @@ class DefinitionParser(BaseParser): header = "Error in declarator or parameters-and-qualifiers" raise self._make_multi_error(prevErrors, header) from e - def _parse_initializer(self, outer: str = None, allowFallback: bool = True + def _parse_initializer(self, outer: str = None, allowFallback: bool = True, ) -> ASTInitializer: # initializer # global vars # -> brace-or-equal-initializer @@ -6990,7 +6990,7 @@ class DefinitionParser(BaseParser): else: return ASTRequiresClause(ASTBinOpExpr(orExprs, ops)) - def _parse_template_declaration_prefix(self, objectType: str + def _parse_template_declaration_prefix(self, objectType: str, ) -> ASTTemplateDeclarationPrefix | None: templates: list[ASTTemplateParams | ASTTemplateIntroduction] = [] while 1: @@ -7025,7 +7025,7 @@ class DefinitionParser(BaseParser): def _check_template_consistency(self, nestedName: ASTNestedName, templatePrefix: ASTTemplateDeclarationPrefix, - fullSpecShorthand: bool, isMember: bool = False + fullSpecShorthand: bool, isMember: bool = False, ) -> ASTTemplateDeclarationPrefix: numArgs = nestedName.num_templates() isMemberInstantiation = False @@ -7878,7 +7878,7 @@ class CPPDomain(Domain): 'namespace-push': CPPNamespacePushObject, 'namespace-pop': CPPNamespacePopObject, # other - 'alias': CPPAliasObject + 'alias': CPPAliasObject, } roles = { 'any': CPPXRefRole(), @@ -7893,11 +7893,11 @@ class CPPDomain(Domain): 'enum': CPPXRefRole(), 'enumerator': CPPXRefRole(), 'expr': CPPExprRole(asCode=True), - 'texpr': CPPExprRole(asCode=False) + 'texpr': CPPExprRole(asCode=False), } initial_data = { 'root_symbol': Symbol(None, None, None, None, None, None, None), - 'names': {} # full name for indexing -> docname + 'names': {}, # full name for indexing -> docname } def clear_doc(self, docname: str) -> None: @@ -8098,18 +8098,18 @@ 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.get_newest_id(), contnode, displayName, ), declaration.objectType return res def resolve_xref(self, env: BuildEnvironment, fromdocname: str, builder: Builder, - typ: str, target: str, node: pending_xref, contnode: Element + typ: str, target: str, node: pending_xref, contnode: Element, ) -> Element | None: return self._resolve_xref_inner(env, fromdocname, builder, typ, target, node, contnode)[0] def resolve_any_xref(self, env: BuildEnvironment, fromdocname: str, builder: Builder, - target: str, node: pending_xref, contnode: Element + target: str, node: pending_xref, contnode: Element, ) -> list[tuple[str, Element]]: with logging.suppress_logging(): retnode, objtype = self._resolve_xref_inner(env, fromdocname, builder, |