unsafe_enable_checks#

metatensor.unsafe_enable_checks()[source]#

Enable metatensor checks.

Checks are default enabled. Calling this function permanatly enables all metatensor operations checks.

>>> import metatensor
>>> metatensor.unsafe_enable_checks()
checks enabled
>>> print(metatensor.checks_enabled())
True

You can also use a compound statement to enable checks only temporarily. This can be useful in nested constructions.

>>> import metatensor
>>> print(metatensor.checks_enabled())
True
>>> with metatensor.unsafe_disable_checks():
...     # checks are disabled here
...     print(metatensor.checks_enabled())
...     with metatensor.unsafe_enable_checks():
...         # checks enabled here again
...         print(metatensor.checks_enabled())
...
False
True
>>> print(metatensor.checks_enabled())
True