Repository navigation
requests: allow non-mutable Mapping for files/hooks parameters - #7732
Conversation
|
Thanks for all your work on this! |
|
thank you! i tried digging but am not well versed in the ways of how tests work in |
|
Typeshed doesn't do much tests in the usual sense. There has been a lot of discussion about this, but in short, we don't want to duplicate information that is already specified in the stubs. For standard library stubs, we have mypy-primer, which runs mypy across many open-source projects on each new PR and posts a diff of mypy outputs as a comment. It would work very well for problems like this. Unfortunately it is currently not being used for third-party stubs, see hauntsaninja/mypy_primer#7. |
|
Though we do have a few |
|
FYI This breaks |
Now it is, and regressions like this are much less likely to happen: hauntsaninja/mypy_primer#31 |
Another one 😒 still an issue with #7724 . Problem is
MutableMappingis invariant, so the union type will actually never match.Changed it to
Mapping(which is covariant in the value type) now. It doesn't seem to be mutated anywhere, I also passedfrozendictto try. Also tried assigning adict[str, BufferedReader]to it as in the issue, which passes the type check now.Same problem would occur in
_Hooks, so changed that one too. Kept_TextMappingas-is because it requiresstr(would still fail on a subtype ofstr).