Update networkx stubs for 3.4.2 (#13001)

This commit is contained in:
Danny Yang
2024-11-13 23:03:01 -05:00
committed by GitHub
parent 8f21da5bee
commit 1be2c08869
10 changed files with 42 additions and 48 deletions

View File

@@ -1,4 +1,4 @@
version = "3.3"
version = "3.4.2"
upstream_repository = "https://github.com/networkx/networkx"
# requires a version of numpy with a `py.typed` file
requires = ["numpy>=1.20"]

View File

@@ -9,8 +9,6 @@ def strongly_connected_components(G: Graph[_Node]) -> Generator[set[_Node], None
@_dispatchable
def kosaraju_strongly_connected_components(G: Graph[_Node], source: _Node | None = None) -> Generator[set[_Node], None, None]: ...
@_dispatchable
def strongly_connected_components_recursive(G: Graph[_Node]) -> Generator[set[_Node], None, None]: ...
@_dispatchable
def number_strongly_connected_components(G: Graph[Hashable]) -> int: ...
@_dispatchable
def is_strongly_connected(G: Graph[Hashable]) -> bool: ...

View File

@@ -2,8 +2,6 @@ from _typeshed import Incomplete
from collections.abc import Iterator
from dataclasses import dataclass
from networkx.classes.graph import _Node
from networkx.classes.multidigraph import MultiDiGraph
from networkx.utils.backends import _dispatchable
__all__ = [
@@ -14,41 +12,12 @@ __all__ = [
"maximum_spanning_arborescence",
"minimum_spanning_arborescence",
"ArborescenceIterator",
"Edmonds",
]
@_dispatchable
def branching_weight(G, attr: str = "weight", default: float = 1): ...
@_dispatchable
def greedy_branching(G, attr: str = "weight", default: float = 1, kind: str = "max", seed: Incomplete | None = None): ...
class MultiDiGraph_EdgeKey(MultiDiGraph[_Node]):
edge_index: Incomplete
def __init__(self, incoming_graph_data: Incomplete | None = None, **attr) -> None: ...
def remove_node(self, n) -> None: ...
def remove_nodes_from(self, nbunch) -> None: ...
def add_edge(self, u_for_edge, v_for_edge, key_for_edge, **attr) -> None: ... # type: ignore[override] # Graph.add_edge won't accept a `key_for_edge` keyword argument.
def add_edges_from(self, ebunch_to_add, **attr) -> None: ...
def remove_edge_with_key(self, key) -> None: ...
def remove_edges_from(self, ebunch) -> None: ...
class Edmonds:
G_original: Incomplete
store: bool
edges: Incomplete
template: Incomplete
def __init__(self, G, seed: Incomplete | None = None) -> None: ...
def find_optimum(
self,
attr: str = "weight",
default: float = 1,
kind: str = "max",
style: str = "branching",
preserve_attrs: bool = False,
partition: Incomplete | None = None,
seed: Incomplete | None = None,
): ...
@_dispatchable
def maximum_branching(
G, attr: str = "weight", default: float = 1, preserve_attrs: bool = False, partition: Incomplete | None = None

View File

@@ -3,4 +3,4 @@ from _typeshed import Incomplete
from networkx.utils.backends import _dispatchable
@_dispatchable
def join(rooted_trees, label_attribute: Incomplete | None = None): ...
def join_trees(rooted_trees, label_attribute: Incomplete | None = None): ...

View File

@@ -1,4 +1,5 @@
from _typeshed import Incomplete, Unused
from abc import ABC
from collections.abc import Iterable, Iterator, Mapping, Set as AbstractSet
from typing import Any, Generic, Literal, TypeVar, overload
from typing_extensions import Self
@@ -45,8 +46,9 @@ class MultiDegreeView(DiDegreeView[_Node]): ...
class DiMultiDegreeView(DiDegreeView[_Node]): ...
class InMultiDegreeView(DiDegreeView[_Node]): ...
class OutMultiDegreeView(DiDegreeView[_Node]): ...
class EdgeViewABC(ABC): ...
class OutEdgeDataView(Generic[_Node, _D]):
class OutEdgeDataView(EdgeViewABC, Generic[_Node, _D]):
def __init__(
self, viewer, nbunch: _NBunch[_Node] = None, data: bool = False, *, default: Incomplete | None = None
) -> None: ...

View File

@@ -1,5 +1,7 @@
from _typeshed import Incomplete
import numpy
def random_layout(G, center: Incomplete | None = None, dim: int = 2, seed: Incomplete | None = None): ...
def circular_layout(G, scale: float = 1, center: Incomplete | None = None, dim: int = 2): ...
def shell_layout(
@@ -54,6 +56,8 @@ def arf_layout(
etol: float = 1e-06,
dt: float = 0.001,
max_iter: int = 1000,
*,
seed: int | numpy.random.RandomState | None = None,
): ...
def rescale_layout(pos, scale: float = 1): ...
def rescale_layout_dict(pos, scale: float = 1): ...

View File

@@ -1,10 +1,6 @@
from _typeshed import Incomplete
from networkx.utils.backends import _dispatchable
@_dispatchable
def prefix_tree(paths): ...
@_dispatchable
def prefix_tree_recursive(paths): ...
@_dispatchable
def random_tree(n, seed: Incomplete | None = None, create_using: Incomplete | None = None): ...

View File

@@ -3,7 +3,15 @@ from _typeshed import Incomplete
from networkx.utils.backends import _dispatchable
def node_link_data(
G, *, source: str = "source", target: str = "target", name: str = "id", key: str = "key", link: str = "links"
G,
*,
source: str = "source",
target: str = "target",
name: str = "id",
key: str = "key",
edges: str | None = None,
nodes: str = "nodes",
link: str | None = None,
): ...
@_dispatchable
def node_link_graph(
@@ -16,5 +24,7 @@ def node_link_graph(
target: str = "target",
name: str = "id",
key: str = "key",
link: str = "links",
edges: str | None = None,
nodes: str = "nodes",
link: str | None = None,
): ...

View File

@@ -2,7 +2,7 @@ from _typeshed import Incomplete
from collections.abc import Generator
from typing import ClassVar
__all__ = ["forest_str", "generate_network_text", "write_network_text"]
__all__ = ["generate_network_text", "write_network_text"]
class _AsciiBaseGlyphs:
empty: ClassVar[str]
@@ -58,6 +58,3 @@ def write_network_text(
end: str = "\n",
vertical_chains=False,
) -> None: ...
def forest_str(
graph, with_labels: bool = True, sources: Incomplete | None = None, write: Incomplete | None = None, ascii_only: bool = False
): ...

View File

@@ -26,7 +26,25 @@ class NetworkXConfig(Config):
backend_priority: list[str]
backends: Config
cache_converted_graphs: bool
def __init__(self, *, backend_priority: list[str], backends: Config, cache_converted_graphs: bool) -> None: ...
def __new__(cls, *, backend_priority: list[str], backends: Config, cache_converted_graphs: bool) -> Self: ...
fallback_to_nx: bool
warnings_to_ignore: set[str]
def __init__(
self,
*,
backend_priority: list[str],
backends: Config,
cache_converted_graphs: bool,
fallback_to_nx: bool,
warnings_to_ignore: set[str],
) -> None: ...
def __new__(
cls,
*,
backend_priority: list[str],
backends: Config,
cache_converted_graphs: bool,
fallback_to_nx: bool,
warnings_to_ignore: set[str],
) -> Self: ...
config: NetworkXConfig