Skip to content

Commit 07a59e9

Browse files
authored
networkx: All return types from python-type-stubs (#14256)
1 parent 0ad1d96 commit 07a59e9

File tree

116 files changed

+407
-243
lines changed

Some content is hidden

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

116 files changed

+407
-243
lines changed

stubs/networkx/networkx/algorithms/approximation/clique.pyi

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
1+
from _typeshed import Incomplete
2+
13
from networkx.classes.graph import Graph, _Node
24
from networkx.utils.backends import _dispatchable
35

46
__all__ = ["clique_removal", "max_clique", "large_clique_size", "maximum_independent_set"]
57

68
@_dispatchable
7-
def maximum_independent_set(G: Graph[_Node]): ...
9+
def maximum_independent_set(G: Graph[_Node]) -> set[Incomplete]: ...
810
@_dispatchable
9-
def max_clique(G: Graph[_Node]): ...
11+
def max_clique(G: Graph[_Node]) -> set[Incomplete]: ...
1012
@_dispatchable
1113
def clique_removal(G: Graph[_Node]): ...
1214
@_dispatchable

stubs/networkx/networkx/algorithms/approximation/clustering_coefficient.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ from numpy.random import RandomState
55
__all__ = ["average_clustering"]
66

77
@_dispatchable
8-
def average_clustering(G: Graph[_Node], trials: int = 1000, seed: int | RandomState | None = None): ...
8+
def average_clustering(G: Graph[_Node], trials: int = 1000, seed: int | RandomState | None = None) -> float: ...

stubs/networkx/networkx/algorithms/approximation/connectivity.pyi

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,6 @@ def local_node_connectivity(G: Graph[_Node], source: _Node, target: _Node, cutof
1111
@_dispatchable
1212
def node_connectivity(G: Graph[_Node], s: _Node | None = None, t: _Node | None = None): ...
1313
@_dispatchable
14-
def all_pairs_node_connectivity(G: Graph[_Node], nbunch: Iterable[Incomplete] | None = None, cutoff: int | None = None): ...
14+
def all_pairs_node_connectivity(
15+
G: Graph[_Node], nbunch: Iterable[Incomplete] | None = None, cutoff: int | None = None
16+
) -> dict[Incomplete, dict[Incomplete, Incomplete]]: ...
Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1+
from _typeshed import Incomplete
2+
13
from networkx.classes.graph import Graph, _Node
24
from networkx.utils.backends import _dispatchable
35

46
__all__ = ["min_weighted_dominating_set", "min_edge_dominating_set"]
57

68
@_dispatchable
7-
def min_weighted_dominating_set(G: Graph[_Node], weight: str | None = None): ...
9+
def min_weighted_dominating_set(G: Graph[_Node], weight: str | None = None) -> set[Incomplete]: ...
810
@_dispatchable
9-
def min_edge_dominating_set(G: Graph[_Node]): ...
11+
def min_edge_dominating_set(G: Graph[_Node]) -> set[Incomplete]: ...
Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
1+
from _typeshed import Incomplete
2+
from collections import defaultdict
3+
14
from networkx.classes.graph import Graph, _Node
25
from networkx.utils.backends import _dispatchable
36

47
__all__ = ["k_components"]
58

69
@_dispatchable
7-
def k_components(G: Graph[_Node], min_density: float = 0.95): ...
10+
def k_components(G: Graph[_Node], min_density: float = 0.95) -> defaultdict[Incomplete, list[Incomplete]]: ...
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1+
from _typeshed import Incomplete
2+
13
from networkx.classes.graph import Graph, _Node
24
from networkx.utils.backends import _dispatchable
35

46
__all__ = ["min_maximal_matching"]
57

68
@_dispatchable
7-
def min_maximal_matching(G: Graph[_Node]): ...
9+
def min_maximal_matching(G: Graph[_Node]) -> set[Incomplete]: ...

stubs/networkx/networkx/algorithms/approximation/traveling_salesman.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ _SupportsLenAndGetItemT = TypeVar("_SupportsLenAndGetItemT", bound=SupportsLenAn
2121
def swap_two_nodes(soln: _SupportsLenAndGetItemT, seed) -> _SupportsLenAndGetItemT: ...
2222
def move_one_node(soln: _SupportsLenAndGetItemT, seed) -> _SupportsLenAndGetItemT: ...
2323
@_dispatchable
24-
def christofides(G: Graph[_Node], weight: str | None = "weight", tree: Graph[_Node] | None = None): ...
24+
def christofides(G: Graph[_Node], weight: str | None = "weight", tree: Graph[_Node] | None = None) -> list[Incomplete]: ...
2525
@_dispatchable
2626
def traveling_salesman_problem(
2727
G: Graph[_Node],
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1+
from _typeshed import Incomplete
2+
13
from networkx.classes.graph import Graph, _Node
24
from networkx.utils.backends import _dispatchable
35

46
__all__ = ["min_weighted_vertex_cover"]
57

68
@_dispatchable
7-
def min_weighted_vertex_cover(G: Graph[_Node], weight: str | None = None): ...
9+
def min_weighted_vertex_cover(G: Graph[_Node], weight: str | None = None) -> set[Incomplete]: ...

stubs/networkx/networkx/algorithms/assortativity/connectivity.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@ __all__ = ["average_degree_connectivity"]
99
@_dispatchable
1010
def average_degree_connectivity(
1111
G: Graph[_Node], source="in+out", target="in+out", nodes: Iterable[Incomplete] | None = None, weight: str | None = None
12-
): ...
12+
) -> dict[Incomplete, int | float]: ...

stubs/networkx/networkx/algorithms/assortativity/correlation.pyi

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@ __all__ = [
1414
@_dispatchable
1515
def degree_assortativity_coefficient(
1616
G: Graph[_Node], x: str = "out", y: str = "in", weight: str | None = None, nodes: Iterable[Incomplete] | None = None
17-
): ...
17+
) -> float: ...
1818
@_dispatchable
1919
def degree_pearson_correlation_coefficient(
2020
G: Graph[_Node], x: str = "out", y: str = "in", weight: str | None = None, nodes: Iterable[Incomplete] | None = None
21-
): ...
21+
) -> float: ...
2222
@_dispatchable
23-
def attribute_assortativity_coefficient(G: Graph[_Node], attribute: str, nodes: Iterable[Incomplete] | None = None): ...
23+
def attribute_assortativity_coefficient(G: Graph[_Node], attribute: str, nodes: Iterable[Incomplete] | None = None) -> float: ...
2424
@_dispatchable
25-
def numeric_assortativity_coefficient(G: Graph[_Node], attribute: str, nodes: Iterable[Incomplete] | None = None): ...
25+
def numeric_assortativity_coefficient(G: Graph[_Node], attribute: str, nodes: Iterable[Incomplete] | None = None) -> float: ...

0 commit comments

Comments
 (0)