API Reference

easy_deco.decorator(declared_decorator)

Create a decorator out of a function, which will be used as a wrapper.

Snippet code

>>> from easy_deco import decorator
>>> @decorator
>>> def func():
        "Define function"

Then, su can use your func as a decorator with other function

Snnipet code

>>> @func
>>> def another_func():
        "Define another function"
easy_deco.progress_bar(func, *args, **kwargs)

This decorator allows to you add a progress bar in any function where you want to process any iterable object


Parameters

  • desc: key word argument (kwargs) (str) Progress bar description
  • unit: key word argument (kwargs) (str) unit measurement, if you reading a list of files so you can use Files so you will get in the progress bar 'Files/s' when it is charging

Snippet code

>>> from easy_deco import progress_bar
>>> @progress_bar(desc='Loading files...', unit='files')
>>> def read_files(self, filenames):

        read_file(filenames)
easy_deco.raise_error(func, args, kwargs)

This decorator help you to wrap any function to catch any error raised in the function body

Snippet code

>>> from easy_deco import raise_error
>>> @raise_error
>>> def func():
        "Function body"