Closed
Description
After updating mypy
from 0.630
to 0.650
for Klein, I get this error:
src/klein/_headers.py:172:18: error: Argument "converter" to "attrib" has incompatible type "Callable[[Iterable[Iterable[bytes]]], Sequence[Tuple[bytes, bytes]]]"; expected "Optional[Callable[[Any], Tuple[]]]"
If I'm reading this correctly, the provided converter is a Callable
(OK) and takes one argument (OK) and returns a Sequence
(not OK: Tuple
expected).
The converter specified in src/klein/_headers.py:172 is normalizeRawHeadersFrozen
:
def normalizeRawHeadersFrozen(headerPairs):
# type: (Iterable[Iterable[bytes]]) -> RawHeaders
return tuple(normalizeRawHeaders(headerPairs))
This implementation does return a tuple
, but I wanted to limit my commitment to a Sequence
. I think that converter
should be happy with a Sequence
in practice, so I'd like to lobby for a looser requirement here.