Decorator framework and common decorators for python.


Install
pip install decorated==1.9.9

Documentation

Python decorators are very powerful but sometimes a little tricky to write Decorators themself could be implemented as functions or classes. Some decorators should be called with arguments, some are not, and some can be used with or without arguments. It is useful to get the arguments of the target function in the decorators. But figuring out which aregument is for which parameter is not an easy task. Things get even messier when you try to wrap a function with multiple decorators.

This is where decorated comes to rescue. Decorated solves all the above problems by providing a unified framework for writing decorators. It also provides some built-in decorators that you may find helpful to your daily work.

1. Basic

2. Advanced

    2.1. Accessing target function arguments

    2.2. Chaining decorators

    2.3. Decorators on class methods

    2.4. Wrapper Decorator

3. Built-in decorators

    3.1. cache

    3.2. conditional

    3.3. events

    3.4. once

    3.5. profile

    3.6. remove_extra_args

    3.7. retries

    3.8. synchronized

    3.9. timeit

    3.10. timeout

4. Loggingd