-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Bump networkx to 3.2.1 #11336
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Bump networkx to 3.2.1 #11336
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
ff1acec
[stubsabot] Bump networkx to 3.2.1
51664ba
Bump networkx to 3.2.1
Avasam 8064f5f
Merge branch 'main' of https://github.com/python/typeshed into Bump-n…
Avasam 65c275d
Add some tests
Avasam 51dcebb
Update tests
Avasam 8598451
Update stubtest message
Avasam fb561be
Merge branch 'main' into Bump-networkx-to-3.2.1
Avasam 86dcb6d
No empty bodies in tests
Avasam d97a4e4
clearer kwarg param name
Avasam 5f2e6fd
Update comments with links to relevant issues
Avasam File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# overloaded class-decorators are not properly supported in type-checkers: | ||
# - mypy: https://github.com/python/mypy/issues/16840 | ||
# - pyright: https://github.com/microsoft/pyright/issues/7167 | ||
networkx\.(algorithms\.)?(boundary\.)?edge_boundary | ||
networkx\.(algorithms\.)?(bridges\.)?local_bridges | ||
networkx\.(algorithms\.)?(clique\.)?node_clique_number | ||
networkx\.(algorithms\.)?(shortest_paths\.)?(generic\.)?shortest_path | ||
networkx\.(convert_matrix\.)?from_numpy_array | ||
networkx\.(convert_matrix\.)?from_pandas_adjacency | ||
networkx\.(convert_matrix\.)?from_pandas_edgelist | ||
networkx\.(generators\.)?(random_clustered\.)?random_clustered_graph | ||
networkx\.(relabel\.)?relabel_nodes | ||
|
||
# Stubtest doesn't understand aliases of class-decorated methods (possibly https://github.com/python/mypy/issues/6700 ) | ||
networkx\.(algorithms\.)?(centrality\.)?(current_flow_closeness\.)?information_centrality | ||
networkx\.(generators\.)?(random_graphs\.)?binomial_graph | ||
networkx\.(generators\.)?(random_graphs\.)?erdos_renyi_graph | ||
|
||
# Stubtest says: "runtime argument "backend" has a default value of type None, which is | ||
# incompatible with stub argument type builtins.str. This is often caused by overloads | ||
# failing to account for explicitly passing in the default value." | ||
# Which is true, but would require some way of concatenating `backend` to ParamSpec.kwargs | ||
networkx\.(utils\.backends\.)?_dispatch\.__call__ |
23 changes: 23 additions & 0 deletions
23
stubs/networkx/@tests/test_cases/check_dispatch_decorator.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
from typing_extensions import assert_type | ||
|
||
from networkx.utils.backends import _dispatch | ||
|
||
|
||
@_dispatch | ||
def some_method(int_p: int, str_p: str) -> float: | ||
return 0.0 | ||
|
||
|
||
# Wrong param / order | ||
some_method("", 0) # type: ignore | ||
# backend is kw-only | ||
some_method(0, "", None) # type: ignore | ||
# No backend means no **backend_kwargs allowed | ||
some_method(0, "", backend_specific_kwarg="") # type: ignore | ||
some_method(0, "", backend=None, backend_specific_kwarg="") # type: ignore | ||
|
||
# Correct usage | ||
assert_type(some_method(0, ""), float) | ||
# type system doesn't allow this yet (see comment in networkx/utils/backends.pyi) | ||
# assert_type(some_method(0, "", backend=None), float) | ||
assert_type(some_method(0, "", backend="custom backend", backend_specific_kwarg=""), float) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,9 +6,11 @@ from networkx.convert_matrix import * | |
from networkx.drawing import * | ||
from networkx.exception import * | ||
from networkx.generators import * | ||
from networkx.lazy_imports import _lazy_import as _lazy_import | ||
from networkx.linalg import * | ||
from networkx.readwrite import * | ||
from networkx.relabel import * | ||
from networkx.utils.backends import _dispatch as _dispatch | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. New re-exports (but they're also private, could be omitted) |
||
|
||
from . import ( | ||
algorithms as algorithms, | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,10 @@ | ||
from networkx.utils.backends import _dispatch | ||
|
||
@_dispatch | ||
def maximum_independent_set(G): ... | ||
@_dispatch | ||
def max_clique(G): ... | ||
@_dispatch | ||
def clique_removal(G): ... | ||
@_dispatch | ||
def large_clique_size(G): ... |
3 changes: 3 additions & 0 deletions
3
stubs/networkx/networkx/algorithms/approximation/clustering_coefficient.pyi
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
from _typeshed import Incomplete | ||
|
||
from networkx.utils.backends import _dispatch | ||
|
||
@_dispatch | ||
def average_clustering(G, trials: int = 1000, seed: Incomplete | None = None): ... |
5 changes: 5 additions & 0 deletions
5
stubs/networkx/networkx/algorithms/approximation/connectivity.pyi
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,10 @@ | ||
from _typeshed import Incomplete | ||
|
||
from networkx.utils.backends import _dispatch | ||
|
||
@_dispatch | ||
def local_node_connectivity(G, source, target, cutoff: Incomplete | None = None): ... | ||
@_dispatch | ||
def node_connectivity(G, s: Incomplete | None = None, t: Incomplete | None = None): ... | ||
@_dispatch | ||
def all_pairs_node_connectivity(G, nbunch: Incomplete | None = None, cutoff: Incomplete | None = None): ... |
3 changes: 3 additions & 0 deletions
3
stubs/networkx/networkx/algorithms/approximation/distance_measures.pyi
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
from _typeshed import Incomplete | ||
|
||
from networkx.utils.backends import _dispatch | ||
|
||
@_dispatch | ||
def diameter(G, seed: Incomplete | None = None): ... |
4 changes: 4 additions & 0 deletions
4
stubs/networkx/networkx/algorithms/approximation/dominating_set.pyi
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,8 @@ | ||
from _typeshed import Incomplete | ||
|
||
from networkx.utils.backends import _dispatch | ||
|
||
@_dispatch | ||
def min_weighted_dominating_set(G, weight: Incomplete | None = None): ... | ||
@_dispatch | ||
def min_edge_dominating_set(G): ... |
3 changes: 3 additions & 0 deletions
3
stubs/networkx/networkx/algorithms/approximation/kcomponents.pyi
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,4 @@ | ||
from networkx.utils.backends import _dispatch | ||
|
||
@_dispatch | ||
def k_components(G, min_density: float = 0.95): ... |
3 changes: 3 additions & 0 deletions
3
stubs/networkx/networkx/algorithms/approximation/matching.pyi
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,4 @@ | ||
from networkx.utils.backends import _dispatch | ||
|
||
@_dispatch | ||
def min_maximal_matching(G): ... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,8 @@ | ||
from _typeshed import Incomplete | ||
|
||
from networkx.utils.backends import _dispatch | ||
|
||
@_dispatch | ||
def randomized_partitioning(G, seed: Incomplete | None = None, p: float = 0.5, weight: Incomplete | None = None): ... | ||
@_dispatch | ||
def one_exchange(G, initial_cut: Incomplete | None = None, seed: Incomplete | None = None, weight: Incomplete | None = None): ... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,4 @@ | ||
from networkx.utils.backends import _dispatch | ||
|
||
@_dispatch | ||
def ramsey_R2(G): ... |
4 changes: 4 additions & 0 deletions
4
stubs/networkx/networkx/algorithms/approximation/steinertree.pyi
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,8 @@ | ||
from _typeshed import Incomplete | ||
|
||
from networkx.utils.backends import _dispatch | ||
|
||
@_dispatch | ||
def metric_closure(G, weight: str = "weight"): ... | ||
@_dispatch | ||
def steiner_tree(G, terminal_nodes, weight: str = "weight", method: Incomplete | None = None): ... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
stubs/networkx/networkx/algorithms/approximation/treewidth.pyi
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
stubs/networkx/networkx/algorithms/approximation/vertex_cover.pyi
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
from _typeshed import Incomplete | ||
|
||
from networkx.utils.backends import _dispatch | ||
|
||
@_dispatch | ||
def min_weighted_vertex_cover(G, weight: Incomplete | None = None): ... |
3 changes: 3 additions & 0 deletions
3
stubs/networkx/networkx/algorithms/assortativity/connectivity.pyi
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,8 @@ | ||
from _typeshed import Incomplete | ||
|
||
from networkx.utils.backends import _dispatch | ||
|
||
@_dispatch | ||
def average_degree_connectivity( | ||
G, source: str = "in+out", target: str = "in+out", nodes: Incomplete | None = None, weight: Incomplete | None = None | ||
): ... |
6 changes: 6 additions & 0 deletions
6
stubs/networkx/networkx/algorithms/assortativity/correlation.pyi
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,16 @@ | ||
from _typeshed import Incomplete | ||
|
||
from networkx.utils.backends import _dispatch | ||
|
||
@_dispatch | ||
def degree_assortativity_coefficient( | ||
G, x: str = "out", y: str = "in", weight: Incomplete | None = None, nodes: Incomplete | None = None | ||
): ... | ||
@_dispatch | ||
def degree_pearson_correlation_coefficient( | ||
G, x: str = "out", y: str = "in", weight: Incomplete | None = None, nodes: Incomplete | None = None | ||
): ... | ||
@_dispatch | ||
def attribute_assortativity_coefficient(G, attribute, nodes: Incomplete | None = None): ... | ||
@_dispatch | ||
def numeric_assortativity_coefficient(G, attribute, nodes: Incomplete | None = None): ... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
stubs/networkx/networkx/algorithms/assortativity/neighbor_degree.pyi
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,8 @@ | ||
from _typeshed import Incomplete | ||
|
||
from networkx.utils.backends import _dispatch | ||
|
||
@_dispatch | ||
def average_neighbor_degree( | ||
G, source: str = "out", target: str = "out", nodes: Incomplete | None = None, weight: Incomplete | None = None | ||
): ... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,11 @@ | ||
from _typeshed import Incomplete | ||
from collections.abc import Generator | ||
|
||
from networkx.utils.backends import _dispatch | ||
|
||
@_dispatch | ||
def node_attribute_xy(G, attribute, nodes: Incomplete | None = None) -> Generator[Incomplete, None, None]: ... | ||
@_dispatch | ||
def node_degree_xy( | ||
G, x: str = "out", y: str = "in", weight: Incomplete | None = None, nodes: Incomplete | None = None | ||
) -> Generator[Incomplete, None, None]: ... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,6 @@ | ||
from networkx.utils.backends import _dispatch | ||
|
||
@_dispatch | ||
def find_asteroidal_triple(G): ... | ||
@_dispatch | ||
def is_at_free(G): ... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,16 @@ | ||
from _typeshed import Incomplete | ||
|
||
from networkx.utils.backends import _dispatch | ||
|
||
@_dispatch | ||
def color(G): ... | ||
@_dispatch | ||
def is_bipartite(G): ... | ||
@_dispatch | ||
def is_bipartite_node_set(G, nodes): ... | ||
@_dispatch | ||
def sets(G, top_nodes: Incomplete | None = None): ... | ||
@_dispatch | ||
def density(B, nodes): ... | ||
@_dispatch | ||
def degrees(B, nodes, weight: Incomplete | None = None): ... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,8 @@ | ||
from networkx.utils.backends import _dispatch | ||
|
||
@_dispatch | ||
def degree_centrality(G, nodes): ... | ||
@_dispatch | ||
def betweenness_centrality(G, nodes): ... | ||
@_dispatch | ||
def closeness_centrality(G, nodes, normalized: bool = True): ... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,13 @@ | ||
from _typeshed import Incomplete | ||
|
||
from networkx.utils.backends import _dispatch | ||
|
||
@_dispatch | ||
def latapy_clustering(G, nodes: Incomplete | None = None, mode: str = "dot"): ... | ||
|
||
clustering = latapy_clustering | ||
|
||
@_dispatch | ||
def average_clustering(G, nodes: Incomplete | None = None, mode: str = "dot"): ... | ||
@_dispatch | ||
def robins_alexander_clustering(G): ... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
from _typeshed import Incomplete | ||
|
||
from networkx.utils.backends import _dispatch | ||
|
||
@_dispatch | ||
def min_edge_cover(G, matching_algorithm: Incomplete | None = None): ... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
stubs/networkx/networkx/algorithms/bipartite/generators.pyi
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,20 @@ | ||
from _typeshed import Incomplete | ||
|
||
from networkx.utils.backends import _dispatch | ||
|
||
@_dispatch | ||
def complete_bipartite_graph(n1, n2, create_using: Incomplete | None = None): ... | ||
@_dispatch | ||
def configuration_model(aseq, bseq, create_using: Incomplete | None = None, seed: Incomplete | None = None): ... | ||
@_dispatch | ||
def havel_hakimi_graph(aseq, bseq, create_using: Incomplete | None = None): ... | ||
@_dispatch | ||
def reverse_havel_hakimi_graph(aseq, bseq, create_using: Incomplete | None = None): ... | ||
@_dispatch | ||
def alternating_havel_hakimi_graph(aseq, bseq, create_using: Incomplete | None = None): ... | ||
@_dispatch | ||
def preferential_attachment_graph(aseq, p, create_using: Incomplete | None = None, seed: Incomplete | None = None): ... | ||
@_dispatch | ||
def random_graph(n, m, p, seed: Incomplete | None = None, directed: bool = False): ... | ||
@_dispatch | ||
def gnmk_random_graph(n, m, k, seed: Incomplete | None = None, directed: bool = False): ... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,15 @@ | ||
from _typeshed import Incomplete | ||
|
||
from networkx.utils.backends import _dispatch | ||
|
||
@_dispatch | ||
def hopcroft_karp_matching(G, top_nodes: Incomplete | None = None): ... | ||
@_dispatch | ||
def eppstein_matching(G, top_nodes: Incomplete | None = None): ... | ||
@_dispatch | ||
def to_vertex_cover(G, matching, top_nodes: Incomplete | None = None): ... | ||
|
||
maximum_matching = hopcroft_karp_matching | ||
|
||
@_dispatch | ||
def minimum_weight_full_matching(G, top_nodes: Incomplete | None = None, weight: str = "weight"): ... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This would require some way of concatenating
backend
to_P.kwargs
. Which to my understanding, isn't currently possible and is a rejected idea in https://peps.python.org/pep-0612/#concatenating-keyword-parameters