From 9de17bd5ae2bdbb9157edc25126df69c89665e79 Mon Sep 17 00:00:00 2001 From: Philip Dexter Date: Mon, 10 Jan 2022 11:58:23 +0200 Subject: [PATCH] Fix urllib3.util.Retry.sleep type (#6883) --- stubs/urllib3/@tests/stubtest_allowlist.txt | 4 ---- stubs/urllib3/urllib3/util/retry.pyi | 3 ++- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/stubs/urllib3/@tests/stubtest_allowlist.txt b/stubs/urllib3/@tests/stubtest_allowlist.txt index 62961f894..220aadc65 100644 --- a/stubs/urllib3/@tests/stubtest_allowlist.txt +++ b/stubs/urllib3/@tests/stubtest_allowlist.txt @@ -9,7 +9,6 @@ urllib3.ProxyManager.__init__ urllib3.ProxyManager.connection_from_host urllib3.ProxyManager.urlopen urllib3.Retry.is_forced_retry -urllib3.Retry.sleep urllib3._collections.HTTPHeaderDict.from_httplib urllib3._collections.HTTPHeaderDict.getlist urllib3._collections.RLock @@ -25,7 +24,6 @@ urllib3.connectionpool.HTTPSConnection.__init__ urllib3.connectionpool.HTTPSConnectionPool.__init__ urllib3.connectionpool.RequestMethods.request_encode_url urllib3.connectionpool.Retry.is_forced_retry -urllib3.connectionpool.Retry.sleep urllib3.connectionpool.VerifiedHTTPSConnection.__init__ urllib3.connectionpool.VerifiedHTTPSConnection.set_cert urllib3.fields.RequestField.__init__ @@ -43,10 +41,8 @@ urllib3.poolmanager.ProxyManager.urlopen urllib3.request.RequestMethods.request_encode_url urllib3.response.BrotliDecoder urllib3.util.Retry.is_forced_retry -urllib3.util.Retry.sleep urllib3.util.connection.poll urllib3.util.connection.select urllib3.util.retry.Retry.is_forced_retry -urllib3.util.retry.Retry.sleep urllib3.util.ssl_.create_default_context urllib3.util.ssl_.ssl_wrap_socket diff --git a/stubs/urllib3/urllib3/util/retry.pyi b/stubs/urllib3/urllib3/util/retry.pyi index c4aedaa6c..d119a9207 100644 --- a/stubs/urllib3/urllib3/util/retry.pyi +++ b/stubs/urllib3/urllib3/util/retry.pyi @@ -1,6 +1,7 @@ from typing import Any from .. import exceptions +from ..response import HTTPResponse ConnectTimeoutError = exceptions.ConnectTimeoutError MaxRetryError = exceptions.MaxRetryError @@ -43,7 +44,7 @@ class Retry: @classmethod def from_int(cls, retries, redirect=..., default=...): ... def get_backoff_time(self): ... - def sleep(self): ... + def sleep(self, response: HTTPResponse | None = ...) -> None: ... def is_forced_retry(self, method, status_code): ... def is_exhausted(self): ... def increment(self, method=..., url=..., response=..., error=..., _pool=..., _stacktrace=...): ...