python / typeshed

Collection of library stubs for Python, with static types
Other
4.26k stars 1.72k forks source link

[networkx] Cannot assign concrete types to `Graph[Hashable]` #12186

Open EarlMilktea opened 2 months ago

EarlMilktea commented 2 months ago

Description

Several functions have arguments annotated as Graph[Hashable] or similar (ex. nx.number_of_selfloops).

As Graph is invariant, we encounter false-positive type errors when trying to assign concrete types (say Graph[int]).

benjamin-kirkbride commented 2 months ago

I just encountered this as well