defer

glue.utils.misc.defer(*args, **kwds)[source]

Defer the calling of a method inside a context manager, and then call it 0 or 1 times afterwards.

Parameters:
  • instance – The instance of the method to defer
  • method (str) – The name of the method to defer

Within the context block, calls to the method will be intercepted, logged, and skipped.

Upon exiting the context block, the method will be invoked a single time, with the arguments of the most recent invokation inside the context block.

If the method is never invoked in the context block, it is not called when leaving that block.