/opt/support/venv/lib/python3.13/site-packages/pip/_internal/utils
NameSizeModeActions
__pycache__/-0755rm
appdirs.py16810755editdlrm
compat.py25140755editdlrm
compatibility_tags.py66300755editdlrm
datetime.py8680755editdlrm
deprecation.py36960755editdlrm
direct_url_helpers.py32000755editdlrm
egg_link.py24590755editdlrm
entrypoints.py33240755editdlrm
filesystem.py68920755editdlrm
filetypes.py6890755editdlrm
glibc.py37260755editdlrm
hashes.py49980755editdlrm
logging.py134140755editdlrm
misc.py237220755editdlrm
packaging.py16010755editdlrm
pylock.py38170755editdlrm
retry.py14610755editdlrm
subprocess.py89830755editdlrm
temp_dir.py93070755editdlrm
unpacking.py129720755editdlrm
urls.py16010755editdlrm
virtualenv.py34550755editdlrm
wheel.py44680755editdlrm
_jaraco_text.py33500755editdlrm
_log.py10150755editdlrm
__init__.py00755editdlrm
Edit: /opt/support/venv/lib/python3.13/site-packages/pip/_internal/utils/retry.py (1461B)
from __future__ import annotations import functools from time import perf_counter, sleep from typing import TYPE_CHECKING, Callable, TypeVar if TYPE_CHECKING: from typing_extensions import ParamSpec T = TypeVar("T") P = ParamSpec("P") def retry( wait: float, stop_after_delay: float ) -> Callable[[Callable[P, T]], Callable[P, T]]: """Decorator to automatically retry a function on error. If the function raises, the function is recalled with the same arguments until it returns or the time limit is reached. When the time limit is surpassed, the last exception raised is reraised. :param wait: The time to wait after an error before retrying, in seconds. :param stop_after_delay: The time limit after which retries will cease, in seconds. """ def wrapper(func: Callable[P, T]) -> Callable[P, T]: @functools.wraps(func) def retry_wrapped(*args: P.args, **kwargs: P.kwargs) -> T: # The performance counter is monotonic on all platforms we care # about and has much better resolution than time.monotonic(). start_time = perf_counter() while True: try: return func(*args, **kwargs) except Exception: if perf_counter() - start_time > stop_after_delay: raise sleep(wait) return retry_wrapped return wrapper