aboutsummaryrefslogtreecommitdiffhomepage
path: root/libs/retry/compat.py
blob: f39510d171630e16dcf48aa7b437e1a5506dda44 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import functools


try:
    from decorator import decorator
except ImportError:
    def decorator(caller):
        """ Turns caller into a decorator.
        Unlike decorator module, function signature is not preserved.

        :param caller: caller(f, *args, **kwargs)
        """
        def decor(f):
            @functools.wraps(f)
            def wrapper(*args, **kwargs):
                return caller(f, *args, **kwargs)
            return wrapper
        return decor