1
1
from _typeshed import Incomplete
2
2
from collections .abc import Callable , Iterable
3
- from typing_extensions import Literal
3
+ from typing_extensions import Literal , TypeAlias
4
4
5
5
import numpy
6
6
from networkx .classes .graph import Graph , _Node
7
- from pandas import DataFrame
8
- from pandas .core .dtypes .base import ExtensionDtype
7
+
8
+ # stub_uploader won't allow pandas-stubs in the requires field https://github.com/typeshed-internal/stub_uploader/issues/90
9
+ # from pandas import DataFrame
10
+ _DataFrame : TypeAlias = Incomplete
11
+ # from pandas.core.dtypes.base import ExtensionDtype
12
+ _ExtensionDtype : TypeAlias = Incomplete
9
13
10
14
def to_pandas_adjacency (
11
15
G : Graph [_Node ],
@@ -15,18 +19,18 @@ def to_pandas_adjacency(
15
19
multigraph_weight : Callable [[Iterable [float ]], float ] = ...,
16
20
weight : str = ...,
17
21
nonedge : float = ...,
18
- ) -> DataFrame : ...
19
- def from_pandas_adjacency (df : DataFrame , create_using : type [Graph [Incomplete ]] = ...) -> Graph [Incomplete ]: ...
22
+ ) -> _DataFrame : ...
23
+ def from_pandas_adjacency (df : _DataFrame , create_using : type [Graph [Incomplete ]] = ...) -> Graph [Incomplete ]: ...
20
24
def to_pandas_edgelist (
21
25
G : Graph [_Node ],
22
26
source : str | int = ...,
23
27
target : str | int = ...,
24
28
nodelist : list [_Node ] | None = ...,
25
- dtype : ExtensionDtype | None = ...,
29
+ dtype : _ExtensionDtype | None = ...,
26
30
edge_key : str | int | None = ...,
27
- ) -> DataFrame : ...
31
+ ) -> _DataFrame : ...
28
32
def from_pandas_edgelist (
29
- df : DataFrame ,
33
+ df : _DataFrame ,
30
34
source : str | int = ...,
31
35
target : str | int = ...,
32
36
edge_attr : str | int | Iterable [str | int ] | Literal [True ] | None = ...,
0 commit comments