diff --git a/stubs/networkx/networkx/algorithms/assortativity/mixing.pyi b/stubs/networkx/networkx/algorithms/assortativity/mixing.pyi index 84168115f9db..1650588a9d73 100644 --- a/stubs/networkx/networkx/algorithms/assortativity/mixing.pyi +++ b/stubs/networkx/networkx/algorithms/assortativity/mixing.pyi @@ -1,5 +1,5 @@ -from _typeshed import Incomplete, SupportsGetItem -from collections.abc import Iterable +from _typeshed import Incomplete +from collections.abc import Iterable, Mapping from networkx.classes.graph import Graph, _Node from networkx.utils.backends import _dispatchable @@ -15,7 +15,7 @@ def attribute_mixing_matrix( G: Graph[_Node], attribute: str, nodes: Iterable[Incomplete] | None = None, - mapping: SupportsGetItem[Incomplete, Incomplete] | None = None, + mapping: Mapping[Incomplete, Incomplete] | None = None, normalized: bool = True, ): ... @_dispatchable @@ -30,7 +30,7 @@ def degree_mixing_matrix( weight: str | None = None, nodes: Iterable[Incomplete] | None = None, normalized: bool = True, - mapping: SupportsGetItem[Incomplete, Incomplete] | None = None, + mapping: Mapping[Incomplete, Incomplete] | None = None, ): ... @_dispatchable def mixing_dict(xy, normalized: bool = False) -> dict[Incomplete, Incomplete]: ... diff --git a/stubs/networkx/networkx/algorithms/bipartite/matching.pyi b/stubs/networkx/networkx/algorithms/bipartite/matching.pyi index cdf9dddbbbf1..49c12489affe 100644 --- a/stubs/networkx/networkx/algorithms/bipartite/matching.pyi +++ b/stubs/networkx/networkx/algorithms/bipartite/matching.pyi @@ -1,5 +1,5 @@ -from _typeshed import Incomplete, SupportsGetItem -from collections.abc import Iterable +from _typeshed import Incomplete +from collections.abc import Iterable, Mapping from networkx.classes.graph import Graph, _Node from networkx.utils.backends import _dispatchable @@ -12,7 +12,7 @@ def hopcroft_karp_matching(G: Graph[_Node], top_nodes: Iterable[_Node] | None = def eppstein_matching(G: Graph[_Node], top_nodes: Iterable[Incomplete] | None = None) -> dict[Incomplete, Incomplete]: ... @_dispatchable def to_vertex_cover( - G: Graph[_Node], matching: SupportsGetItem[Incomplete, Incomplete], top_nodes: Iterable[Incomplete] | None = None + G: Graph[_Node], matching: Mapping[Incomplete, Incomplete], top_nodes: Iterable[Incomplete] | None = None ): ... maximum_matching = hopcroft_karp_matching diff --git a/stubs/networkx/networkx/algorithms/centrality/closeness.pyi b/stubs/networkx/networkx/algorithms/centrality/closeness.pyi index 72201138a975..7719ca78e687 100644 --- a/stubs/networkx/networkx/algorithms/centrality/closeness.pyi +++ b/stubs/networkx/networkx/algorithms/centrality/closeness.pyi @@ -1,4 +1,4 @@ -from _typeshed import Incomplete, SupportsGetItem +from _typeshed import Incomplete, SupportsKeysAndGetItem from networkx.classes.graph import Graph, _Node from networkx.utils.backends import _dispatchable @@ -13,7 +13,7 @@ def closeness_centrality( def incremental_closeness_centrality( G: Graph[_Node], edge: tuple[Incomplete], - prev_cc: SupportsGetItem[Incomplete, Incomplete] | None = None, + prev_cc: SupportsKeysAndGetItem[Incomplete, Incomplete] | None = None, insertion: bool | None = True, wf_improved: bool | None = True, ) -> dict[_Node, float]: ... diff --git a/stubs/networkx/networkx/algorithms/centrality/eigenvector.pyi b/stubs/networkx/networkx/algorithms/centrality/eigenvector.pyi index d0e6f96b92cb..75ee56abc272 100644 --- a/stubs/networkx/networkx/algorithms/centrality/eigenvector.pyi +++ b/stubs/networkx/networkx/algorithms/centrality/eigenvector.pyi @@ -1,4 +1,5 @@ -from _typeshed import Incomplete, SupportsGetItem +from _typeshed import Incomplete +from collections.abc import Mapping from networkx.classes.graph import Graph, _Node from networkx.utils.backends import _dispatchable @@ -10,7 +11,7 @@ def eigenvector_centrality( G: Graph[_Node], max_iter: int | None = 100, tol: float | None = 1e-06, - nstart: SupportsGetItem[Incomplete, Incomplete] | None = None, + nstart: Mapping[Incomplete, Incomplete] | None = None, weight: str | None = None, ) -> dict[Incomplete, float]: ... @_dispatchable diff --git a/stubs/networkx/networkx/algorithms/centrality/katz.pyi b/stubs/networkx/networkx/algorithms/centrality/katz.pyi index ca867e0d624a..b8b8cda7b7e5 100644 --- a/stubs/networkx/networkx/algorithms/centrality/katz.pyi +++ b/stubs/networkx/networkx/algorithms/centrality/katz.pyi @@ -1,4 +1,5 @@ -from _typeshed import Incomplete, SupportsGetItem +from _typeshed import ConvertibleToFloat, Incomplete, SupportsItemAccess +from collections.abc import Iterable, Mapping from networkx.classes.graph import Graph, _Node from networkx.utils.backends import _dispatchable @@ -9,10 +10,10 @@ __all__ = ["katz_centrality", "katz_centrality_numpy"] def katz_centrality( G: Graph[_Node], alpha: float | None = 0.1, - beta: float | SupportsGetItem[Incomplete, Incomplete] | None = 1.0, + beta: ConvertibleToFloat | Iterable[Incomplete] | None = 1.0, max_iter: int | None = 1000, tol: float | None = 1e-06, - nstart: SupportsGetItem[Incomplete, Incomplete] | None = None, + nstart: SupportsItemAccess[Incomplete, Incomplete] | None = None, normalized: bool | None = True, weight: str | None = None, ) -> dict[Incomplete, Incomplete]: ... @@ -20,7 +21,7 @@ def katz_centrality( def katz_centrality_numpy( G: Graph[_Node], alpha: float = 0.1, - beta: float | SupportsGetItem[Incomplete, Incomplete] | None = 1.0, + beta: float | Mapping[Incomplete, Incomplete] | None = 1.0, normalized: bool = True, weight: str | None = None, ) -> dict[Incomplete, Incomplete]: ... diff --git a/stubs/networkx/networkx/algorithms/centrality/percolation.pyi b/stubs/networkx/networkx/algorithms/centrality/percolation.pyi index cc5faab10f72..becea462a050 100644 --- a/stubs/networkx/networkx/algorithms/centrality/percolation.pyi +++ b/stubs/networkx/networkx/algorithms/centrality/percolation.pyi @@ -1,4 +1,5 @@ -from _typeshed import Incomplete, SupportsGetItem +from _typeshed import Incomplete +from collections.abc import Mapping from networkx.classes.graph import Graph, _Node from networkx.utils.backends import _dispatchable @@ -9,6 +10,6 @@ __all__ = ["percolation_centrality"] def percolation_centrality( G: Graph[_Node], attribute: str | None = "percolation", - states: SupportsGetItem[Incomplete, Incomplete] | None = None, + states: Mapping[Incomplete, Incomplete] | None = None, weight: str | None = None, ) -> dict[Incomplete, float]: ... diff --git a/stubs/networkx/networkx/algorithms/centrality/reaching.pyi b/stubs/networkx/networkx/algorithms/centrality/reaching.pyi index d5a6e1479aca..b491df5addf8 100644 --- a/stubs/networkx/networkx/algorithms/centrality/reaching.pyi +++ b/stubs/networkx/networkx/algorithms/centrality/reaching.pyi @@ -1,4 +1,5 @@ -from _typeshed import Incomplete, SupportsGetItem +from _typeshed import Incomplete +from collections.abc import Mapping from networkx.classes.digraph import DiGraph from networkx.classes.graph import _Node @@ -12,7 +13,7 @@ def global_reaching_centrality(G: DiGraph[_Node], weight: str | None = None, nor def local_reaching_centrality( G: DiGraph[_Node], v: _Node, - paths: SupportsGetItem[Incomplete, Incomplete] | None = None, + paths: Mapping[Incomplete, Incomplete] | None = None, weight: str | None = None, normalized: bool | None = True, ) -> float: ... diff --git a/stubs/networkx/networkx/algorithms/core.pyi b/stubs/networkx/networkx/algorithms/core.pyi index 386a3c65b0cf..f24963a9b307 100644 --- a/stubs/networkx/networkx/algorithms/core.pyi +++ b/stubs/networkx/networkx/algorithms/core.pyi @@ -1,4 +1,5 @@ -from _typeshed import Incomplete, SupportsGetItem +from _typeshed import Incomplete +from collections.abc import Mapping from networkx.classes.graph import Graph, _Node from networkx.utils.backends import _dispatchable @@ -8,13 +9,13 @@ __all__ = ["core_number", "k_core", "k_shell", "k_crust", "k_corona", "k_truss", @_dispatchable def core_number(G: Graph[_Node]) -> dict[Incomplete, Incomplete]: ... @_dispatchable -def k_core(G: Graph[_Node], k: int | None = None, core_number: SupportsGetItem[Incomplete, Incomplete] | None = None): ... +def k_core(G: Graph[_Node], k: int | None = None, core_number: Mapping[Incomplete, Incomplete] | None = None): ... @_dispatchable -def k_shell(G: Graph[_Node], k: int | None = None, core_number: SupportsGetItem[Incomplete, Incomplete] | None = None): ... +def k_shell(G: Graph[_Node], k: int | None = None, core_number: Mapping[Incomplete, Incomplete] | None = None): ... @_dispatchable -def k_crust(G: Graph[_Node], k: int | None = None, core_number: SupportsGetItem[Incomplete, Incomplete] | None = None): ... +def k_crust(G: Graph[_Node], k: int | None = None, core_number: Mapping[Incomplete, Incomplete] | None = None): ... @_dispatchable -def k_corona(G: Graph[_Node], k: int, core_number: SupportsGetItem[Incomplete, Incomplete] | None = None): ... +def k_corona(G: Graph[_Node], k: int | None, core_number: Mapping[Incomplete, Incomplete] | None = None): ... @_dispatchable def k_truss(G: Graph[_Node], k: int): ... @_dispatchable diff --git a/stubs/networkx/networkx/algorithms/similarity.pyi b/stubs/networkx/networkx/algorithms/similarity.pyi index e2fd83794a6e..6fd1435509c3 100644 --- a/stubs/networkx/networkx/algorithms/similarity.pyi +++ b/stubs/networkx/networkx/algorithms/similarity.pyi @@ -1,4 +1,4 @@ -from _typeshed import Incomplete, SupportsGetItem +from _typeshed import Incomplete, SupportsItemAccess from collections.abc import Callable, Generator from networkx.classes.graph import Graph, _Node @@ -101,7 +101,7 @@ def generate_random_paths( G: Graph[_Node], sample_size: int, path_length: int = 5, - index_map: SupportsGetItem[Incomplete, Incomplete] | None = None, + index_map: SupportsItemAccess[Incomplete, Incomplete] | None = None, weight: str | None = "weight", seed: int | RandomState | None = None, *,