networkx: fix and complete functions related to the dot interface (#14600)

This commit is contained in:
Ali Hamdan
2025-08-22 08:59:27 +02:00
committed by GitHub
parent ca44e4c45d
commit 94fe8571a8
2 changed files with 6 additions and 8 deletions
@@ -17,16 +17,14 @@ class _SupportsOpen(Protocol[_ModeT_contra, _FileT_co]):
@_dispatchable
def from_agraph(
A: AGraph, create_using: Graph[_Node] | type[Graph[_Node]] | None = None
) -> Graph[_Node]: ... # type of node cannot be known statically
A: AGraph, create_using: Graph[str] | type[Graph[str]] | None = None # TODO: add overloads on `create_using`
) -> Graph[str]: ...
def to_agraph(N: Graph[_Node]) -> AGraph: ...
def write_dot(
G: Graph[_Node], path: str | IO[str] | IO[bytes] | _SupportsOpen[OpenTextModeWriting, IO[str] | IO[bytes]]
) -> None: ...
@_dispatchable
def read_dot(
path: str | IO[str] | IO[bytes] | _SupportsOpen[OpenTextModeReading, IO[str] | IO[bytes]],
) -> Graph[Any]: ... # type of node cannot be known statically
def read_dot(path: str | IO[str] | IO[bytes] | _SupportsOpen[OpenTextModeReading, IO[str] | IO[bytes]]) -> Graph[str]: ...
def graphviz_layout(
G: Graph[_Node], prog: str = "neato", root: str | None = None, args: str = ""
) -> dict[_Node, tuple[float, float]]: ...
+3 -3
View File
@@ -12,7 +12,7 @@ def write_dot(G: Graph[_Node], path: str | PathLike[Any] | SupportsWrite[str]) -
@_dispatchable
def read_dot(path: str | PathLike[Any] | SupportsRead[str]) -> Graph[str]: ...
@_dispatchable
def from_pydot(P: Dot): ...
def from_pydot(P: Dot) -> Graph[str]: ...
def to_pydot(N: Graph[_Node]) -> Dot: ...
def graphviz_layout(G: Graph[_Node], prog: str = "neato", root: _Node | None = None): ...
def pydot_layout(G: Graph[_Node], prog: str = "neato", root: _Node | None = None): ...
def graphviz_layout(G: Graph[_Node], prog: str = "neato", root: _Node | None = None) -> dict[_Node, tuple[float, float]]: ...
def pydot_layout(G: Graph[_Node], prog: str = "neato", root: _Node | None = None) -> dict[_Node, tuple[float, float]]: ...