You are viewing an older version (9.3.0). Go to latest (9.13.0)
{ } Raw JSON

bundles / IPython 9.3.0 / IPython / utils / decorators / flag_calls

function

IPython.utils.decorators:flag_calls

source: /IPython/utils/decorators.py :28

Signature

def   flag_calls ( func )

Summary

Wrap a function to detect and flag when it gets called.

Extended Summary

This is a decorator which takes a function and wraps it in a function with a 'called' attribute. wrapper.called is initialized to False.

The wrapper.called attribute is set to False right before each call to the wrapped function, so if the call fails it remains False. After the call completes, wrapper.called is set to True and the output is returned.

Testing for truth in wrapper.called allows you to determine if a call to func() was attempted and succeeded.

Aliases

  • IPython.utils.decorators.flag_calls