From fec99eeb196ca09e207ae0cb7575a791fdc6a7a5 Mon Sep 17 00:00:00 2001 From: Sylvain Mouquet Date: Tue, 24 Sep 2024 17:31:11 +0200 Subject: [PATCH] fix: import + tests --- reattempt/__init__.py | 7 +------ test/test_reattempt.py | 2 +- uv.lock | 2 +- 3 files changed, 3 insertions(+), 8 deletions(-) diff --git a/reattempt/__init__.py b/reattempt/__init__.py index 47d5bcc..c030876 100644 --- a/reattempt/__init__.py +++ b/reattempt/__init__.py @@ -1,5 +1,5 @@ __version__ = "1.0.7" -__all__ = ["reattempt"] +__all__ = ("__version__", "reattempt") import asyncio import contextlib @@ -17,9 +17,6 @@ logger.addHandler(logging.NullHandler()) -def __call__(func, max_retries=CONST_DEFAULT_MAX_RETRIES, min_time=CONST_DEFAULT_MIN_TIME, max_time=CONST_DEFAULT_MAX_TIME): - return reattempt(func, max_retries, min_time, max_time) - def reattempt( func=None, max_retries: int = CONST_DEFAULT_MAX_RETRIES, @@ -199,5 +196,3 @@ async def retry_async_gen_func(*args, **kwargs): return decorator(func) return decorator -import sys -sys.modules[__name__] = reattempt diff --git a/test/test_reattempt.py b/test/test_reattempt.py index 43d443b..c3c2b24 100644 --- a/test/test_reattempt.py +++ b/test/test_reattempt.py @@ -1,7 +1,7 @@ from typing import AsyncGenerator import pytest -import reattempt +from reattempt import reattempt from test.conftest import MAX_ATTEMPTS, MIN_TIME, MAX_TIME, RetryException diff --git a/uv.lock b/uv.lock index 37fd794..fdbe315 100644 --- a/uv.lock +++ b/uv.lock @@ -94,7 +94,7 @@ wheels = [ [[package]] name = "reattempt" -version = "0.1.4" +version = "1.0.7" source = { editable = "." } [package.dev-dependencies]