/usr/lib/imh-dnskeyapi/venv/lib/python3.13/site-packages/pip/_internal/utils
NameSizeModeActions
appdirs.py17050644editdlrm
compat.py23990644editdlrm
compatibility_tags.py66620644editdlrm
datetime.py2410644editdlrm
deprecation.py37070644editdlrm
direct_url_helpers.py31960644editdlrm
egg_link.py24630644editdlrm
entrypoints.py33250644editdlrm
filesystem.py49500644editdlrm
filetypes.py7150644editdlrm
glibc.py37340644editdlrm
hashes.py49720644editdlrm
logging.py120760644editdlrm
misc.py234500644editdlrm
packaging.py16030644editdlrm
retry.py13920644editdlrm
setuptools_build.py44820644editdlrm
subprocess.py89880644editdlrm
temp_dir.py93100644editdlrm
unpacking.py119260644editdlrm
urls.py15990644editdlrm
virtualenv.py34560644editdlrm
wheel.py44930644editdlrm
_jaraco_text.py33500644editdlrm
_log.py10150644editdlrm
__init__.py00644editdlrm
Edit: /usr/lib/imh-dnskeyapi/venv/lib/python3.13/site-packages/pip/_internal/utils/retry.py (1392B)
import functools from time import perf_counter, sleep from typing import Callable, TypeVar from pip._vendor.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