set_default_safety#
- t3toolbox.safety.set_default_safety(rtol_numpy=DEFAULT_RTOL_NUMPY, rtol_jax=DEFAULT_RTOL_JAX)#
def set_default_safety(rtol_numpy=DEFAULT_RTOL_NUMPY, rtol_jax=DEFAULT_RTOL_JAX):
Set the safety tolerances for the current context. Prefer the
safe()/unsafe()context managers for scoped changes; use this for a script-level default.set_default_safety(None, None)makes unsafe the default (the only script-level way to do so;unsafe()is a context manager). Otherwise both tolerances must be positive numbers – a loneNoneis rejected here rather than failing inside the first precondition check.Scope: a
contextvarsvariable, so the setting applies to the current context – the calling thread, or the current asyncio task and the tasks it spawns afterwards. Threads started before or independently see the module default (safe); set it in each thread, or use the context managers.