With the following example code:
from requests.adapters import HTTPAdapter
class TimeoutHTTPAdapter(HTTPAdapter):
"""
An HTTP Adapter that allows a session level timeout for both read and connect attributes.
This prevents interruption to reads that happen as a function of time or istio resets that
causes our applications to sit and wait forever on a half open socket.
"""
def harf(x: TimeoutHTTPAdapter | None) -> None:
if x is not None:
x.close()
This issue leads to the following mypy complaint:
error: Call to untyped function "close" in typed context [no-untyped-call]
Looking at the source for requests, this method returns None, and has done so since at least version 1.0.0.
With the following example code:
This issue leads to the following
mypycomplaint:Looking at the source for
requests, this method returnsNone, and has done so since at least version 1.0.0.