aboutsummaryrefslogtreecommitdiffstats
path: root/contrib
diff options
context:
space:
mode:
authorrobot-piglet <robot-piglet@yandex-team.com>2024-07-10 05:39:06 +0300
committerrobot-piglet <robot-piglet@yandex-team.com>2024-07-10 05:46:33 +0300
commit16c5a8ab94603b5245808b386e80d9ed1709a476 (patch)
tree7753553f12b26cd5539bfb1c6279de32435813fb /contrib
parent2990d778ea915b7f6db425ae7f643a044a3c5b99 (diff)
downloadydb-16c5a8ab94603b5245808b386e80d9ed1709a476.tar.gz
Intermediate changes
Diffstat (limited to 'contrib')
-rw-r--r--contrib/python/tenacity/py3/.dist-info/METADATA2
-rw-r--r--contrib/python/tenacity/py3/README.rst36
-rw-r--r--contrib/python/tenacity/py3/tenacity/__init__.py8
-rw-r--r--contrib/python/tenacity/py3/tenacity/asyncio/__init__.py13
-rw-r--r--contrib/python/tenacity/py3/ya.make2
5 files changed, 12 insertions, 49 deletions
diff --git a/contrib/python/tenacity/py3/.dist-info/METADATA b/contrib/python/tenacity/py3/.dist-info/METADATA
index f6d223471d..cd789a8975 100644
--- a/contrib/python/tenacity/py3/.dist-info/METADATA
+++ b/contrib/python/tenacity/py3/.dist-info/METADATA
@@ -1,6 +1,6 @@
Metadata-Version: 2.1
Name: tenacity
-Version: 8.5.0
+Version: 8.4.1
Summary: Retry code until it succeeds
Home-page: https://github.com/jd/tenacity
Author: Julien Danjou
diff --git a/contrib/python/tenacity/py3/README.rst b/contrib/python/tenacity/py3/README.rst
index 928ddd99b9..65dd208bdf 100644
--- a/contrib/python/tenacity/py3/README.rst
+++ b/contrib/python/tenacity/py3/README.rst
@@ -124,8 +124,8 @@ retrying stuff.
print("Stopping after 10 seconds")
raise Exception
-If you're on a tight deadline, and exceeding your delay time isn't ok,
-then you can give up on retries one attempt before you would exceed the delay.
+If you're on a tight deadline, and exceeding your delay time isn't ok,
+then you can give up on retries one attempt before you would exceed the delay.
.. testcode::
@@ -362,7 +362,7 @@ Statistics
~~~~~~~~~~
You can access the statistics about the retry made over a function by using the
-`statistics` attribute attached to the function:
+`retry` attribute attached to the function and its `statistics` attribute:
.. testcode::
@@ -375,7 +375,7 @@ You can access the statistics about the retry made over a function by using the
except Exception:
pass
- print(raise_my_exception.statistics)
+ print(raise_my_exception.retry.statistics)
.. testoutput::
:hide:
@@ -495,7 +495,7 @@ using the `retry_with` function attached to the wrapped function:
except Exception:
pass
- print(raise_my_exception.statistics)
+ print(raise_my_exception.retry.statistics)
.. testoutput::
:hide:
@@ -514,32 +514,6 @@ to use the `retry` decorator - you can instead use `Retrying` directly:
retryer = Retrying(stop=stop_after_attempt(max_attempts), reraise=True)
retryer(never_good_enough, 'I really do try')
-You may also want to change the behaviour of a decorated function temporarily,
-like in tests to avoid unnecessary wait times. You can modify/patch the `retry`
-attribute attached to the function. Bear in mind this is a write-only attribute,
-statistics should be read from the function `statistics` attribute.
-
-.. testcode::
-
- @retry(stop=stop_after_attempt(3), wait=wait_fixed(3))
- def raise_my_exception():
- raise MyException("Fail")
-
- from unittest import mock
-
- with mock.patch.object(raise_my_exception.retry, "wait", wait_fixed(0)):
- try:
- raise_my_exception()
- except Exception:
- pass
-
- print(raise_my_exception.statistics)
-
-.. testoutput::
- :hide:
-
- ...
-
Retrying code block
~~~~~~~~~~~~~~~~~~~
diff --git a/contrib/python/tenacity/py3/tenacity/__init__.py b/contrib/python/tenacity/py3/tenacity/__init__.py
index 02057a07c0..7de36d4345 100644
--- a/contrib/python/tenacity/py3/tenacity/__init__.py
+++ b/contrib/python/tenacity/py3/tenacity/__init__.py
@@ -329,19 +329,13 @@ class BaseRetrying(ABC):
f, functools.WRAPPER_ASSIGNMENTS + ("__defaults__", "__kwdefaults__")
)
def wrapped_f(*args: t.Any, **kw: t.Any) -> t.Any:
- # Always create a copy to prevent overwriting the local contexts when
- # calling the same wrapped functions multiple times in the same stack
- copy = self.copy()
- wrapped_f.statistics = copy.statistics # type: ignore[attr-defined]
- return copy(f, *args, **kw)
+ return self(f, *args, **kw)
def retry_with(*args: t.Any, **kwargs: t.Any) -> WrappedFn:
return self.copy(*args, **kwargs).wraps(f)
- # Preserve attributes
wrapped_f.retry = self # type: ignore[attr-defined]
wrapped_f.retry_with = retry_with # type: ignore[attr-defined]
- wrapped_f.statistics = {} # type: ignore[attr-defined]
return wrapped_f # type: ignore[return-value]
diff --git a/contrib/python/tenacity/py3/tenacity/asyncio/__init__.py b/contrib/python/tenacity/py3/tenacity/asyncio/__init__.py
index a92609140e..6d63ebcfab 100644
--- a/contrib/python/tenacity/py3/tenacity/asyncio/__init__.py
+++ b/contrib/python/tenacity/py3/tenacity/asyncio/__init__.py
@@ -175,23 +175,18 @@ class AsyncRetrying(BaseRetrying):
raise StopAsyncIteration
def wraps(self, fn: WrappedFn) -> WrappedFn:
- wrapped = super().wraps(fn)
+ fn = super().wraps(fn)
# Ensure wrapper is recognized as a coroutine function.
@functools.wraps(
fn, functools.WRAPPER_ASSIGNMENTS + ("__defaults__", "__kwdefaults__")
)
async def async_wrapped(*args: t.Any, **kwargs: t.Any) -> t.Any:
- # Always create a copy to prevent overwriting the local contexts when
- # calling the same wrapped functions multiple times in the same stack
- copy = self.copy()
- async_wrapped.statistics = copy.statistics # type: ignore[attr-defined]
- return await copy(fn, *args, **kwargs)
+ return await fn(*args, **kwargs)
# Preserve attributes
- async_wrapped.retry = self # type: ignore[attr-defined]
- async_wrapped.retry_with = wrapped.retry_with # type: ignore[attr-defined]
- async_wrapped.statistics = {} # type: ignore[attr-defined]
+ async_wrapped.retry = fn.retry # type: ignore[attr-defined]
+ async_wrapped.retry_with = fn.retry_with # type: ignore[attr-defined]
return async_wrapped # type: ignore[return-value]
diff --git a/contrib/python/tenacity/py3/ya.make b/contrib/python/tenacity/py3/ya.make
index 66c925dc76..d75e15b99f 100644
--- a/contrib/python/tenacity/py3/ya.make
+++ b/contrib/python/tenacity/py3/ya.make
@@ -2,7 +2,7 @@
PY3_LIBRARY()
-VERSION(8.5.0)
+VERSION(8.4.1)
LICENSE(Apache-2.0)