-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Open
Labels
priority: regressionSomething that worked before doesn't work anymoreSomething that worked before doesn't work anymorestubs: false positiveType checkers report false errorsType checkers report false errors
Description
Hi,
Since the recent release of types-networkx
3.5.0.20250821
, Pyright is giving errors when trying to call DiGraph.in_degrees
and DiGraph.out_degrees
for a single node. This is a valid way to access the data as described in the networkx docstings below:
To reproduce the error
>>> import networkx as nx
>>> G = nx.DiGraph()
>>> G.add_edge(1, 3)
>>> G.add_edge(2, 3)
>>> G.add_edge(3, 4)
>>> G.add_edge(3, 5)
>>> G.add_edge(3, 6)
>>> print((G.in_degree(3), G.out_degree(3)))
(2, 3)
And the Pyright error is
temp.py
temp.py:10:8 - error: No overloads for "__call__" match the provided arguments (reportCallIssue)
temp.py:10:20 - error: Argument of type "Literal[3]" cannot be assigned to parameter "nbunch" of type "Iterable[Unknown] | None" in function "__call__"
Type "Literal[3]" is not assignable to type "Iterable[Unknown] | None"
"Literal[3]" is not assignable to "None"
"Literal[3]" is incompatible with protocol "Iterable[Unknown]"
"__iter__" is not present (reportArgumentType)
temp.py:10:24 - error: No overloads for "__call__" match the provided arguments (reportCallIssue)
temp.py:10:37 - error: Argument of type "Literal[3]" cannot be assigned to parameter "nbunch" of type "Iterable[Unknown] | None" in function "__call__"
Type "Literal[3]" is not assignable to type "Iterable[Unknown] | None"
"Literal[3]" is not assignable to "None"
"Literal[3]" is incompatible with protocol "Iterable[Unknown]"
"__iter__" is not present (reportArgumentType)
4 errors, 0 warnings, 0 informations
Metadata
Metadata
Assignees
Labels
priority: regressionSomething that worked before doesn't work anymoreSomething that worked before doesn't work anymorestubs: false positiveType checkers report false errorsType checkers report false errors