2023-01-13 02:28:26 +00:00
|
|
|
# SPDX-License-Identifier: MIT
|
2023-01-12 01:04:47 +00:00
|
|
|
|
|
|
|
__all__ = ["set_run_validators", "get_run_validators"]
|
|
|
|
|
|
|
|
_run_validators = True
|
|
|
|
|
|
|
|
|
|
|
|
def set_run_validators(run):
|
|
|
|
"""
|
|
|
|
Set whether or not validators are run. By default, they are run.
|
2023-01-13 02:28:26 +00:00
|
|
|
|
|
|
|
.. deprecated:: 21.3.0 It will not be removed, but it also will not be
|
|
|
|
moved to new ``attrs`` namespace. Use `attrs.validators.set_disabled()`
|
|
|
|
instead.
|
2023-01-12 01:04:47 +00:00
|
|
|
"""
|
|
|
|
if not isinstance(run, bool):
|
2023-10-07 23:21:06 +00:00
|
|
|
msg = "'run' must be bool."
|
|
|
|
raise TypeError(msg)
|
2023-01-12 01:04:47 +00:00
|
|
|
global _run_validators
|
|
|
|
_run_validators = run
|
|
|
|
|
|
|
|
|
|
|
|
def get_run_validators():
|
|
|
|
"""
|
|
|
|
Return whether or not validators are run.
|
2023-01-13 02:28:26 +00:00
|
|
|
|
|
|
|
.. deprecated:: 21.3.0 It will not be removed, but it also will not be
|
|
|
|
moved to new ``attrs`` namespace. Use `attrs.validators.get_disabled()`
|
|
|
|
instead.
|
2023-01-12 01:04:47 +00:00
|
|
|
"""
|
|
|
|
return _run_validators
|