If you have an expression like treq.get(…, headers={b"X-Test-Session": session.identifier}, …) mypy will reject it with an error like
Argument "headers" to "post" of "HTTPClient" has incompatible type "dict[bytes, str]"; expected "Headers | dict[bytes | str, bytes | str] | dict[bytes | str, list[bytes | str]] | None" [arg-type]
This is because the type is mutable, and must thus be affirmatively annotated as having a union of key type. We should loosen the constraint so that it can be identified idiomatically.
If you have an expression like
treq.get(…, headers={b"X-Test-Session": session.identifier}, …)mypy will reject it with an error likeThis is because the type is mutable, and must thus be affirmatively annotated as having a union of key type. We should loosen the constraint so that it can be identified idiomatically.