Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Merge branch 'main' of https://github.com/python/typeshed into networ…
…kx-return-type-annotations-from-python-type-stubs
  • Loading branch information
Avasam committed Jun 10, 2025
commit 99c280ba32c2e4135677508ebc1d92353ee4501c
5 changes: 0 additions & 5 deletions stubs/networkx/networkx/algorithms/d_separation.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from _typeshed import Incomplete
from typing_extensions import deprecated

from networkx.classes.digraph import DiGraph
from networkx.classes.graph import _Node
Expand All @@ -11,10 +10,6 @@ __all__ = ["is_d_separator", "is_minimal_d_separator", "find_minimal_d_separator
def is_d_separator(G: DiGraph[_Node], x: _Node | set[_Node], y: _Node | set[_Node], z: _Node | set[_Node]) -> bool: ...
@_dispatchable
def find_minimal_d_separator(G, x, y, *, included=None, restricted=None) -> set[Incomplete] | None: ...
@deprecated("d_separated is deprecated and will be removed in NetworkX v3.5. Please use `is_d_separator(G, x, y, z)`.")
def d_separated(G, x, y, z) -> bool: ...
@_dispatchable
def minimal_d_separator(G, u, v): ...
@_dispatchable
def is_minimal_d_separator(
G: DiGraph[_Node],
Expand Down
12 changes: 8 additions & 4 deletions stubs/networkx/networkx/algorithms/distance_measures.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
from _typeshed import Incomplete
from collections.abc import Callable
from typing_extensions import TypeAlias

from networkx.classes.graph import Graph, _Node
from networkx.utils.backends import _dispatchable
Expand All @@ -20,20 +22,22 @@ __all__ = [

@_dispatchable
def eccentricity(
G: Graph[_Node], v: _Node | None = None, sp=None, weight: str | None = None
G: Graph[_Node], v: _Node | None = None, sp=None, weight: str | _WeightFunction | None = None
) -> Incomplete | dict[Incomplete, Incomplete]: ...
@_dispatchable
def diameter(G: Graph[_Node], e=None, usebounds: bool = False, weight: str | _WeightFunction | None = None): ...
@_dispatchable
def harmonic_diameter(G, sp=None, *, weight: str | _WeightFunction | None = None) -> float: ...
@_dispatchable
def periphery(G: Graph[_Node], e=None, usebounds=False, weight: str | None = None) -> list[Incomplete]: ...
def periphery(
G: Graph[_Node], e=None, usebounds: bool = False, weight: str | _WeightFunction | None = None
) -> list[Incomplete]: ...
@_dispatchable
def radius(G: Graph[_Node], e=None, usebounds: bool = False, weight: str | _WeightFunction | None = None): ...
@_dispatchable
def center(G: Graph[_Node], e=None, usebounds=False, weight: str | None = None) -> list[Incomplete]: ...
def center(G: Graph[_Node], e=None, usebounds: bool = False, weight: str | _WeightFunction | None = None) -> list[Incomplete]: ...
@_dispatchable
def barycenter(G, weight: str | None = None, attr=None, sp=None) -> list[Incomplete]: ...
def barycenter(G, weight: str | _WeightFunction | None = None, attr=None, sp=None) -> list[Incomplete]: ...
@_dispatchable
def resistance_distance(
G: Graph[_Node], nodeA=None, nodeB=None, weight: str | None = None, invert_weight: bool = True
Expand Down
3 changes: 1 addition & 2 deletions stubs/networkx/networkx/algorithms/dominating.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from _typeshed import Incomplete
from collections.abc import Iterable

from networkx.classes.graph import Graph, _Node
Expand All @@ -7,7 +6,7 @@ from networkx.utils.backends import _dispatchable
__all__ = ["dominating_set", "is_dominating_set", "connected_dominating_set", "is_connected_dominating_set"]

@_dispatchable
def dominating_set(G: Graph[_Node], start_with: _Node | None = None) -> set[Incomplete]: ...
def dominating_set(G: Graph[_Node], start_with: _Node | None = None) -> set[_Node]: ...
@_dispatchable
def is_dominating_set(G: Graph[_Node], nbunch: Iterable[_Node]) -> bool: ...
@_dispatchable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@ __all__ = ["rooted_tree_isomorphism", "tree_isomorphism"]
@_dispatchable
def root_trees(t1, root1, t2, root2): ...
@_dispatchable
def assign_levels(G: Graph[_Node], root): ...
def group_by_levels(levels): ...
def generate_isomorphism(v, w, M, ordered_children): ...
@_dispatchable
def rooted_tree_isomorphism(t1, root1, t2, root2) -> list[tuple[Incomplete, Incomplete]]: ...
@_dispatchable
def tree_isomorphism(t1: Graph[_Node], t2: Graph[_Node]) -> list[tuple[Incomplete, Incomplete]]: ...
4 changes: 3 additions & 1 deletion stubs/networkx/networkx/algorithms/similarity.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -104,4 +104,6 @@ def generate_random_paths(
index_map: SupportsGetItem[Incomplete, Incomplete] | None = None,
weight: str | None = "weight",
seed: int | RandomState | None = None,
) -> Generator[list[Incomplete], None, None]: ...
*,
source: _Node | None = None,
) -> Generator[list[Incomplete]]: ...
2 changes: 2 additions & 0 deletions stubs/networkx/networkx/algorithms/tournament.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,13 @@
@_dispatchable
def is_tournament(G: Graph[_Node]) -> bool: ...
@_dispatchable
def hamiltonian_path(G: Graph[_Node]) -> list[Incomplete]: ...

Check failure on line 18 in stubs/networkx/networkx/algorithms/tournament.pyi

View workflow job for this annotation

GitHub Actions / pyright: Run test cases (Linux, 3.13)

"Incomplete" is not defined (reportUndefinedVariable)
@_dispatchable
def random_tournament(n: int, seed: int | RandomState | None = None) -> DiGraph[Incomplete]: ...

Check failure on line 20 in stubs/networkx/networkx/algorithms/tournament.pyi

View workflow job for this annotation

GitHub Actions / pyright: Run test cases (Linux, 3.13)

"Incomplete" is not defined (reportUndefinedVariable)

Check failure on line 20 in stubs/networkx/networkx/algorithms/tournament.pyi

View workflow job for this annotation

GitHub Actions / pyright: Run test cases (Linux, 3.13)

"DiGraph" is not defined (reportUndefinedVariable)
@_dispatchable
def tournament_matrix(G: Graph[_Node]): ...
@_dispatchable
def score_sequence(G: Graph[_Node]) -> list[Incomplete]: ...

Check failure on line 24 in stubs/networkx/networkx/algorithms/tournament.pyi

View workflow job for this annotation

GitHub Actions / pyright: Run test cases (Linux, 3.13)

"Incomplete" is not defined (reportUndefinedVariable)
@_dispatchable
def is_reachable(G: Graph[_Node], s: _Node, t: _Node) -> bool: ...
@_dispatchable
Expand Down
2 changes: 0 additions & 2 deletions stubs/networkx/networkx/algorithms/triads.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,3 @@ def all_triads(G: DiGraph[_Node]) -> Generator[Incomplete, None, None]: ...
def triads_by_type(G: DiGraph[_Node]) -> defaultdict[Incomplete, list[Incomplete]]: ...
@_dispatchable
def triad_type(G: DiGraph[_Node]) -> str | None: ...
@_dispatchable
def random_triad(G: DiGraph[_Node], seed: int | RandomState | None = None): ...
46 changes: 36 additions & 10 deletions stubs/networkx/networkx/drawing/layout.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,23 @@ __all__ = [
"arf_layout",
]

def random_layout(G, center=None, dim: int = 2, seed=None) -> dict[Incomplete, Incomplete]: ...
def circular_layout(G, scale: float = 1, center=None, dim: int = 2) -> dict[Incomplete, Incomplete]: ...
def shell_layout(G, nlist=None, rotate=None, scale: float = 1, center=None, dim: int = 2) -> dict[Incomplete, Incomplete]: ...
def random_layout(
G, center=None, dim: int = 2, seed: int | RandomState | None = None, store_pos_as: str | None = None
) -> dict[Incomplete, Incomplete]: ...
def circular_layout(
G, scale: float = 1, center=None, dim: int = 2, store_pos_as: str | None = None
) -> dict[Incomplete, Incomplete]: ...
def shell_layout(
G, nlist=None, rotate=None, scale: float = 1, center=None, dim: int = 2, store_pos_as: str | None = None
) -> dict[Incomplete, Incomplete]: ...
def bipartite_layout(
G, nodes, align: str = "vertical", scale: float = 1, center=None, aspect_ratio: float = ...
G,
nodes=None,
align: str = "vertical",
scale: float = 1,
center=None,
aspect_ratio: float = ...,
store_pos_as: str | None = None,
) -> dict[Incomplete, Incomplete]: ...
def spring_layout(
G,
Expand All @@ -39,21 +51,35 @@ def spring_layout(
scale: float = 1,
center=None,
dim: int = 2,
seed=None,
seed: int | RandomState | None = None,
store_pos_as: str | None = None,
*,
method: str = "auto",
gravity: float = 1.0,
) -> dict[Incomplete, Incomplete]: ...

fruchterman_reingold_layout = spring_layout

def kamada_kawai_layout(
G, dist=None, pos=None, weight: str = "weight", scale: float = 1, center=None, dim: int = 2
G, dist=None, pos=None, weight: str = "weight", scale: float = 1, center=None, dim: int = 2, store_pos_as: str | None = None
) -> dict[Incomplete, Incomplete]: ...
def spectral_layout(
G, weight: str = "weight", scale: float = 1, center=None, dim: int = 2, store_pos_as: str | None = None
) -> dict[Incomplete, Incomplete]: ...
def planar_layout(
G, scale: float = 1, center=None, dim: int = 2, store_pos_as: str | None = None
) -> dict[Incomplete, Incomplete]: ...
def spectral_layout(G, weight: str = "weight", scale: float = 1, center=None, dim: int = 2) -> dict[Incomplete, Incomplete]: ...
def planar_layout(G, scale: float = 1, center=None, dim: int = 2) -> dict[Incomplete, Incomplete]: ...
def spiral_layout(
G, scale: float = 1, center=None, dim: int = 2, resolution: float = 0.35, equidistant: bool = False
G,
scale: float = 1,
center=None,
dim: int = 2,
resolution: float = 0.35,
equidistant: bool = False,
store_pos_as: str | None = None,
) -> dict[Incomplete, Incomplete]: ...
def multipartite_layout(
G, subset_key: str = "subset", align: str = "vertical", scale: float = 1, center=None
G, subset_key: str = "subset", align: str = "vertical", scale: float = 1, center=None, store_pos_as: str | None = None
) -> dict[Incomplete, Incomplete]: ...
def arf_layout(
G,
Expand Down
2 changes: 0 additions & 2 deletions stubs/networkx/networkx/linalg/laplacianmatrix.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ def laplacian_matrix(G, nodelist: Collection[Incomplete] | None = None, weight:
@_dispatchable
def normalized_laplacian_matrix(G, nodelist: Collection[Incomplete] | None = None, weight: str = "weight"): ...
@_dispatchable
def total_spanning_tree_weight(G, weight=None) -> float: ...
@_dispatchable
def directed_laplacian_matrix(
G, nodelist: Collection[Incomplete] | None = None, weight: str = "weight", walk_type=None, alpha: float = 0.95
): ...
Expand Down
Loading
You are viewing a condensed version of this merge commit. You can view the full changes here.