From 18dde72fe7877d8bac05cff25d04eba641c3e03b Mon Sep 17 00:00:00 2001 From: Kanishk Pachauri Date: Wed, 18 Sep 2024 00:32:43 +0530 Subject: [PATCH] fix: Add typehints to _WeightFunction type alias. --- stubs/networkx/networkx/algorithms/shortest_paths/weighted.pyi | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/stubs/networkx/networkx/algorithms/shortest_paths/weighted.pyi b/stubs/networkx/networkx/algorithms/shortest_paths/weighted.pyi index bcaf4e811bff..ad3d0d0c3879 100644 --- a/stubs/networkx/networkx/algorithms/shortest_paths/weighted.pyi +++ b/stubs/networkx/networkx/algorithms/shortest_paths/weighted.pyi @@ -1,11 +1,12 @@ from _typeshed import Incomplete from collections.abc import Callable, Generator from typing import Any +from typing_extensions import TypeAlias from networkx.utils.backends import _dispatch # type alias for the weight function -_WeightFunction = Callable[[Any, Any, dict[str, Any]], float | None] +_WeightFunction: TypeAlias = Callable[[Any, Any, dict[str, Any]], float | None] @_dispatch def dijkstra_path(G, source, target, weight: str | _WeightFunction = "weight"): ...