fsl.utils.assertions
This module contains a handful of miscellaneous assertion routines.
The disabled() context manager can be used to temporarily disable
assertion checks.
- fsl.utils.assertions._DISABLE_ASSERTIONS = 0
Semaphore used by the
disabled()context manager.
- fsl.utils.assertions.disabled(disable=True)[source]
Context manager which allows assertion checks to be temporarily disabled.
If calls to this function are nested, only one of the calls need to be made with
disable=Truefor assertions to be disabled; any other calls which are part of the call stack which setdisable=Falsewill have no effect.- Parameters:
disable – Set to
True(the default) to disable assertions, orFalseto enable them.
- fsl.utils.assertions._canDisable(func)[source]
Decorator used on assertion functions, allowing them to be disabled via the
disabled()context manager.