Module that sets the package decoration functions dynamically.

class bredala.decorations.Decorations[source]

A class that decorate a module functions based on the factory, ie. the ‘_modules’ mapping.

decorate(module, name, decorators_struct)[source]

Method that decorates the registered function and class methods of a module.

Parameters:

module: object (mandatory)

a python module object.

name: str (mandatory)

the name of the input module.

decorators_struct: dict of dict

a dictionary with the functions/methods to be decorated as first keys, the decorator type as second keys and the decorator - decorator parameters as values.

hack(module, name)[source]

Method invoked to transform the input module.

Parameters:

module: object (mandatory)

a python module object.

name: str (mandatory)

the name of the input module.

Returns:

decorated_module: object

if a decorator has been registered for this module in the registery return the decorated input python module object, otherwise directly the input python module object.

classmethod split_class(name)[source]

Split a module name.

Parameters:

name: str (mandatory)

a name describing a class or a class method: <klass> or <klass>.<method>.

Returns:

kname: str

the class name.

mname: str

the associated module name.