From 35a7dd58c58e35be991fdce893e700ae6e0c910e Mon Sep 17 00:00:00 2001 From: Jussi Kukkonen Date: Fri, 28 Oct 2022 13:32:52 +0300 Subject: [PATCH] RequestsFetcher: satisfy mypy with small fix The typeshed annotations for requests say that the hostname could be None: I think this is untrue but let's keep mypy happy. Signed-off-by: Jussi Kukkonen --- tuf/ngclient/_internal/requests_fetcher.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tuf/ngclient/_internal/requests_fetcher.py b/tuf/ngclient/_internal/requests_fetcher.py index 5ddeef9d..35936780 100644 --- a/tuf/ngclient/_internal/requests_fetcher.py +++ b/tuf/ngclient/_internal/requests_fetcher.py @@ -121,7 +121,7 @@ def _get_session(self, url: str) -> requests.Session: if not parsed_url.scheme: raise exceptions.DownloadError(f"Failed to parse URL {url}") - session_index = (parsed_url.scheme, parsed_url.hostname) + session_index = (parsed_url.scheme, parsed_url.hostname or "") session = self._sessions.get(session_index) if not session: