Representation package

Module contents

Module providing the toolset to build graphs of communicating entities.

class mcgdb.representation.Filterable(name)[source]

Bases: object

Parent class for filterable objects.

Subclasses should override methods get_parameters and add_return_values.

Variables:
add_return_values(data)[source]

Virtual method. Should add information from the return of the function call to data.

Parameters:data (dict) -- object returned by get_parameters
filterables = []
filters = {}
get_parameters()[source]

Virtual method. Should return the parameter of the function call.

Returns:parameters and values of the filterable function.
Return type:dict
has_after_filters()[source]
Returns:True if some after filters were registered for this object.
static register_filter(name, before=None, after=None)[source]

Registers a new filter.

Parameters:
  • name -- Name of the filter.
  • before (Callable(**params) --> Boolean) -- Filter function executed before the function call.
  • after (Callable(**params) --> Boolean) -- Filter function executed after the function call.
stop_after_filters(params)[source]

Tests if the execution should be stopped after the execution of the function.

Adds the return values from the subclass to the params object and apply before(**param).

Parameters:params -- parameters of the function call.
Returns:True if one of the after filter returned True, False otherwise.
stop_before_filters()[source]

Tests if the execution should be stopped before the execution of the function.

Gets the function parameters from the subclass and apply before(**param).

Returns:#1 True if one of the registered before filter return True, False otherwise.
Returns:#2 The parameters used for the filtering.
class mcgdb.representation.StopRequest(message=None, permanent=False, cb=None)[source]

Bases: object