Skip to content

Commit

Permalink
Work around stubuploader issue
Browse files Browse the repository at this point in the history
  • Loading branch information
Avasam committed Oct 23, 2023
1 parent 05daed0 commit 5f386d4
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 9 deletions.
4 changes: 3 additions & 1 deletion stubs/networkx/METADATA.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
version = "3.1"
upstream_repository = "https://github.com/networkx/networkx"
requires = ["pandas-stubs", "numpy"]
requires = ["numpy"]
partial_stub = true

[tool.stubtest]
ignore_missing_stub = true
# stub_uploader won't allow pandas-stubs in the requires field https://github.com/typeshed-internal/stub_uploader/issues/90
stubtest_requirements = ["pandas"]
20 changes: 12 additions & 8 deletions stubs/networkx/networkx/convert_matrix.pyi
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
from _typeshed import Incomplete
from collections.abc import Callable, Iterable
from typing_extensions import Literal
from typing_extensions import Literal, TypeAlias

import numpy
from networkx.classes.graph import Graph, _Node
from pandas import DataFrame
from pandas.core.dtypes.base import ExtensionDtype

# stub_uploader won't allow pandas-stubs in the requires field https://github.com/typeshed-internal/stub_uploader/issues/90
# from pandas import DataFrame
_DataFrame: TypeAlias = Incomplete
# from pandas.core.dtypes.base import ExtensionDtype
_ExtensionDtype: TypeAlias = Incomplete

def to_pandas_adjacency(
G: Graph[_Node],
Expand All @@ -15,18 +19,18 @@ def to_pandas_adjacency(
multigraph_weight: Callable[[Iterable[float]], float] = ...,
weight: str = ...,
nonedge: float = ...,
) -> DataFrame: ...
def from_pandas_adjacency(df: DataFrame, create_using: type[Graph[Incomplete]] = ...) -> Graph[Incomplete]: ...
) -> _DataFrame: ...
def from_pandas_adjacency(df: _DataFrame, create_using: type[Graph[Incomplete]] = ...) -> Graph[Incomplete]: ...
def to_pandas_edgelist(
G: Graph[_Node],
source: str | int = ...,
target: str | int = ...,
nodelist: list[_Node] | None = ...,
dtype: ExtensionDtype | None = ...,
dtype: _ExtensionDtype | None = ...,
edge_key: str | int | None = ...,
) -> DataFrame: ...
) -> _DataFrame: ...
def from_pandas_edgelist(
df: DataFrame,
df: _DataFrame,
source: str | int = ...,
target: str | int = ...,
edge_attr: str | int | Iterable[str | int] | Literal[True] | None = ...,
Expand Down

0 comments on commit 5f386d4

Please sign in to comment.