Skip to content

Commit 4f82a8d

Browse files
authored
Add detailed stubs for networkx.drawing.nx_pydot (#14594)
1 parent 82c02d3 commit 4f82a8d

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed
Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
1-
from _typeshed import Incomplete
1+
from _typeshed import SupportsRead, SupportsWrite
2+
from os import PathLike
3+
from typing import Any
24

5+
from networkx.classes.graph import Graph, _Node
36
from networkx.utils.backends import _dispatchable
4-
5-
from ..classes.graph import Graph
7+
from pydot import Dot # type: ignore[import-not-found] # pyright: ignore[reportMissingImports]
68

79
__all__ = ["write_dot", "read_dot", "graphviz_layout", "pydot_layout", "to_pydot", "from_pydot"]
810

9-
def write_dot(G, path) -> None: ...
11+
def write_dot(G: Graph[_Node], path: str | PathLike[Any] | SupportsWrite[str]) -> None: ...
1012
@_dispatchable
11-
def read_dot(path) -> Graph[Incomplete]: ...
13+
def read_dot(path: str | PathLike[Any] | SupportsRead[str]) -> Graph[str]: ...
1214
@_dispatchable
13-
def from_pydot(P): ...
14-
def to_pydot(N): ...
15-
def graphviz_layout(G, prog: str = "neato", root=None): ...
16-
def pydot_layout(G, prog: str = "neato", root=None): ...
15+
def from_pydot(P: Dot): ...
16+
def to_pydot(N: Graph[_Node]) -> Dot: ...
17+
def graphviz_layout(G: Graph[_Node], prog: str = "neato", root: _Node | None = None): ...
18+
def pydot_layout(G: Graph[_Node], prog: str = "neato", root: _Node | None = None): ...

0 commit comments

Comments
 (0)