@@ -10,17 +10,66 @@ import typing
1010from rustworkx .rustworkx import PyGraph , PyDiGraph
1111
1212if typing .TYPE_CHECKING :
13- from PIL import Image # type: ignore
13+ from PIL .Image import Image
14+ Method : typing .TypeAlias = typing .Literal ["twopi" , "neato" , "circo" , "fdp" , "sfdp" , "dot" ]
15+ ImageType : typing .TypeAlias = typing .Literal [
16+ "canon" ,
17+ "cmap" ,
18+ "cmapx" ,
19+ "cmapx_np" ,
20+ "dia" ,
21+ "dot" ,
22+ "fig" ,
23+ "gd" ,
24+ "gd2" ,
25+ "gif" ,
26+ "hpgl" ,
27+ "imap" ,
28+ "imap_np" ,
29+ "ismap" ,
30+ "jpe" ,
31+ "jpeg" ,
32+ "jpg" ,
33+ "mif" ,
34+ "mp" ,
35+ "pcl" ,
36+ "pdf" ,
37+ "pic" ,
38+ "plain" ,
39+ "plain-ext" ,
40+ "png" ,
41+ "ps" ,
42+ "ps2" ,
43+ "svg" ,
44+ "svgz" ,
45+ "vml" ,
46+ "vmlzvrml" ,
47+ "vtx" ,
48+ "wbmp" ,
49+ "xdor" ,
50+ "xlib" ,
51+ ]
1452
1553_S = typing .TypeVar ("_S" )
1654_T = typing .TypeVar ("_T" )
1755
56+ @typing .overload
1857def graphviz_draw (
1958 graph : PyDiGraph [_S , _T ] | PyGraph [_S , _T ],
2059 node_attr_fn : typing .Callable [[_S ], dict [str , str ]] | None = ...,
2160 edge_attr_fn : typing .Callable [[_T ], dict [str , str ]] | None = ...,
2261 graph_attr : dict [str , str ] | None = ...,
23- filename : str | None = ...,
24- image_type : str | None = ...,
25- method : str | None = ...,
26- ) -> Image | None : ...
62+ filename : None = ...,
63+ image_type : ImageType | None = ...,
64+ method : Method | None = ...,
65+ ) -> Image : ...
66+ @typing .overload
67+ def graphviz_draw (
68+ graph : PyDiGraph [_S , _T ] | PyGraph [_S , _T ],
69+ node_attr_fn : typing .Callable [[_S ], dict [str , str ]] | None = ...,
70+ edge_attr_fn : typing .Callable [[_T ], dict [str , str ]] | None = ...,
71+ graph_attr : dict [str , str ] | None = ...,
72+ filename : str = ...,
73+ image_type : ImageType | None = ...,
74+ method : Method | None = ...,
75+ ) -> None : ...
0 commit comments