Skip to content

Commit

Permalink
Try to fix mypy
Browse files Browse the repository at this point in the history
  • Loading branch information
tristanlatr committed Dec 12, 2024
1 parent bb4497c commit 431a976
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions pydoctor/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -577,11 +577,12 @@ def is_exception(cls: 'Class') -> bool:
return True
return False

Graph: TypeAlias = 'dict[Any, Sequence[T]]'

def topsort(graph: Graph[T]) -> Iterable[T]:
def topsort(graph: Mapping[Any, Sequence[T]]) -> Iterable[T]:
"""
Wrapper for L{graphlib.TopologicalSorter.static_order}.
Given a mapping where each keys corespond to a node
and keys the predecessors of the node, return the topological order of the nodes.
This is a simpple wrapper for L{graphlib.TopologicalSorter.static_order}.
"""
return TopologicalSorter(graph).static_order()

Expand Down Expand Up @@ -669,7 +670,7 @@ def compute_mros(self) -> None:

# If this raises a CycleError, our code is boggus since we already
# checked for cycles ourself.
static_order: Iterable[ClassOrStr] = topsort(self.graph)
static_order = topsort(self.graph)

for cls in static_order:
if cls in self.computed_mros or isinstance(cls, str):
Expand Down

0 comments on commit 431a976

Please sign in to comment.