-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
add annotations for MultiDiGraph
#13319
Changes from all commits
acf3b73
29e0866
9874c42
de4296c
c0a94ea
124c250
e232642
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 |
---|---|---|
|
@@ -110,36 +110,66 @@ class EdgeView(OutEdgeView[_Node]): ... | |
class InEdgeView(OutEdgeView[_Node]): ... | ||
|
||
class OutMultiEdgeView(OutEdgeView[_Node]): | ||
def __iter__(self) -> Iterator[tuple[_Node, _Node, Incomplete]]: ... # type: ignore[override] | ||
def __getitem__(self, e: tuple[_Node, _Node, Incomplete]) -> dict[str, Any]: ... # type: ignore[override] | ||
@overload # type: ignore[override] # Has an additional `keys` keyword argument | ||
def __call__( | ||
def __call__( # type: ignore[overload-overlap] | ||
self, nbunch: None = None, data: Literal[False] = False, *, default: Unused = None, keys: Literal[True] | ||
) -> Self: ... | ||
@overload | ||
def __call__( | ||
self, nbunch: _NBunch[_Node], data: Literal[True], *, default: None = None, keys: bool = False | ||
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. Could we rearrange the overloads so that the true/false pairs are next to each other so it's easier to read? 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. What do you mean exactly? 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. Correct me if I'm wrong here, but it appears this PR splits some
It would now be
etc. That would make it a bit easier to review and probably also easier to edit/maintain in the future. 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 followed the order of |
||
) -> OutMultiEdgeDataView[_Node, tuple[_Node, _Node, dict[str, Incomplete]]]: ... | ||
self, nbunch: _NBunch[_Node] = None, data: Literal[False] = False, *, default: None = None, keys: Literal[False] = False | ||
) -> OutMultiEdgeDataView[_Node, tuple[_Node, _Node]]: ... | ||
@overload | ||
def __call__( | ||
self, nbunch: _Node | Iterable[_Node], data: Literal[False] = False, *, default: None = None, keys: Literal[True] | ||
) -> OutMultiEdgeDataView[_Node, tuple[_Node, _Node, Incomplete]]: ... | ||
@overload | ||
def __call__( | ||
self, nbunch: _NBunch[_Node] = None, *, data: Literal[True], default: None = None, keys: Literal[True] | ||
) -> OutMultiEdgeDataView[_Node, tuple[_Node, _Node, Incomplete, dict[str, Incomplete]]]: ... | ||
@overload | ||
def __call__( | ||
self, nbunch: _NBunch[_Node], data: Literal[True], *, default: None = None, keys: Literal[True] | ||
) -> OutMultiEdgeDataView[_Node, tuple[_Node, _Node, Incomplete, dict[str, Incomplete]]]: ... | ||
@overload | ||
def __call__( | ||
self, nbunch: _NBunch[_Node] = None, *, data: Literal[True], default: None = None, keys: bool = False | ||
self, nbunch: _NBunch[_Node] = None, *, data: Literal[True], default: None = None, keys: Literal[False] = False | ||
) -> OutMultiEdgeDataView[_Node, tuple[_Node, _Node, dict[str, Incomplete]]]: ... | ||
@overload | ||
def __call__( | ||
self, nbunch: _NBunch[_Node], data: str, *, default: _U | None = None, keys: bool = False | ||
self, nbunch: _NBunch[_Node], data: str, *, default: _U | None = None, keys: Literal[False] = False | ||
) -> OutMultiEdgeDataView[_Node, tuple[_Node, _Node, _U]]: ... | ||
@overload | ||
def __call__( | ||
self, nbunch: _NBunch[_Node] = None, *, data: str, default: _U | None = None, keys: bool = False | ||
self, nbunch: _NBunch[_Node] = None, *, data: str, default: _U | None = None, keys: Literal[True] | ||
) -> OutMultiEdgeDataView[_Node, tuple[_Node, _Node, Incomplete, _U]]: ... | ||
@overload | ||
def __call__( | ||
self, nbunch: _NBunch[_Node] = None, *, data: str, default: _U | None = None, keys: Literal[False] = False | ||
) -> OutMultiEdgeDataView[_Node, tuple[_Node, _Node, _U]]: ... | ||
@overload # type: ignore[override] | ||
def data(self, data: Literal[False], default: Unused = None, nbunch: None = None, *, keys: Literal[True]) -> Self: ... | ||
@overload | ||
def data(self, data: Literal[False], default: Unused = None, nbunch: None = None, keys: Literal[False] = False) -> Self: ... | ||
def data( | ||
self, data: Literal[False], default: None = None, nbunch: _NBunch[_Node] = None, keys: Literal[False] = False | ||
) -> OutMultiEdgeDataView[_Node, tuple[_Node, _Node]]: ... | ||
@overload | ||
def data( | ||
self, data: Literal[True] = True, default: None = None, nbunch: _NBunch[_Node] = None, keys: bool = False | ||
self, data: Literal[True] = True, default: None = None, nbunch: _NBunch[_Node] = None, keys: Literal[False] = False | ||
) -> OutMultiEdgeDataView[_Node, tuple[_Node, _Node, dict[str, Incomplete]]]: ... | ||
@overload | ||
def data( | ||
self, data: str, default: _U | None = None, nbunch: _NBunch[_Node] = None, keys: bool = False | ||
self, data: Literal[True] = True, default: None = None, nbunch: _NBunch[_Node] = None, *, keys: Literal[True] | ||
) -> OutMultiEdgeDataView[_Node, tuple[_Node, _Node, Incomplete, dict[str, Incomplete]]]: ... | ||
@overload | ||
def data( | ||
self, data: str, default: _U | None = None, nbunch: _NBunch[_Node] = None, keys: Literal[False] = False | ||
) -> OutMultiEdgeDataView[_Node, tuple[_Node, _Node, _U]]: ... | ||
@overload | ||
def data( | ||
self, data: str, default: _U | None = None, nbunch: _NBunch[_Node] = None, *, keys: Literal[True] | ||
) -> OutMultiEdgeDataView[_Node, tuple[_Node, _Node, Incomplete, _U]]: ... | ||
|
||
class MultiEdgeView(OutMultiEdgeView[_Node]): ... | ||
class InMultiEdgeView(OutMultiEdgeView[_Node]): ... |
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.
This part lgtm