Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
""" Rules that are evaluated on any field, regardless whether defined in
the schema or not.
Type: :class:`tuple` """
priority_validations = ('nullable', 'readonly', 'type', 'empty')
""" Rules that will be processed in that order before any other.
Type: :class:`tuple` """
types_mapping = {
'binary': TypeDefinition('binary', (bytes, bytearray), ()),
'boolean': TypeDefinition('boolean', (bool,), ()),
'container': TypeDefinition('container', (Container,), (_str_type,)),
'date': TypeDefinition('date', (date,), ()),
'datetime': TypeDefinition('datetime', (datetime,), ()),
'dict': TypeDefinition('dict', (Mapping,), ()),
'float': TypeDefinition('float', (float, _int_types), ()),
'integer': TypeDefinition('integer', (_int_types,), ()),
'list': TypeDefinition('list', (Sequence,), (_str_type,)),
'number': TypeDefinition('number', (_int_types, float), (bool,)),
'set': TypeDefinition('set', (set,), ()),
'string': TypeDefinition('string', (_str_type), ()),
}
""" This mapping holds all available constraints for the type rule and
their assigned :class:`~cerberus.TypeDefinition`. """
_valid_schemas = set()
""" A :class:`set` of hashes derived from validation schemas that are
legit for a particular ``Validator`` class. """
def __init__(self, *args, **kwargs):
""" The arguments will be treated as with this signature:
__init__(self, schema=None, ignore_none_values=False,
allow_unknown=False, purge_unknown=False,
error_handler=errors.BasicErrorHandler)
:class:`tuple`
""" # noqa: E501
mandatory_validations = ('nullable',)
""" Rules that are evaluated on any field, regardless whether defined in
the schema or not.
Type: :class:`tuple` """
priority_validations = ('nullable', 'readonly', 'type', 'empty')
""" Rules that will be processed in that order before any other.
Type: :class:`tuple` """
types_mapping = {
'binary': TypeDefinition('binary', (bytes, bytearray), ()),
'boolean': TypeDefinition('boolean', (bool,), ()),
'container': TypeDefinition('container', (Container,), (_str_type,)),
'date': TypeDefinition('date', (date,), ()),
'datetime': TypeDefinition('datetime', (datetime,), ()),
'dict': TypeDefinition('dict', (Mapping,), ()),
'float': TypeDefinition('float', (float, _int_types), ()),
'integer': TypeDefinition('integer', (_int_types,), ()),
'list': TypeDefinition('list', (Sequence,), (_str_type,)),
'number': TypeDefinition('number', (_int_types, float), (bool,)),
'set': TypeDefinition('set', (set,), ()),
'string': TypeDefinition('string', (_str_type), ()),
}
""" This mapping holds all available constraints for the type rule and
their assigned :class:`~cerberus.TypeDefinition`. """
_valid_schemas = set()
""" A :class:`set` of hashes derived from validation schemas that are
legit for a particular ``Validator`` class. """
def __init__(self, *args, **kwargs):
""" The arguments will be treated as with this signature:
priority_validations = ('nullable', 'readonly', 'type', 'empty')
""" Rules that will be processed in that order before any other.
Type: :class:`tuple` """
types_mapping = {
'binary': TypeDefinition('binary', (bytes, bytearray), ()),
'boolean': TypeDefinition('boolean', (bool,), ()),
'container': TypeDefinition('container', (Container,), (_str_type,)),
'date': TypeDefinition('date', (date,), ()),
'datetime': TypeDefinition('datetime', (datetime,), ()),
'dict': TypeDefinition('dict', (Mapping,), ()),
'float': TypeDefinition('float', (float, _int_types), ()),
'integer': TypeDefinition('integer', (_int_types,), ()),
'list': TypeDefinition('list', (Sequence,), (_str_type,)),
'number': TypeDefinition('number', (_int_types, float), (bool,)),
'set': TypeDefinition('set', (set,), ()),
'string': TypeDefinition('string', (_str_type), ()),
}
""" This mapping holds all available constraints for the type rule and
their assigned :class:`~cerberus.TypeDefinition`. """
_valid_schemas = set()
""" A :class:`set` of hashes derived from validation schemas that are
legit for a particular ``Validator`` class. """
def __init__(self, *args, **kwargs):
""" The arguments will be treated as with this signature:
__init__(self, schema=None, ignore_none_values=False,
allow_unknown=False, require_all=False,
purge_unknown=False, purge_readonly=False,
error_handler=errors.BasicErrorHandler)
"""
"""
from __future__ import absolute_import
from cerberus.validator import DocumentError, Validator
from cerberus.schema import rules_set_registry, schema_registry, SchemaError
from cerberus.utils import TypeDefinition
__version__ = "1.2"
__all__ = [
DocumentError.__name__,
SchemaError.__name__,
TypeDefinition.__name__,
Validator.__name__,
'schema_registry',
'rules_set_registry',
]
initialization of the error handler.
Default: :class:`~cerberus.errors.BasicErrorHandler`.
:type error_handler: class or instance based on
:class:`~cerberus.errors.BaseErrorHandler` or
:class:`tuple`
""" # noqa: E501
mandatory_validations = ('nullable',)
""" Rules that are evaluated on any field, regardless whether defined in
the schema or not.
Type: :class:`tuple` """
priority_validations = ('nullable', 'readonly', 'type', 'empty')
""" Rules that will be processed in that order before any other.
Type: :class:`tuple` """
types_mapping = {
'binary': TypeDefinition('binary', (bytes, bytearray), ()),
'boolean': TypeDefinition('boolean', (bool,), ()),
'container': TypeDefinition('container', (Container,), (_str_type,)),
'date': TypeDefinition('date', (date,), ()),
'datetime': TypeDefinition('datetime', (datetime,), ()),
'dict': TypeDefinition('dict', (Mapping,), ()),
'float': TypeDefinition('float', (float, _int_types), ()),
'integer': TypeDefinition('integer', (_int_types,), ()),
'list': TypeDefinition('list', (Sequence,), (_str_type,)),
'number': TypeDefinition('number', (_int_types, float), (bool,)),
'set': TypeDefinition('set', (set,), ()),
'string': TypeDefinition('string', (_str_type), ()),
}
""" This mapping holds all available constraints for the type rule and
their assigned :class:`~cerberus.TypeDefinition`. """
_valid_schemas = set()
""" A :class:`set` of hashes derived from validation schemas that are
Default: :class:`~cerberus.errors.BasicErrorHandler`.
:type error_handler: class or instance based on
:class:`~cerberus.errors.BaseErrorHandler` or
:class:`tuple`
""" # noqa: E501
mandatory_validations = ('nullable',)
""" Rules that are evaluated on any field, regardless whether defined in
the schema or not.
Type: :class:`tuple` """
priority_validations = ('nullable', 'readonly', 'type', 'empty')
""" Rules that will be processed in that order before any other.
Type: :class:`tuple` """
types_mapping = {
'binary': TypeDefinition('binary', (bytes, bytearray), ()),
'boolean': TypeDefinition('boolean', (bool,), ()),
'container': TypeDefinition('container', (Container,), (_str_type,)),
'date': TypeDefinition('date', (date,), ()),
'datetime': TypeDefinition('datetime', (datetime,), ()),
'dict': TypeDefinition('dict', (Mapping,), ()),
'float': TypeDefinition('float', (float, _int_types), ()),
'integer': TypeDefinition('integer', (_int_types,), ()),
'list': TypeDefinition('list', (Sequence,), (_str_type,)),
'number': TypeDefinition('number', (_int_types, float), (bool,)),
'set': TypeDefinition('set', (set,), ()),
'string': TypeDefinition('string', (_str_type), ()),
}
""" This mapping holds all available constraints for the type rule and
their assigned :class:`~cerberus.TypeDefinition`. """
_valid_schemas = set()
""" A :class:`set` of hashes derived from validation schemas that are
legit for a particular ``Validator`` class. """
mandatory_validations = ('nullable',)
""" Rules that are evaluated on any field, regardless whether defined in
the schema or not.
Type: :class:`tuple` """
priority_validations = ('nullable', 'readonly', 'type', 'empty')
""" Rules that will be processed in that order before any other.
Type: :class:`tuple` """
types_mapping = {
'binary': TypeDefinition('binary', (bytes, bytearray), ()),
'boolean': TypeDefinition('boolean', (bool,), ()),
'container': TypeDefinition('container', (Container,), (_str_type,)),
'date': TypeDefinition('date', (date,), ()),
'datetime': TypeDefinition('datetime', (datetime,), ()),
'dict': TypeDefinition('dict', (Mapping,), ()),
'float': TypeDefinition('float', (float, _int_types), ()),
'integer': TypeDefinition('integer', (_int_types,), ()),
'list': TypeDefinition('list', (Sequence,), (_str_type,)),
'number': TypeDefinition('number', (_int_types, float), (bool,)),
'set': TypeDefinition('set', (set,), ()),
'string': TypeDefinition('string', (_str_type), ()),
}
""" This mapping holds all available constraints for the type rule and
their assigned :class:`~cerberus.TypeDefinition`. """
_valid_schemas = set()
""" A :class:`set` of hashes derived from validation schemas that are
legit for a particular ``Validator`` class. """
def __init__(self, *args, **kwargs):
""" The arguments will be treated as with this signature:
__init__(self, schema=None, ignore_none_values=False,
allow_unknown=False, require_all=False,
Type: :class:`tuple` """
priority_validations = ('nullable', 'readonly', 'type', 'empty')
""" Rules that will be processed in that order before any other.
Type: :class:`tuple` """
types_mapping = {
'binary': TypeDefinition('binary', (bytes, bytearray), ()),
'boolean': TypeDefinition('boolean', (bool,), ()),
'container': TypeDefinition('container', (Container,), (_str_type,)),
'date': TypeDefinition('date', (date,), ()),
'datetime': TypeDefinition('datetime', (datetime,), ()),
'dict': TypeDefinition('dict', (Mapping,), ()),
'float': TypeDefinition('float', (float, _int_types), ()),
'integer': TypeDefinition('integer', (_int_types,), ()),
'list': TypeDefinition('list', (Sequence,), (_str_type,)),
'number': TypeDefinition('number', (_int_types, float), (bool,)),
'set': TypeDefinition('set', (set,), ()),
'string': TypeDefinition('string', (_str_type), ()),
}
""" This mapping holds all available constraints for the type rule and
their assigned :class:`~cerberus.TypeDefinition`. """
_valid_schemas = set()
""" A :class:`set` of hashes derived from validation schemas that are
legit for a particular ``Validator`` class. """
def __init__(self, *args, **kwargs):
""" The arguments will be treated as with this signature:
__init__(self, schema=None, ignore_none_values=False,
allow_unknown=False, require_all=False,
purge_unknown=False, purge_readonly=False,
error_handler=errors.BasicErrorHandler)
"""
:class:`~cerberus.errors.BaseErrorHandler` or
:class:`tuple`
""" # noqa: E501
mandatory_validations = ('nullable',)
""" Rules that are evaluated on any field, regardless whether defined in
the schema or not.
Type: :class:`tuple` """
priority_validations = ('nullable', 'readonly', 'type', 'empty')
""" Rules that will be processed in that order before any other.
Type: :class:`tuple` """
types_mapping = {
'binary': TypeDefinition('binary', (bytes, bytearray), ()),
'boolean': TypeDefinition('boolean', (bool,), ()),
'container': TypeDefinition('container', (Container,), (_str_type,)),
'date': TypeDefinition('date', (date,), ()),
'datetime': TypeDefinition('datetime', (datetime,), ()),
'dict': TypeDefinition('dict', (Mapping,), ()),
'float': TypeDefinition('float', (float, _int_types), ()),
'integer': TypeDefinition('integer', (_int_types,), ()),
'list': TypeDefinition('list', (Sequence,), (_str_type,)),
'number': TypeDefinition('number', (_int_types, float), (bool,)),
'set': TypeDefinition('set', (set,), ()),
'string': TypeDefinition('string', (_str_type), ()),
}
""" This mapping holds all available constraints for the type rule and
their assigned :class:`~cerberus.TypeDefinition`. """
_valid_schemas = set()
""" A :class:`set` of hashes derived from validation schemas that are
legit for a particular ``Validator`` class. """
def __init__(self, *args, **kwargs):