[networkx] Cannot assign concrete types to `Graph[Hashable]`
Open
Nobody has claimed this yet.
stubs: false positive
- Dominant language
- Python
- Stars
- 5.1k
- Forks
- 2.1k
- Avg merge
- 1d 19h
- Merged PRs (30d)
- 82
Description
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]).
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
The issue names the networkx stubs and functions such as nx.number_of_selfloops, but no file or test. Start by locating those annotations and the Graph generic definition, then reproduce the Graph[int] assignment error. Done means affected APIs accept concrete Graph types without false-positive type errors, with regression coverage.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100