Skip to content

Commit b9a0652

Browse files
committed
Fix nx_pydot.pyi
1 parent 8a56044 commit b9a0652

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed
Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,20 @@
1-
from _typeshed import Incomplete
1+
from os import PathLike
2+
from typing import IO, Any
3+
from typing_extensions import TypeAlias
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+
_File: TypeAlias = str | PathLike[Any] | IO[str]
12+
13+
def write_dot(G: Graph[_Node], path: _File) -> None: ...
1014
@_dispatchable
11-
def read_dot(path) -> Graph[Incomplete]: ...
15+
def read_dot(path: _File) -> Graph[str]: ...
1216
@_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): ...
17+
def from_pydot(P: Dot): ...
18+
def to_pydot(N: Graph[_Node]) -> Dot: ...
19+
def graphviz_layout(G: Graph[_Node], prog: str = "neato", root: _Node | None = None): ...
20+
def pydot_layout(G: Graph[_Node], prog: str = "neato", root: _Node | None = None): ...

0 commit comments

Comments
 (0)