Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions stubs/networkx/@tests/stubtest_allowlist.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,25 @@ 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 )
# Stubtest doesn't understand aliases of class-decorated functions (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
networkx\.(algorithms\.(minors\.(contraction\.)?)?)?identified_nodes
networkx\.algorithms\.isomorphism\.isomorph\.faster_graph_could_be_isomorphic
networkx\.algorithms\.isomorphism\.isomorph\.fast_graph_could_be_isomorphic
networkx\.algorithms\.isomorphism\.isomorph\.graph_could_be_isomorphic
networkx\.algorithms\.flow\.maxflow\.default_flow_func
networkx\.algorithms\.[a-z_\.]+\.default_flow_func
networkx\.(algorithms\.(centrality\.(load\.)?)?)?load_centrality
networkx\.algorithms\.bipartite\.(matching\.)?maximum_matching
networkx\.algorithms\.bipartite\.(cluster\.)?clustering

# 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__
networkx\.(utils\.)?(backends\.)?_dispatchable\.__call__

# TODO: stubtest does not like @cached_property https://github.com/python/mypy/issues/17625
# "is inconsistent, cannot reconcile @property on stub with runtime object"
Expand Down
4 changes: 2 additions & 2 deletions stubs/networkx/@tests/test_cases/check_dispatch_decorator.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
from typing_extensions import assert_type

from networkx.utils.backends import _dispatch
from networkx.utils.backends import _dispatchable


@_dispatch
@_dispatchable
def some_method(int_p: int, str_p: str) -> float:
return 0.0

Expand Down
2 changes: 1 addition & 1 deletion stubs/networkx/METADATA.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version = "3.2.1"
version = "3.3"
upstream_repository = "https://github.com/networkx/networkx"
# requires a version of numpy with a `py.typed` file
# see https://github.com/python/typeshed/issues/12551
Expand Down
2 changes: 1 addition & 1 deletion stubs/networkx/networkx/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ 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
from networkx.utils import _clear_cache as _clear_cache, _dispatchable as _dispatchable, config as config

