networkx: Update usages of `SupportsGetItem` that should be more restrictive
Checked against the implementation to see when SupportsGetItem wasn't enough.
Will also reduce changes from #14038
CC @darabos since you added most of these in #13458 . Feel free to re-validate against the implementation.
According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉
According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉
According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉
I'm not a fan of replacing protocols with ABCs, especially if they're as broad as Mapping. Can't we use broader protocols?
I can re-review usage. Mixing mapping-based protocols is quite annoying at the moment (without Protocol Intersection), and we may be getting too close to implementation details, where I'm not sure it's worth creating new (and/or combined) protocols just for this. But I'll see.
My main beef with Mapping (and Sequence) is that it's not a protocol. Maybe it would make sense to add a MappingLike protocol to _typeshed that includes commonly used methods (like __getitem__, keys etc.).
Thanks. And I think you meant https://github.com/python/typeshed/pull/15152