# Path: lepo/apidef/parameter/base.py
# NO_VALUE = object()
# 
# Path: lepo/excs.py
# class ErroneousParameters(Exception):
#     def __init__(self, error_map, parameters):
#         self.errors = error_map
#         self.parameters = parameters
# 
# class MissingParameter(ValueError):
#     pass


import base64
import iso8601
from django.core.exceptions import ImproperlyConfigured
from django.utils.encoding import force_bytes, force_str
from lepo.apidef.parameter.base import NO_VALUE
from lepo.excs import ErroneousParameters, MissingParameter




def cast_primitive_value(type, format, value):
    if type == 'boolean':
        return (force_str(value).lower() in ('1', 'yes', 'true'))
    if type == 'integer' or format in ('integer', 'long'):
        return int(value)

# Path: lepo/apidef/parameter/base.py
# NO_VALUE = object()
# 
# Path: lepo/excs.py
# class ErroneousParameters(Exception):
#     def __init__(self, error_map, parameters):
#         self.errors = error_map
#         self.parameters = parameters
# 
# class MissingParameter(ValueError):
#     pass


# Path: lepo/parameter_utils.py
import base64
import iso8601
from django.core.exceptions import ImproperlyConfigured
from django.utils.encoding import force_bytes, force_str
from lepo.apidef.parameter.base import NO_VALUE
from lepo.excs import ErroneousParameters, MissingParameter





def cast_primitive_value(type, format, value):
    if type == 'boolean':
        return (force_str(value).lower() in ('1', 'yes', 'true'))
    if type == 'integer' or format in ('integer', 'long'):
        return int(value)

    if type == 'number' or format in ('float', 'double'):