from . import (
algorithms as algorithms,
Expand Down
10 changes: 5 additions & 5 deletions stubs/networkx/networkx/algorithms/approximation/clique.pyi
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
from networkx.utils.backends import _dispatch
from networkx.utils.backends import _dispatchable

@_dispatch
@_dispatchable
def maximum_independent_set(G): ...
@_dispatch
@_dispatchable
def max_clique(G): ...
@_dispatch
@_dispatchable
def clique_removal(G): ...
@_dispatch
@_dispatchable
def large_clique_size(G): ...
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from _typeshed import Incomplete

from networkx.utils.backends import _dispatch
from networkx.utils.backends import _dispatchable

@_dispatch
@_dispatchable
def average_clustering(G, trials: int = 1000, seed: Incomplete | None = None): ...
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
from _typeshed import Incomplete

from networkx.utils.backends import _dispatch
from networkx.utils.backends import _dispatchable

@_dispatch
@_dispatchable
def local_node_connectivity(G, source, target, cutoff: Incomplete | None = None): ...
@_dispatch
@_dispatchable
def node_connectivity(G, s: Incomplete | None = None, t: Incomplete | None = None): ...
@_dispatch
@_dispatchable
def all_pairs_node_connectivity(G, nbunch: Incomplete | None = None, cutoff: Incomplete | None = None): ...
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from _typeshed import Incomplete

from networkx.utils.backends import _dispatch
from networkx.utils.backends import _dispatchable

@_dispatch
@_dispatchable
def diameter(G, seed: Incomplete | None = None): ...
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from _typeshed import Incomplete

from networkx.utils.backends import _dispatch
from networkx.utils.backends import _dispatchable

@_dispatch
@_dispatchable
def min_weighted_dominating_set(G, weight: Incomplete | None = None): ...
@_dispatch
@_dispatchable
def min_edge_dominating_set(G): ...
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from networkx.utils.backends import _dispatch
from networkx.utils.backends import _dispatchable

@_dispatch
@_dispatchable
def k_components(G, min_density: float = 0.95): ...
4 changes: 2 additions & 2 deletions stubs/networkx/networkx/algorithms/approximation/matching.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from networkx.utils.backends import _dispatch
from networkx.utils.backends import _dispatchable

@_dispatch
@_dispatchable
def min_maximal_matching(G): ...
6 changes: 3 additions & 3 deletions stubs/networkx/networkx/algorithms/approximation/maxcut.pyi
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from _typeshed import Incomplete

from networkx.utils.backends import _dispatch
from networkx.utils.backends import _dispatchable

@_dispatch
@_dispatchable
def randomized_partitioning(G, seed: Incomplete | None = None, p: float = 0.5, weight: Incomplete | None = None): ...
@_dispatch
@_dispatchable
def one_exchange(G, initial_cut: Incomplete | None = None, seed: Incomplete | None = None, weight: Incomplete | None = None): ...
4 changes: 2 additions & 2 deletions stubs/networkx/networkx/algorithms/approximation/ramsey.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from networkx.utils.backends import _dispatch
from networkx.utils.backends import _dispatchable

@_dispatch
@_dispatchable
def ramsey_R2(G): ...
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from _typeshed import Incomplete

from networkx.utils.backends import _dispatch
from networkx.utils.backends import _dispatchable

@_dispatch
@_dispatchable
def metric_closure(G, weight: str = "weight"): ...
@_dispatch
@_dispatchable
def steiner_tree(G, terminal_nodes, weight: str = "weight", method: Incomplete | None = None): ...
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
from _typeshed import Incomplete

from networkx.utils.backends import _dispatch
from networkx.utils.backends import _dispatchable

@_dispatch
@_dispatchable
def christofides(G, weight: str = "weight", tree: Incomplete | None = None): ...
@_dispatch
@_dispatchable
def traveling_salesman_problem(
G, weight: str = "weight", nodes: Incomplete | None = None, cycle: bool = True, method: Incomplete | None = None
G, weight: str = "weight", nodes: Incomplete | None = None, cycle: bool = True, method: Incomplete | None = None, **kwargs
): ...
@_dispatch
@_dispatchable
def asadpour_atsp(G, weight: str = "weight", seed: Incomplete | None = None, source: Incomplete | None = None): ...
@_dispatch
@_dispatchable
def greedy_tsp(G, weight: str = "weight", source: Incomplete | None = None): ...
@_dispatch
@_dispatchable
def simulated_annealing_tsp(
G,
init_cycle,
Expand All @@ -26,7 +26,7 @@ def simulated_annealing_tsp(
alpha: float = 0.01,
seed: Incomplete | None = None,
): ...
@_dispatch
@_dispatchable
def threshold_accepting_tsp(
G,
init_cycle,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
from _typeshed import Incomplete

from networkx.utils.backends import _dispatch
from networkx.utils.backends import _dispatchable

__all__ = ["treewidth_min_degree", "treewidth_min_fill_in"]

@_dispatch
@_dispatchable
def treewidth_min_degree(G): ...
@_dispatch
@_dispatchable
def treewidth_min_fill_in(G): ...

class MinDegreeHeuristic:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from _typeshed import Incomplete

from networkx.utils.backends import _dispatch
from networkx.utils.backends import _dispatchable

@_dispatch
@_dispatchable
def min_weighted_vertex_cover(G, weight: Incomplete | None = None): ...
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from _typeshed import Incomplete

from networkx.utils.backends import _dispatch
from networkx.utils.backends import _dispatchable

@_dispatch
@_dispatchable
def average_degree_connectivity(
G, source: str = "in+out", target: str = "in+out", nodes: Incomplete | None = None, weight: Incomplete | None = None
): ...
10 changes: 5 additions & 5 deletions stubs/networkx/networkx/algorithms/assortativity/correlation.pyi
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
from _typeshed import Incomplete

from networkx.utils.backends import _dispatch
from networkx.utils.backends import _dispatchable

@_dispatch
@_dispatchable
def degree_assortativity_coefficient(
G, x: str = "out", y: str = "in", weight: Incomplete | None = None, nodes: Incomplete | None = None
): ...
@_dispatch
@_dispatchable
def degree_pearson_correlation_coefficient(
G, x: str = "out", y: str = "in", weight: Incomplete | None = None, nodes: Incomplete | None = None
): ...
@_dispatch
@_dispatchable
def attribute_assortativity_coefficient(G, attribute, nodes: Incomplete | None = None): ...
@_dispatch
@_dispatchable
def numeric_assortativity_coefficient(G, attribute, nodes: Incomplete | None = None): ...
12 changes: 6 additions & 6 deletions stubs/networkx/networkx/algorithms/assortativity/mixing.pyi
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
from _typeshed import Incomplete

from networkx.utils.backends import _dispatch
from networkx.utils.backends import _dispatchable

@_dispatch
@_dispatchable
def attribute_mixing_dict(G, attribute, nodes: Incomplete | None = None, normalized: bool = False): ...
@_dispatch
@_dispatchable
def attribute_mixing_matrix(
G, attribute, nodes: Incomplete | None = None, mapping: Incomplete | None = None, normalized: bool = True
): ...
@_dispatch
@_dispatchable
def degree_mixing_dict(
G, x: str = "out", y: str = "in", weight: Incomplete | None = None, nodes: Incomplete | None = None, normalized: bool = False
): ...
@_dispatch
@_dispatchable
def degree_mixing_matrix(
G,
x: str = "out",
Expand All @@ -22,5 +22,5 @@ def degree_mixing_matrix(
normalized: bool = True,
mapping: Incomplete | None = None,
): ...
@_dispatch
@_dispatchable
def mixing_dict(xy, normalized: bool = False): ...
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from _typeshed import Incomplete

from networkx.utils.backends import _dispatch
from networkx.utils.backends import _dispatchable

@_dispatch
@_dispatchable
def average_neighbor_degree(
G, source: str = "out", target: str = "out", nodes: Incomplete | None = None, weight: Incomplete | None = None
): ...
6 changes: 3 additions & 3 deletions stubs/networkx/networkx/algorithms/assortativity/pairs.pyi
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
from _typeshed import Incomplete
from collections.abc import Generator

from networkx.utils.backends import _dispatch
from networkx.utils.backends import _dispatchable

@_dispatch
@_dispatchable
def node_attribute_xy(G, attribute, nodes: Incomplete | None = None) -> Generator[Incomplete, None, None]: ...
@_dispatch
@_dispatchable
def node_degree_xy(
G, x: str = "out", y: str = "in", weight: Incomplete | None = None, nodes: Incomplete | None = None
) -> Generator[Incomplete, None, None]: ...
6 changes: 3 additions & 3 deletions stubs/networkx/networkx/algorithms/asteroidal.pyi
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from networkx.utils.backends import _dispatch
from networkx.utils.backends import _dispatchable

@_dispatch
@_dispatchable
def find_asteroidal_triple(G): ...
@_dispatch
@_dispatchable
def is_at_free(G): ...
14 changes: 7 additions & 7 deletions stubs/networkx/networkx/algorithms/bipartite/basic.pyi
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
from _typeshed import Incomplete

from networkx.utils.backends import _dispatch
from networkx.utils.backends import _dispatchable

@_dispatch
@_dispatchable
def color(G): ...
@_dispatch
@_dispatchable
def is_bipartite(G): ...
@_dispatch
@_dispatchable
def is_bipartite_node_set(G, nodes): ...
@_dispatch
@_dispatchable
def sets(G, top_nodes: Incomplete | None = None): ...
@_dispatch
@_dispatchable
def density(B, nodes): ...
@_dispatch
@_dispatchable
def degrees(B, nodes, weight: Incomplete | None = None): ...
8 changes: 4 additions & 4 deletions stubs/networkx/networkx/algorithms/bipartite/centrality.pyi
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from networkx.utils.backends import _dispatch
from networkx.utils.backends import _dispatchable

@_dispatch
@_dispatchable
def degree_centrality(G, nodes): ...
@_dispatch
@_dispatchable
def betweenness_centrality(G, nodes): ...
@_dispatch
@_dispatchable
def closeness_centrality(G, nodes, normalized: bool = True): ...
8 changes: 4 additions & 4 deletions stubs/networkx/networkx/algorithms/bipartite/cluster.pyi
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
from _typeshed import Incomplete

from networkx.utils.backends import _dispatch
from networkx.utils.backends import _dispatchable

@_dispatch
@_dispatchable
def latapy_clustering(G, nodes: Incomplete | None = None, mode: str = "dot"): ...

clustering = latapy_clustering

@_dispatch
@_dispatchable
def average_clustering(G, nodes: Incomplete | None = None, mode: str = "dot"): ...
@_dispatch
@_dispatchable
def robins_alexander_clustering(G): ...
4 changes: 2 additions & 2 deletions stubs/networkx/networkx/algorithms/bipartite/covering.pyi
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from _typeshed import Incomplete

from networkx.utils.backends import _dispatch
from networkx.utils.backends import _dispatchable

@_dispatch
@_dispatchable
def min_edge_cover(G, matching_algorithm: Incomplete | None = None): ...
Loading