Skip to content

Commit faf9d77

Browse files
authored
Bump networkx to 3.2.1 (#11336)
1 parent 9877ed8 commit faf9d77

File tree

232 files changed

+1249
-73
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

232 files changed

+1249
-73
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# overloaded class-decorators are not properly supported in type-checkers:
2+
# - mypy: https://github.com/python/mypy/issues/16840
3+
# - pyright: https://github.com/microsoft/pyright/issues/7167
4+
networkx\.(algorithms\.)?(boundary\.)?edge_boundary
5+
networkx\.(algorithms\.)?(bridges\.)?local_bridges
6+
networkx\.(algorithms\.)?(clique\.)?node_clique_number
7+
networkx\.(algorithms\.)?(shortest_paths\.)?(generic\.)?shortest_path
8+
networkx\.(convert_matrix\.)?from_numpy_array
9+
networkx\.(convert_matrix\.)?from_pandas_adjacency
10+
networkx\.(convert_matrix\.)?from_pandas_edgelist
11+
networkx\.(generators\.)?(random_clustered\.)?random_clustered_graph
12+
networkx\.(relabel\.)?relabel_nodes
13+
14+
# Stubtest doesn't understand aliases of class-decorated methods (possibly https://github.com/python/mypy/issues/6700 )
15+
networkx\.(algorithms\.)?(centrality\.)?(current_flow_closeness\.)?information_centrality
16+
networkx\.(generators\.)?(random_graphs\.)?binomial_graph
17+
networkx\.(generators\.)?(random_graphs\.)?erdos_renyi_graph
18+
19+
# Stubtest says: "runtime argument "backend" has a default value of type None, which is
20+
# incompatible with stub argument type builtins.str. This is often caused by overloads
21+
# failing to account for explicitly passing in the default value."
22+
# Which is true, but would require some way of concatenating `backend` to ParamSpec.kwargs
23+
networkx\.(utils\.backends\.)?_dispatch\.__call__
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
from typing_extensions import assert_type
2+
3+
from networkx.utils.backends import _dispatch
4+
5+
6+
@_dispatch
7+
def some_method(int_p: int, str_p: str) -> float:
8+
return 0.0
9+
10+
11+
# Wrong param / order
12+
some_method("", 0) # type: ignore
13+
# backend is kw-only
14+
some_method(0, "", None) # type: ignore
15+
# No backend means no **backend_kwargs allowed
16+
some_method(0, "", backend_specific_kwarg="") # type: ignore
17+
some_method(0, "", backend=None, backend_specific_kwarg="") # type: ignore
18+
19+
# Correct usage
20+
assert_type(some_method(0, ""), float)
21+
# type system doesn't allow this yet (see comment in networkx/utils/backends.pyi)
22+
# assert_type(some_method(0, "", backend=None), float)
23+
assert_type(some_method(0, "", backend="custom backend", backend_specific_kwarg=""), float)

stubs/networkx/METADATA.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
version = "3.1"
1+
version = "3.2.1"
22
upstream_repository = "https://github.com/networkx/networkx"
33
requires = ["numpy"]
44
partial_stub = true

stubs/networkx/networkx/__init__.pyi

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,11 @@ from networkx.convert_matrix import *
66
from networkx.drawing import *
77
from networkx.exception import *
88
from networkx.generators import *
9+
from networkx.lazy_imports import _lazy_import as _lazy_import
910
from networkx.linalg import *
1011
from networkx.readwrite import *
1112
from networkx.relabel import *
13+
from networkx.utils.backends import _dispatch as _dispatch
1214

1315
from . import (
1416
algorithms as algorithms,
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
1+
from networkx.utils.backends import _dispatch
2+
3+
@_dispatch
14
def maximum_independent_set(G): ...
5+
@_dispatch
26
def max_clique(G): ...
7+
@_dispatch
38
def clique_removal(G): ...
9+
@_dispatch
410
def large_clique_size(G): ...
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
from _typeshed import Incomplete
22

3+
from networkx.utils.backends import _dispatch
4+
5+
@_dispatch
36
def average_clustering(G, trials: int = 1000, seed: Incomplete | None = None): ...
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
from _typeshed import Incomplete
22

3+
from networkx.utils.backends import _dispatch
4+
5+
@_dispatch
36
def local_node_connectivity(G, source, target, cutoff: Incomplete | None = None): ...
7+
@_dispatch
48
def node_connectivity(G, s: Incomplete | None = None, t: Incomplete | None = None): ...
9+
@_dispatch
510
def all_pairs_node_connectivity(G, nbunch: Incomplete | None = None, cutoff: Incomplete | None = None): ...
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
from _typeshed import Incomplete
22

3+
from networkx.utils.backends import _dispatch
4+
5+
@_dispatch
36
def diameter(G, seed: Incomplete | None = None): ...
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
from _typeshed import Incomplete
22

3+
from networkx.utils.backends import _dispatch
4+
5+
@_dispatch
36
def min_weighted_dominating_set(G, weight: Incomplete | None = None): ...
7+
@_dispatch
48
def min_edge_dominating_set(G): ...
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,4 @@
1+
from networkx.utils.backends import _dispatch
2+
3+
@_dispatch
14
def k_components(G, min_density: float = 0.95): ...

0 commit comments

Comments
 (0)