# Path: prestans/exception.py
# class Base(Exception):
# class UnsupportedVocabularyError(Base):
# class UnsupportedContentTypeError(Base):
# class ValidationError(Base):
# class HandlerException(Base):
# class RequestException(HandlerException):
# class ResponseException(HandlerException):
# class UnimplementedVerbError(RequestException):
# class NoEndpointError(RequestException):
# class AuthenticationError(RequestException):
# class AuthorizationError(RequestException):
# class SerializationFailedError(RequestException):
# class DeSerializationFailedError(RequestException):
# class AttributeFilterDiffers(RequestException):
# class InconsistentPersistentDataError(Base):
# class DataValidationException(Base):
# class RequiredAttributeError(DataValidationException):
# class ParseFailedError(DataValidationException):
# class LessThanMinimumError(DataValidationException):
# class MoreThanMaximumError(DataValidationException):
# class InvalidChoiceError(DataValidationException):
# class MinimumLengthError(DataValidationException):
# class MaximumLengthError(DataValidationException):
# class InvalidTypeError(DataValidationException):
# class MissingParameterError(DataValidationException):
# class InvalidFormatError(DataValidationException):
# class InvalidMetaValueError(DataValidationException):
# class UnregisteredAdapterError(DataValidationException):
# class ServiceUnavailable(ResponseException):
# class BadRequest(ResponseException):
# class Conflict(ResponseException):
# class NotFound(ResponseException):
# class Unauthorized(ResponseException):
# class MovedPermanently(ResponseException):
# class Redirect(ResponseException):
# class TemporaryRedirect(Redirect):
# class PermanentRedirect(Redirect):
# class PaymentRequired(ResponseException):
# class Forbidden(ResponseException):
# class InternalServerError(ResponseException):
#     def __init__(self, http_status, message):
#     def http_status(self):
#     def http_status(self, value):
#     def stack_trace(self):
#     def push_trace(self, trace_object):
#     def message(self):
#     def __str__(self):
#     def __init__(self, accept_header, supported_types):
#     def __init__(self, requested_mime_type, content_type):
#     def __init__(self, message, attribute_name, value, blueprint):
#     def append_validation_trace(self, blueprint):
#     def __str__(self):
#     def __init__(self, code, message):
#     def request(self):
#     def request(self, value):
#     def log_message(self):
#     def __str__(self):
#     def __init__(self, code, message):
#     def __init__(self, code, message, response_model=None):
#     def response_model(self):
#     def __init__(self, verb_name):
#     def __init__(self):
#     def __init__(self, message=None):
#     def __init__(self, role_name):
#     def __init__(self, format):
#     def __init__(self, format):
#     def __init__(self, attribute_list):
#     def __init__(self, attribute_name, exception_message):
#     def __str__(self):
#     def __init__(self, message):
#     def __init__(self):
#     def __init__(self, message="Parser Failed"):
#     def __init__(self, value, allowed_min):
#     def __init__(self, value, allowed_max):
#     def __init__(self, value, allowed_choices):
#     def __init__(self, value, minimum):
#     def __init__(self, value, maximum):
#     def __init__(self, value, type_name):
#     def __init__(self):
#     def __init__(self, value):
#     def __init__(self):
#     def __init__(self, model_name):
#     def __init__(self, message="Service Unavailable", response_model=None):
#     def __init__(self, message="Bad Request", response_model=None):
#     def __init__(self, message="Conflict", response_model=None):
#     def __init__(self, message="Not Found", response_model=None):
#     def __init__(self, message="Unauthorized", response_model=None):
#     def __init__(self, message="Moved Permanently", response_model=None):
#     def __init__(self, code, url):
#     def url(self):
#     def __init__(self, url):
#     def __init__(self, url):
#     def __init__(self, message="Payment Required", response_model=None):
#     def __init__(self, message="Forbidden", response_model=None):
#     def __init__(self, message="Internal Server Error", response_model=None):
# 
# Path: prestans/types/base.py
# class DataType(object):
# 
#     def blueprint(self):
#         raise NotImplementedError
# 
#     def validate(self, value):
#         raise NotImplementedError


from prestans import exception
from prestans.types import DataType
            from prestans.util import integer_types
        constraints['default'] = self.default
        constraints['minimum'] = self.minimum
        constraints['maximum'] = self.maximum
        constraints['required'] = self.required
        constraints['choices'] = self.choices
        constraints['description'] = self.description

        blueprint['constraints'] = constraints

        return blueprint

    def validate(self, value):

        if not self._required and self._default is None and value is None:
            return None
        elif self._required and self._default is None and value is None:
            raise exception.RequiredAttributeError()
        elif self._default is not None and value is None:
            value = self._default

        try:

            if isinstance(value, integer_types):
                _validated_value = value
            else:
                _validated_value = int(value)
        except Exception:
            raise exception.ParseFailedError("encoding failed: value is not an integer or a long")

        if _validated_value is not None and self._minimum is not None and _validated_value < self._minimum:

