hookit

class tollan.utils.hookit(obj, name: str)[source]

Bases: contextlib.ContextDecorator

A context manager that allow inject code to object’s method.

Parameters
objobject

The object to alter.

namestr

The name of the method to hook.

Methods Summary

set_post_func(func)

Call func after the hooked function.

Methods Documentation

set_post_func(func)[source]

Call func after the hooked function.

Parameters
funccallable

The function to call after the hooked function.