Skip to content

Commit 5a81bf5

Browse files
authored
networkx: type is_* and has_* functions (#14054)
1 parent b7d5b1d commit 5a81bf5

31 files changed

+96
-57
lines changed

stubs/networkx/networkx/algorithms/asteroidal.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ __all__ = ["is_at_free", "find_asteroidal_triple"]
66
@_dispatchable
77
def find_asteroidal_triple(G: Graph[_Node]): ...
88
@_dispatchable
9-
def is_at_free(G: Graph[_Node]): ...
9+
def is_at_free(G: Graph[_Node]) -> bool: ...

stubs/networkx/networkx/algorithms/bipartite/basic.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ __all__ = ["is_bipartite", "is_bipartite_node_set", "color", "sets", "density",
99
@_dispatchable
1010
def color(G: Graph[_Node]): ...
1111
@_dispatchable
12-
def is_bipartite(G: Graph[_Node]): ...
12+
def is_bipartite(G: Graph[_Node]) -> bool: ...
1313
@_dispatchable
14-
def is_bipartite_node_set(G: Graph[_Node], nodes): ...
14+
def is_bipartite_node_set(G: Graph[_Node], nodes: Iterable[Incomplete]) -> bool: ...
1515
@_dispatchable
1616
def sets(G: Graph[_Node], top_nodes: Iterable[Incomplete] | None = None): ...
1717
@_dispatchable
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,15 @@
1+
from _typeshed import Incomplete, SupportsGetItem
2+
from collections.abc import Mapping
3+
from typing import SupportsIndex
4+
15
from networkx.classes.graph import Graph, _Node
26
from networkx.utils.backends import _dispatchable
37

48
__all__ = ["equitable_color"]
59

10+
@_dispatchable
11+
def is_coloring(G: Graph[_Node], coloring: SupportsGetItem[Incomplete, Incomplete]) -> bool: ...
12+
@_dispatchable
13+
def is_equitable(G: Graph[_Node], coloring: Mapping[Incomplete, Incomplete], num_colors: SupportsIndex | None = None) -> bool: ...
614
@_dispatchable
715
def equitable_color(G: Graph[_Node], num_colors): ...
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1+
from collections.abc import Container, Iterable
2+
13
from networkx.classes.graph import Graph, _Node
24
from networkx.utils.backends import _dispatchable
35

46
__all__ = ["is_partition"]
57

68
@_dispatchable
7-
def is_partition(G: Graph[_Node], communities): ...
9+
def is_partition(G: Graph[_Node], communities: Iterable[Container[_Node]]) -> bool: ...

stubs/networkx/networkx/algorithms/components/attracting.pyi

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
from _typeshed import Incomplete
22
from collections.abc import Generator
33

4+
from networkx.classes.digraph import DiGraph
5+
from networkx.classes.graph import _Node
6+
from networkx.classes.multidigraph import MultiDiGraph
47
from networkx.utils.backends import _dispatchable
58

69
__all__ = ["number_attracting_components", "attracting_components", "is_attracting_component"]
@@ -10,4 +13,4 @@ def attracting_components(G) -> Generator[Incomplete, None, None]: ...
1013
@_dispatchable
1114
def number_attracting_components(G): ...
1215
@_dispatchable
13-
def is_attracting_component(G): ...
16+
def is_attracting_component(G: DiGraph[_Node] | MultiDiGraph[_Node]) -> bool: ...

stubs/networkx/networkx/algorithms/components/biconnected.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ from networkx.utils.backends import _dispatchable
77
__all__ = ["biconnected_components", "biconnected_component_edges", "is_biconnected", "articulation_points"]
88

99
@_dispatchable
10-
def is_biconnected(G: Graph[_Node]): ...
10+
def is_biconnected(G: Graph[_Node]) -> bool: ...
1111
@_dispatchable
1212
def biconnected_component_edges(G: Graph[_Node]) -> Generator[Incomplete, Incomplete, None]: ...
1313
@_dispatchable

stubs/networkx/networkx/algorithms/components/connected.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@ def connected_components(G: Graph[_Node]) -> Generator[Incomplete, None, None]:
1111
@_dispatchable
1212
def number_connected_components(G: Graph[_Node]): ...
1313
@_dispatchable
14-
def is_connected(G: Graph[_Node]): ...
14+
def is_connected(G: Graph[_Node]) -> bool: ...
1515
@_dispatchable
1616
def node_connected_component(G: Graph[_Node], n: _Node): ...

stubs/networkx/networkx/algorithms/components/semiconnected.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ from networkx.utils.backends import _dispatchable
44
__all__ = ["is_semiconnected"]
55

66
@_dispatchable
7-
def is_semiconnected(G: Graph[_Node]): ...
7+
def is_semiconnected(G: Graph[_Node]) -> bool: ...

stubs/networkx/networkx/algorithms/connectivity/edge_augmentation.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ from networkx.utils.backends import _dispatchable
77
__all__ = ["k_edge_augmentation", "is_k_edge_connected", "is_locally_k_edge_connected"]
88

99
@_dispatchable
10-
def is_k_edge_connected(G: Graph[_Node], k: int): ...
10+
def is_k_edge_connected(G: Graph[_Node], k: int) -> bool: ...
1111
@_dispatchable
12-
def is_locally_k_edge_connected(G: Graph[_Node], s: _Node, t: _Node, k: int): ...
12+
def is_locally_k_edge_connected(G: Graph[_Node], s: _Node, t: _Node, k: int) -> bool: ...
1313
@_dispatchable
1414
def k_edge_augmentation(
1515
G: Graph[_Node],
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from _typeshed import Incomplete
2-
from collections.abc import Callable
2+
from collections.abc import Callable, Iterable
33

44
from networkx.classes.graph import Graph, _Node
55
from networkx.utils.backends import _dispatchable
@@ -9,4 +9,4 @@ __all__ = ["min_edge_cover", "is_edge_cover"]
99
@_dispatchable
1010
def min_edge_cover(G: Graph[_Node], matching_algorithm: Callable[..., Incomplete] | None = None): ...
1111
@_dispatchable
12-
def is_edge_cover(G: Graph[_Node], cover: set[Incomplete]): ...
12+
def is_edge_cover(G: Graph[_Node], cover: Iterable[Iterable[Incomplete]]) -> bool: ...

0 commit comments

Comments
 (0)