Skip to content

Commit

Permalink
fixup, various, e.g., typing and naming
Browse files Browse the repository at this point in the history
  • Loading branch information
jakobandersen committed Apr 13, 2024
1 parent 88b2f5b commit 0b277b2
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions sphinx/domains/c/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -667,7 +667,7 @@ class CDomain(Domain):
'objects': {}, # fullname -> docname, node_id, objtype
}

initial_intersphinx_inventory = {
initial_intersphinx_inventory: dict[str, Symbol] = {
'root_symbol': Symbol(None, None, None, None, None),
}

Expand Down Expand Up @@ -797,23 +797,24 @@ def get_objects(self) -> Iterator[tuple[str, str, str, str, str, int]]:
newestId = symbol.declaration.get_newest_id()
yield (name, dispname, objectType, docname, newestId, 1)

def intersphinx_add_entries_v2(self, store: dict,
def intersphinx_add_entries_v2(self, store: dict[str, Symbol],
data: dict[str, dict[str, Any]]) -> None:
root = store['root_symbol'] # type: Symbol
root = store['root_symbol']
for object_type, per_type_data in data.items():
for object_name, item_set in per_type_data.items():
parser = DefinitionParser(
object_name, location=('intersphinx', 0), config=self.env.config)
try:
ast = parser._parse_nested_name()
except DefinitionError as e:
logger.warning("Error in C entry in intersphinx inventory:\n" + str(e))
logger.warning("Error in C entry in intersphinx inventory:\n%s", e)
continue
decl = ASTDeclaration(object_type, 'intersphinx',
ASTIntersphinx_v2(ast, item_set))
root.add_declaration(decl, docname="$FakeIntersphinxDoc", line=0)
root.add_declaration(decl, docname="_$FakeIntersphinxDoc", line=0)

def _intersphinx_resolve_xref_inner(self, env: "BuildEnvironment", store: dict,
def _intersphinx_resolve_xref_inner(self, env: BuildEnvironment,
store: dict[str, Symbol],
target: str,
node: pending_xref,
typ: str) -> Any | None:
Expand All @@ -828,8 +829,8 @@ def _intersphinx_resolve_xref_inner(self, env: "BuildEnvironment", store: dict,
decl = cast(ASTIntersphinx_v2, s.declaration.declaration)
return decl.data

def intersphinx_resolve_xref(self, env: "BuildEnvironment",
store: Any,
def intersphinx_resolve_xref(self, env: BuildEnvironment,
store: dict[str, Symbol],
typ: str, target: str,
disabled_object_types: list[str],
node: pending_xref, contnode: Element
Expand Down

0 comments on commit 0b277b2

Please sign in to comment.