Skip to content

Commit

Permalink
add Retry.__call__ docstring
Browse files Browse the repository at this point in the history
  • Loading branch information
Anvil committed Dec 19, 2023
1 parent 300f029 commit 2730a41
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions kaioretry/decorator.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ class Retry:
:param logger: the :py:class:`logging.Logger` to which the log
messages will be sent to.
.. automethod:: __call__
"""

DEFAULT_LOGGER: Final[logging.Logger] = logging.getLogger(__name__)
Expand Down Expand Up @@ -312,6 +313,12 @@ def is_func_async(cls, func: Callable[FuncParam, Any]) \

def __call__(self, func: Callable[FuncParam, FuncRetVal]) \
-> Callable[FuncParam, FuncRetVal]:
"""Decorate a function the most accurately possible.
if ``func`` is a function that involves asyncio, use
:py:meth:`~kaioretry.decorator.Retry.aioretry`, else use
:py:meth:`~kaioretry.decorator.Retry.retry`.
"""
if self.is_func_async(func):
return cast(Callable[FuncParam, FuncRetVal], self.aioretry(func))
return self.retry(func)
Expand Down

0 comments on commit 2730a41

Please sign in to comment.