Change venv
This commit is contained in:
@@ -16,6 +16,8 @@
|
||||
import abc
|
||||
import typing
|
||||
|
||||
from pip._vendor.tenacity import _utils
|
||||
|
||||
if typing.TYPE_CHECKING:
|
||||
import threading
|
||||
|
||||
@@ -36,6 +38,9 @@ class stop_base(abc.ABC):
|
||||
return stop_any(self, other)
|
||||
|
||||
|
||||
StopBaseT = typing.Union[stop_base, typing.Callable[["RetryCallState"], bool]]
|
||||
|
||||
|
||||
class stop_any(stop_base):
|
||||
"""Stop if any of the stop condition is valid."""
|
||||
|
||||
@@ -89,8 +94,10 @@ class stop_after_attempt(stop_base):
|
||||
class stop_after_delay(stop_base):
|
||||
"""Stop when the time from the first attempt >= limit."""
|
||||
|
||||
def __init__(self, max_delay: float) -> None:
|
||||
self.max_delay = max_delay
|
||||
def __init__(self, max_delay: _utils.time_unit_type) -> None:
|
||||
self.max_delay = _utils.to_seconds(max_delay)
|
||||
|
||||
def __call__(self, retry_state: "RetryCallState") -> bool:
|
||||
if retry_state.seconds_since_start is None:
|
||||
raise RuntimeError("__call__() called but seconds_since_start is not set")
|
||||
return retry_state.seconds_since_start >= self.max_delay
|
||||
|
Reference in New Issue
Block a user