pydecorium.decorators.ProfilerUtils#

To create a new profiler utils decorator, refer to the documentation How to create a profiler utils decorator.

class pydecorium.decorators.ProfilerUtils(*args, **kwargs)[source]#

ProfilerUtils class is a base class for utils of the pydecorium.decorators.FunctionProfiler class.

The subclasses must implement the following methods:

def pre_execute(func, *args, **kwargs) -> None:
    pass

def post_execute(func, *args, **kwargs) -> None:
    pass

def handle_result(self):
    pass

def string_value(self, result) -> str:
    pass

The subclasses must contain the following attributes:

  • data_name: str

    The name of the data collected by the profiler.

Note

The subclasses can also be used as a simple decorator that prints on the console the result.

handle_result()[source]#

Method to be implemented in subclasses.

post_execute(func, *args, **kwargs) None[source]#

Method to be implemented in subclasses.

pre_execute(func, *args, **kwargs) None[source]#

Method to be implemented in subclasses.

string_result(result) str[source]#

Converts the result in a string format.

Parameters:

result (Any) – The result to convert in a string format.

Returns:

The result in a string format.

Return type:

str

string_value(result) str[source]#

Method to be implemented in subclasses.