def _func_takes_last_result(waiter): if not six.callable(waiter): return False if isinstance(waiter, wait_base): waiter = waiter.__call__ waiter_spec = _utils.getargspec(waiter) return 'last_result' in waiter_spec.args
def _func_takes_call_state(func): if not six.callable(func): return False if isinstance(func, wait_base): func = func.__call__ func_spec = _utils.getargspec(func) return 'call_state' in func_spec.args
def func_takes_retry_state(func): if not six.callable(func): return False if not inspect.isfunction(func): # func is a callable object rather than a function func = func.__call__ func_spec = _utils.getargspec(func) return 'retry_state' in func_spec.args
def func_takes_retry_state(func): if not six.callable(func): raise Exception(func) return False if not inspect.isfunction(func) and not inspect.ismethod(func): # func is a callable object rather than a function/method func = func.__call__ func_spec = _utils.getargspec(func) return 'retry_state' in func_spec.args
def func_takes_last_result(waiter): """Check if function has a "last_result" parameter. Needed to provide backward compatibility for wait functions that didn't take "last_result" in the beginning. """ if not six.callable(waiter): return False if not inspect.isfunction(waiter) and not inspect.ismethod(waiter): # waiter is a class, check dunder-call rather than dunder-init. waiter = waiter.__call__ waiter_spec = _utils.getargspec(waiter) return 'last_result' in waiter_spec.args