-
-
Notifications
You must be signed in to change notification settings - Fork 2k
networkx: All return types from python-type-stubs #14256
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 5 commits
4a6f83d
99c280b
359d750
b891c71
5b3674f
d5c889e
f7fcb64
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,9 +1,11 @@ | ||
| from _typeshed import Incomplete | ||
|
|
||
| from networkx.classes.graph import Graph, _Node | ||
| from networkx.utils.backends import _dispatchable | ||
|
|
||
| __all__ = ["min_weighted_dominating_set", "min_edge_dominating_set"] | ||
|
|
||
| @_dispatchable | ||
| def min_weighted_dominating_set(G: Graph[_Node], weight: str | None = None): ... | ||
| def min_weighted_dominating_set(G: Graph[_Node], weight: str | None = None) -> set[Incomplete]: ... | ||
| @_dispatchable | ||
| def min_edge_dominating_set(G: Graph[_Node]): ... | ||
| def min_edge_dominating_set(G: Graph[_Node]) -> set[Incomplete]: ... |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,10 @@ | ||
| from _typeshed import Incomplete | ||
| from collections import defaultdict | ||
|
|
||
| from networkx.classes.graph import Graph, _Node | ||
| from networkx.utils.backends import _dispatchable | ||
|
|
||
| __all__ = ["k_components"] | ||
|
|
||
| @_dispatchable | ||
| def k_components(G: Graph[_Node], min_density: float = 0.95): ... | ||
| def k_components(G: Graph[_Node], min_density: float = 0.95) -> defaultdict[Incomplete, list[Incomplete]]: ... |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,9 @@ | ||
| from _typeshed import Incomplete | ||
|
|
||
| from networkx.classes.graph import Graph, _Node | ||
| from networkx.utils.backends import _dispatchable | ||
|
|
||
| __all__ = ["min_maximal_matching"] | ||
|
|
||
| @_dispatchable | ||
| def min_maximal_matching(G: Graph[_Node]): ... | ||
| def min_maximal_matching(G: Graph[_Node]) -> set[Incomplete]: ... |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,9 @@ | ||
| from _typeshed import Incomplete | ||
|
|
||
| from networkx.classes.graph import Graph, _Node | ||
| from networkx.utils.backends import _dispatchable | ||
|
|
||
| __all__ = ["min_weighted_vertex_cover"] | ||
|
|
||
| @_dispatchable | ||
| def min_weighted_vertex_cover(G: Graph[_Node], weight: str | None = None): ... | ||
| def min_weighted_vertex_cover(G: Graph[_Node], weight: str | None = None) -> set[Incomplete]: ... |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,11 +1,13 @@ | ||
| from _typeshed import Incomplete | ||
|
|
||
| from networkx.classes.graph import Graph, _Node | ||
| from networkx.utils.backends import _dispatchable | ||
|
|
||
| __all__ = ["degree_centrality", "betweenness_centrality", "closeness_centrality"] | ||
|
|
||
| @_dispatchable | ||
| def degree_centrality(G: Graph[_Node], nodes): ... | ||
| def degree_centrality(G: Graph[_Node], nodes) -> dict[Incomplete, Incomplete]: ... | ||
| @_dispatchable | ||
| def betweenness_centrality(G: Graph[_Node], nodes): ... | ||
| def betweenness_centrality(G: Graph[_Node], nodes) -> dict[Incomplete, Incomplete]: ... | ||
| @_dispatchable | ||
| def closeness_centrality(G: Graph[_Node], nodes, normalized: bool | None = True): ... | ||
| def closeness_centrality(G: Graph[_Node], nodes, normalized: bool | None = True) -> dict[Incomplete, Incomplete]: ... |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -14,6 +14,6 @@ def biadjacency_matrix( | |||||
| dtype=None, | ||||||
| weight: str | None = "weight", | ||||||
| format="csr", | ||||||
| ): ... | ||||||
| ): ... # Return is a complex union of scipy classes depending on the format param | ||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So, should we return
Suggested change
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think I added this comment initially because I probably added |
||||||
| @_dispatchable | ||||||
| def from_biadjacency_matrix(A, create_using: Graph[_Node] | None = None, edge_attribute: str = "weight"): ... | ||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,9 @@ | ||
| from _typeshed import Incomplete | ||
|
|
||
| from networkx.classes.graph import Graph, _Node | ||
| from networkx.utils.backends import _dispatchable | ||
|
|
||
| __all__ = ["spectral_bipartivity"] | ||
|
|
||
| @_dispatchable | ||
| def spectral_bipartivity(G: Graph[_Node], nodes=None, weight: str = "weight"): ... | ||
| def spectral_bipartivity(G: Graph[_Node], nodes=None, weight: str = "weight") -> float | dict[Incomplete, Incomplete]: ... |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,9 +1,13 @@ | ||
| from _typeshed import Incomplete | ||
|
|
||
| from networkx.classes.graph import Graph, _Node | ||
| from networkx.utils.backends import _dispatchable | ||
|
|
||
| __all__ = ["current_flow_closeness_centrality", "information_centrality"] | ||
|
|
||
| @_dispatchable | ||
| def current_flow_closeness_centrality(G: Graph[_Node], weight: str | None = None, dtype: type = ..., solver: str = "lu"): ... | ||
| def current_flow_closeness_centrality( | ||
| G: Graph[_Node], weight: str | None = None, dtype: type = ..., solver: str = "lu" | ||
| ) -> dict[Incomplete, float]: ... | ||
|
|
||
| information_centrality = current_flow_closeness_centrality |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nitty nit:
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(applied suggestion)
There's a ton of those in networkx stubs. Maybe we should have a lint rule for the new concise Generator format ?