You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Type hint for TypeConversionDict.get is too limited #2988
foo.py:13:1: error: No overload variant of "get" of "TypeConversionDict" matches argument types "str", "Callable[[str], int]" [call-overload]
d.get("foo", type=parse_int)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
foo.py:13:1: note: Possible overload variants:
foo.py:13:1: note: def get(self, key: Any) -> Any | None
foo.py:13:1: note: def get(self, key: Any, default: Any) -> Any
foo.py:13:1: note: def [T] get(self, key: Any, default: T) -> Any | T
foo.py:13:1: note: def [T] get(self, key: str, type: type[T]) -> T | None
foo.py:13:1: note: def [T] get(self, key: str, default: T, type: type[T]) -> T
It seems like that the type hint for type is too limited and should also include callables as the docstring says
:param type: A callable that is used to cast the value in the
:class:`MultiDict`. If a :exc:`ValueError` or a
:exc:`TypeError` is raised by this callable the default
value is returned.
Activity