Modules that defines the package custom decorators displayed to user.

bredala.signaturedecorator.annotate(profiler, out, module_name, obj_code)[source]

Dump annotated input object source code with current profiling statistics to ‘out’ stream. Time unit is second.

Parameters:

profiler: pprofile.Profile (mandatory)

a profiler.

out: stream (mandatory)

destination of annotated input object source code.

module_name:

the name of the module of interest (used to filter the execution list).

obj_code: list of str (mandatory)

the source code of the object of interest (used to filter the execution list).

bredala.signaturedecorator.array_repr(array)[source]

Representation of a numpy array.

Parameters:

array: array (mandatory)

a numpy array.

Returns:

repr: str

the representation of the numpy array.

bredala.signaturedecorator.bredala_signature(obj, is_method=False, use_profiler=True, type_decorators=None)[source]

Create a decorator that display a function or a class method signature and execution time.

Parameters:

obj: callable (mandatory)

a function or a class method object.

is_method: bool (optional, default False)

True if the input object it a method of a class, False otherwise.

use_profiler: bool (optional, default True)

if True display the input object execution profile.

type_decorators: list of 2-uplet (optional, default None)

a list of decorator function, parameters ad tuple of types.

bredala.signaturedecorator.iter_repr(iter_obj)[source]

Representation of an iterable object.

Parameters:

iter_obj: list, set, tuple

an iterable object.

Returns:

repr: str

the representation of the iterable object.

bredala.signaturedecorator.object_repr(obj)[source]

Representation of a Pyton object.

Parameters:

obj: object

a Python object.

Returns:

obj_repr: str

the representation of the Python object.