privex.helpers.decorators

Class Method / Function decorators

Copyright:

    +===================================================+
    |                 © 2019 Privex Inc.                |
    |               https://www.privex.io               |
    +===================================================+
    |                                                   |
    |        Originally Developed by Privex Inc.        |
    |        License: X11 / MIT                         |
    |                                                   |
    |        Core Developer(s):                         |
    |                                                   |
    |          (+)  Chris (@someguy123) [Privex]        |
    |          (+)  Kale (@kryogenic) [Privex]          |
    |                                                   |
    +===================================================+

Copyright 2019     Privex Inc.   ( https://www.privex.io )

Functions

async_retry([max_retries, delay])

AsyncIO coroutine compatible version of retry_on_err() - for painless automatic retry-on-exception for async code.

mock_decorator(*dec_args, **dec_kwargs)

This decorator is a pass-through decorator which does nothing other than be a decorator.

r_cache(cache_key[, cache_time, …])

This is a decorator which caches the result of the wrapped function with the global cache adapter from privex.helpers.cache using the key cache_key and with an expiry of cache_time seconds.

r_cache_async(cache_key[, cache_time, …])

Async function/method compatible version of r_cache() - see docs for r_cache()

retry_on_err([max_retries, delay])

Decorates a function or class method, wraps the function/method with a try/catch block, and will automatically re-run the function with the same arguments up to max_retries time after any exception is raised, with a delay second delay between re-tries.

Classes

FO

alias of privex.helpers.decorators.FormatOpt

FormatOpt(value)

This enum represents various options available for r_cache() ‘s format_opt parameter.