# Path: prestans/exception.py
# class Base(Exception):
# class UnsupportedVocabularyError(Base):
# class UnsupportedContentTypeError(Base):
# class ValidationError(Base):
# class HandlerException(Base):
# class RequestException(HandlerException):
# class ResponseException(HandlerException):
# class UnimplementedVerbError(RequestException):
# class NoEndpointError(RequestException):
# class AuthenticationError(RequestException):
# class AuthorizationError(RequestException):
# class SerializationFailedError(RequestException):
# class DeSerializationFailedError(RequestException):
# class AttributeFilterDiffers(RequestException):
# class InconsistentPersistentDataError(Base):
# class DataValidationException(Base):
# class RequiredAttributeError(DataValidationException):
# class ParseFailedError(DataValidationException):
# class LessThanMinimumError(DataValidationException):
# class MoreThanMaximumError(DataValidationException):
# class InvalidChoiceError(DataValidationException):
# class MinimumLengthError(DataValidationException):
# class MaximumLengthError(DataValidationException):
# class InvalidTypeError(DataValidationException):
# class MissingParameterError(DataValidationException):
# class InvalidFormatError(DataValidationException):
# class InvalidMetaValueError(DataValidationException):
# class UnregisteredAdapterError(DataValidationException):
# class ServiceUnavailable(ResponseException):
# class BadRequest(ResponseException):
# class Conflict(ResponseException):
# class NotFound(ResponseException):
# class Unauthorized(ResponseException):
# class MovedPermanently(ResponseException):
# class Redirect(ResponseException):
# class TemporaryRedirect(Redirect):
# class PermanentRedirect(Redirect):
# class PaymentRequired(ResponseException):
# class Forbidden(ResponseException):
# class InternalServerError(ResponseException):
#     def __init__(self, http_status, message):
#     def http_status(self):
#     def http_status(self, value):
#     def stack_trace(self):
#     def push_trace(self, trace_object):
#     def message(self):
#     def __str__(self):
#     def __init__(self, accept_header, supported_types):
#     def __init__(self, requested_mime_type, content_type):
#     def __init__(self, message, attribute_name, value, blueprint):
#     def append_validation_trace(self, blueprint):
#     def __str__(self):
#     def __init__(self, code, message):
#     def request(self):
#     def request(self, value):
#     def log_message(self):
#     def __str__(self):
#     def __init__(self, code, message):
#     def __init__(self, code, message, response_model=None):
#     def response_model(self):
#     def __init__(self, verb_name):
#     def __init__(self):
#     def __init__(self, message=None):
#     def __init__(self, role_name):
#     def __init__(self, format):
#     def __init__(self, format):
#     def __init__(self, attribute_list):
#     def __init__(self, attribute_name, exception_message):
#     def __str__(self):
#     def __init__(self, message):
#     def __init__(self):
#     def __init__(self, message="Parser Failed"):
#     def __init__(self, value, allowed_min):
#     def __init__(self, value, allowed_max):
#     def __init__(self, value, allowed_choices):
#     def __init__(self, value, minimum):
#     def __init__(self, value, maximum):
#     def __init__(self, value, type_name):
#     def __init__(self):
#     def __init__(self, value):
#     def __init__(self):
#     def __init__(self, model_name):
#     def __init__(self, message="Service Unavailable", response_model=None):
#     def __init__(self, message="Bad Request", response_model=None):
#     def __init__(self, message="Conflict", response_model=None):
#     def __init__(self, message="Not Found", response_model=None):
#     def __init__(self, message="Unauthorized", response_model=None):
#     def __init__(self, message="Moved Permanently", response_model=None):
#     def __init__(self, code, url):
#     def url(self):
#     def __init__(self, url):
#     def __init__(self, url):
#     def __init__(self, message="Payment Required", response_model=None):
#     def __init__(self, message="Forbidden", response_model=None):
#     def __init__(self, message="Internal Server Error", response_model=None):
# 
# Path: prestans/types/base.py
# class DataType(object):
# 
#     def blueprint(self):
#         raise NotImplementedError
# 
#     def validate(self, value):
#         raise NotImplementedError


# Path: prestans/types/integer.py
from prestans import exception
from prestans.types import DataType
            from prestans.util import integer_types

        constraints['default'] = self.default
        constraints['minimum'] = self.minimum
        constraints['maximum'] = self.maximum
        constraints['required'] = self.required
        constraints['choices'] = self.choices
        constraints['description'] = self.description

        blueprint['constraints'] = constraints

        return blueprint

    def validate(self, value):

        if not self._required and self._default is None and value is None:
            return None
        elif self._required and self._default is None and value is None:
            raise exception.RequiredAttributeError()
        elif self._default is not None and value is None:
            value = self._default

        try:

            if isinstance(value, integer_types):
                _validated_value = value
            else:
                _validated_value = int(value)
        except Exception:
            raise exception.ParseFailedError("encoding failed: value is not an integer or a long")

        if _validated_value is not None and self._minimum is not None and _validated_value < self._minimum:

            raise exception.LessThanMinimumError(value, self._minimum)