How to use the tenacity._utils function in tenacity

To help you get started, we’ve selected a few tenacity examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github jd / tenacity / tenacity / after.py View on Github external
def log_it(func, trial_number, trial_time_taken):
        logger.log(log_level, log_tpl,
                   _utils.get_callback_name(func), trial_time_taken,
                   _utils.to_ordinal(trial_number))
github jd / tenacity / tenacity / __init__.py View on Github external
    @_utils.cached_property
    def wait(self):
        return _compat.wait_func_accept_retry_state(self._wait)
github jd / tenacity / tenacity / __init__.py View on Github external
    @_utils.cached_property
    def stop(self):
        return _compat.stop_func_accept_retry_state(self._stop)
github aiogram / bot / app / utils / before_start.py View on Github external
def after_log(retry_state):
    logger.info(
        "Finished call to {callback!r} after {time:.2f}, this was the {attempt} time calling it.",
        callback=_utils.get_callback_name(retry_state.fn),
        time=retry_state.seconds_since_start,
        attempt=_utils.to_ordinal(retry_state.attempt_number),
    )
github jd / tenacity / tenacity / __init__.py View on Github external
def begin(self, fn):
        self.statistics.clear()
        self.statistics['start_time'] = _utils.now()
        self.statistics['attempt_number'] = 1
        self.statistics['idle_for'] = 0
        self.fn = fn