# Path: apis/v1/schemas.py
# class Current(object):
# class Security(object):
#     class DataWrapper(object):
#     def __init__(self):
#     def scopes(self):
#     def scopes_loader(self, func):
# def merge_default(schema, value, get_first=True):
# def normalize(schema, data, required_defaults=None):
#         def __init__(self, data):
#         def get(self, key, default=None):
#         def has(self, key):
#         def keys(self):
#         def get_check(self, key, default=None):
#     def _merge_dict(src, dst):
#     def _normalize_dict(schema, data):
#     def _normalize_list(schema, data):
#     def _normalize_default(schema, data):
#     def _normalize(schema, data):


import re
import json
import six
from datetime import date
from functools import wraps
from sanic import response
from sanic.exceptions import ServerError
from sanic.response import HTTPResponse
from werkzeug.datastructures import MultiDict, Headers
from sanic.request import RequestParameters
from jsonschema import Draft4Validator
from .schemas import (
    validators, filters, scopes, security, base_path, normalize, current)
        from inspect import isawaitable

        if isawaitable(resp):
            resp = await resp
        if isinstance(resp, HTTPResponse):
            return resp

        endpoint = _path_to_endpoint(request.uri_template)
        method = request.method
        if method == 'HEAD':
            method = 'GET'
        filter = filters.get((endpoint, method), None)
        if not filter:
            return resp

        headers = None
        status = None
        if isinstance(resp, tuple):
            resp, status, headers = unpack(resp)

        if len(filter) == 1:
            if six.PY3:
                status = list(filter.keys())[0]
            else:
                status = filter.keys()[0]

        schemas = filter.get(status)
        if not schemas:
            # return resp, status, headers
            raise ServerError('`%d` is not a defined status code.' % status, 500)


# Path: apis/v1/schemas.py
# class Current(object):
# class Security(object):
#     class DataWrapper(object):
#     def __init__(self):
#     def scopes(self):
#     def scopes_loader(self, func):
# def merge_default(schema, value, get_first=True):
# def normalize(schema, data, required_defaults=None):
#         def __init__(self, data):
#         def get(self, key, default=None):
#         def has(self, key):
#         def keys(self):
#         def get_check(self, key, default=None):
#     def _merge_dict(src, dst):
#     def _normalize_dict(schema, data):
#     def _normalize_list(schema, data):
#     def _normalize_default(schema, data):
#     def _normalize(schema, data):


# Path: apis/v1/validators.py
import re
import json
import six
from datetime import date
from functools import wraps
from sanic import response
from sanic.exceptions import ServerError
from sanic.response import HTTPResponse
from werkzeug.datastructures import MultiDict, Headers
from sanic.request import RequestParameters
from jsonschema import Draft4Validator
from .schemas import (
    validators, filters, scopes, security, base_path, normalize, current)
        from inspect import isawaitable


        if isawaitable(resp):
            resp = await resp
        if isinstance(resp, HTTPResponse):
            return resp

        endpoint = _path_to_endpoint(request.uri_template)
        method = request.method
        if method == 'HEAD':
            method = 'GET'
        filter = filters.get((endpoint, method), None)
        if not filter:
            return resp

        headers = None
        status = None
        if isinstance(resp, tuple):
            resp, status, headers = unpack(resp)

        if len(filter) == 1:
            if six.PY3:
                status = list(filter.keys())[0]
            else:
                status = filter.keys()[0]

        schemas = filter.get(status)
        if not schemas:
            # return resp, status, headers
            raise ServerError('`%d` is not a defined status code.' % status, 500)


        resp, errors = normalize(schemas['schema'], resp)