From 431a976ba5ddd58886d740994dcee7baeff7cdd4 Mon Sep 17 00:00:00 2001 From: tristanlatr Date: Thu, 12 Dec 2024 13:45:39 -0500 Subject: [PATCH] Try to fix mypy --- pydoctor/model.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/pydoctor/model.py b/pydoctor/model.py index 0a4c7da40..11bc62972 100644 --- a/pydoctor/model.py +++ b/pydoctor/model.py @@ -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() @@ -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):