mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-05-04 20:45:49 +08:00
@@ -1,32 +1,46 @@
|
||||
from _typeshed import Incomplete
|
||||
from collections.abc import Iterator
|
||||
from functools import cached_property
|
||||
from typing import Any
|
||||
from typing_extensions import Self
|
||||
|
||||
from networkx.classes.coreviews import AdjacencyView
|
||||
from networkx.classes.graph import Graph, _Node
|
||||
from networkx.classes.reportviews import InDegreeView, InMultiDegreeView, OutDegreeView, OutEdgeView, OutMultiDegreeView
|
||||
from networkx.classes.reportviews import (
|
||||
DiDegreeView,
|
||||
InDegreeView,
|
||||
InEdgeView,
|
||||
InMultiDegreeView,
|
||||
OutDegreeView,
|
||||
OutEdgeView,
|
||||
OutMultiDegreeView,
|
||||
)
|
||||
|
||||
__all__ = ["DiGraph"]
|
||||
|
||||
class DiGraph(Graph[_Node]):
|
||||
@cached_property
|
||||
def succ(self) -> AdjacencyView[_Node, _Node, dict[str, Incomplete]]: ...
|
||||
def succ(self) -> AdjacencyView[_Node, _Node, dict[str, Any]]: ...
|
||||
@cached_property
|
||||
def pred(self) -> AdjacencyView[_Node, _Node, dict[str, Incomplete]]: ...
|
||||
def pred(self) -> AdjacencyView[_Node, _Node, dict[str, Any]]: ...
|
||||
def has_successor(self, u: _Node, v: _Node) -> bool: ...
|
||||
def has_predecessor(self, u: _Node, v: _Node) -> bool: ...
|
||||
def successors(self, n: _Node) -> Iterator[_Node]: ...
|
||||
|
||||
neighbors = successors
|
||||
|
||||
def predecessors(self, n: _Node) -> Iterator[_Node]: ...
|
||||
@cached_property
|
||||
def out_edges(self) -> OutEdgeView[_Node]: ...
|
||||
@cached_property
|
||||
def in_edges(self) -> OutEdgeView[_Node]: ...
|
||||
def in_edges(self) -> InEdgeView[_Node]: ...
|
||||
@cached_property
|
||||
def in_degree(self) -> InDegreeView[_Node] | InMultiDegreeView[_Node]: ... # Include subtypes' possible return types
|
||||
def in_degree(self) -> int | InDegreeView[_Node] | InMultiDegreeView[_Node]: ...
|
||||
@cached_property
|
||||
def out_degree(self) -> OutDegreeView[_Node] | OutMultiDegreeView[_Node]: ... # Include subtypes' possible return types
|
||||
def to_undirected(self, reciprocal: bool = False, as_view: bool = False) -> Graph[_Node]: ... # type: ignore[override] # Has an additional `reciprocal` keyword argument
|
||||
def out_degree(self) -> int | OutDegreeView[_Node] | OutMultiDegreeView[_Node]: ...
|
||||
def to_undirected(self, reciprocal: bool = False, as_view: bool = False) -> Graph[_Node]: ... # type: ignore[override]
|
||||
# reciprocal : If True, only edges that appear in both directions ... will be kept in the undirected graph.
|
||||
def reverse(self, copy: bool = True) -> Self: ...
|
||||
def copy(self, as_view: bool = False) -> DiGraph[_Node]: ...
|
||||
@cached_property
|
||||
def edges(self) -> OutEdgeView[_Node]: ... # type: ignore[override] # An OutEdgeView of the DiGraph as G.edges or G.edges().
|
||||
@cached_property
|
||||
def degree(self) -> int | DiDegreeView[_Node]: ... # type: ignore[override] # Returns DiDegreeView or int
|
||||
|
||||
@@ -1,26 +1,33 @@
|
||||
from _typeshed import Incomplete
|
||||
from functools import cached_property
|
||||
from typing import Any
|
||||
|
||||
from networkx.classes.coreviews import MultiAdjacencyView
|
||||
from networkx.classes.digraph import DiGraph
|
||||
from networkx.classes.graph import _Node
|
||||
from networkx.classes.graph import _EdgeWithData, _Node
|
||||
from networkx.classes.multigraph import MultiGraph
|
||||
from networkx.classes.reportviews import InMultiDegreeView, OutMultiDegreeView, OutMultiEdgeView
|
||||
from networkx.classes.reportviews import (
|
||||
InMultiDegreeView,
|
||||
InMultiEdgeDataView,
|
||||
InMultiEdgeView,
|
||||
OutMultiDegreeView,
|
||||
OutMultiEdgeView,
|
||||
)
|
||||
|
||||
__all__ = ["MultiDiGraph"]
|
||||
|
||||
class MultiDiGraph(MultiGraph[_Node], DiGraph[_Node]):
|
||||
@cached_property
|
||||
def succ(self) -> MultiAdjacencyView[_Node, _Node, dict[str, Incomplete]]: ...
|
||||
def succ(self) -> MultiAdjacencyView[_Node, _Node, dict[str, Any]]: ...
|
||||
@cached_property
|
||||
def pred(self) -> MultiAdjacencyView[_Node, _Node, dict[str, Incomplete]]: ...
|
||||
def pred(self) -> MultiAdjacencyView[_Node, _Node, dict[str, Any]]: ...
|
||||
@cached_property
|
||||
def edges(self) -> OutMultiEdgeView[_Node]: ... # type: ignore[override]
|
||||
# Returns: OutMultiEdgeView
|
||||
@cached_property
|
||||
def out_edges(self) -> OutMultiEdgeView[_Node]: ...
|
||||
@cached_property
|
||||
def in_edges(self) -> OutMultiEdgeView[_Node]: ...
|
||||
def in_edges(self) -> InMultiEdgeView[_Node] | InMultiEdgeDataView[_Node, _EdgeWithData[_Node]]: ... # type: ignore[override]
|
||||
# Returns : InMultiEdgeView or InMultiEdgeDataView
|
||||
@cached_property
|
||||
def in_degree(self) -> InMultiDegreeView[_Node]: ...
|
||||
@cached_property
|
||||
|
||||
Reference in New Issue
Block a user