(self, method)
return wrapper
Throttle caller method.
Throttle caller method.
Throttle caller method .
def __call__(self, method):
        """Throttle caller method."""

        def throttle_method():
            """Call when method is throttled."""
            return None

        @wraps(method)
        def wrapper(*args, **kwargs):
            """Wrap that checks for throttling."""
            force = kwargs.pop("force", False)
            now = int(time.time())
            last_call_delta = now - self.last_call
            if force or last_call_delta > self.throttle_time:
                result = method(*args, *kwargs)
                self.last_call = now
                return result

            return throttle_method()

        return wrapper
def __call__ ( self , method ) : def throttle_method ( ) : """Call when method is throttled.""" return None @ wraps ( method ) def wrapper ( * args , * * kwargs ) : """Wrap that checks for throttling.""" force = kwargs . pop ( "force" , False ) now = int ( time . time ( ) ) last_call_delta = now - self . last_call if force or last_call_delta > self . throttle_time : result = method ( * args , * kwargs ) self . last_call = now return result return throttle_method ( ) return wrapper