Skip to content

Commit ebef107

Browse files
Avasamrhelmot
andauthored
Work around stubuploader issue (#6)
typeshed-internal/stub_uploader#90 Co-authored-by: Audrey Dutcher <[email protected]>
1 parent 7355586 commit ebef107

File tree

2 files changed

+15
-9
lines changed

2 files changed

+15
-9
lines changed

stubs/networkx/METADATA.toml

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
version = "3.1"
22
upstream_repository = "https://github.com/networkx/networkx"
3-
requires = ["numpy", "pandas-stubs"]
3+
requires = ["numpy"]
44
partial_stub = true
55

66
[tool.stubtest]
77
ignore_missing_stub = true
8+
# stub_uploader won't allow pandas-stubs in the requires field https://github.com/typeshed-internal/stub_uploader/issues/90
9+
stubtest_requirements = ["pandas"]

stubs/networkx/networkx/convert_matrix.pyi

+12-8
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
from _typeshed import Incomplete
22
from collections.abc import Callable, Iterable
3-
from typing_extensions import Literal
3+
from typing_extensions import Literal, TypeAlias
44

55
import numpy
66
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
913

1014
def to_pandas_adjacency(
1115
G: Graph[_Node],
@@ -15,18 +19,18 @@ def to_pandas_adjacency(
1519
multigraph_weight: Callable[[Iterable[float]], float] = ...,
1620
weight: str = ...,
1721
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]: ...
2024
def to_pandas_edgelist(
2125
G: Graph[_Node],
2226
source: str | int = ...,
2327
target: str | int = ...,
2428
nodelist: list[_Node] | None = ...,
25-
dtype: ExtensionDtype | None = ...,
29+
dtype: _ExtensionDtype | None = ...,
2630
edge_key: str | int | None = ...,
27-
) -> DataFrame: ...
31+
) -> _DataFrame: ...
2832
def from_pandas_edgelist(
29-
df: DataFrame,
33+
df: _DataFrame,
3034
source: str | int = ...,
3135
target: str | int = ...,
3236
edge_attr: str | int | Iterable[str | int] | Literal[True] | None = ...,

0 commit comments

Comments
 (0)