# Path: aodh/api/controllers/v2/base.py
# class ClientSideError(wsme.exc.ClientSideError):
# class ProjectNotAuthorized(ClientSideError):
# class AdvEnum(wtypes.wsproperty):
# class Base(wtypes.DynamicBase):
# class Query(Base):
# class AlarmNotFound(ClientSideError):
# class AlarmRule(Base):
#     def __init__(self, error, status_code=400):
#     def __init__(self, id, aspect='project'):
#     def __init__(self, name, *args, **kwargs):
#     def _get(self, parent):
#     def _set(self, parent, value):
#     def from_db_model(cls, m):
#     def from_db_and_links(cls, m, links):
#     def as_dict(self, db_model):
#     def as_dict_from_keys(self, keys):
#     def to_dict(self):
#     def get_op(self):
#     def set_op(self, value):
#     def __repr__(self):
#     def sample(cls):
#     def as_dict(self):
#     def get_value(self, forced_type=None):
#     def __init__(self, alarm, auth_project):
#     def validate_alarm(alarm):
#     def create_hook(alarm):
#     def update_hook(alarm):
# 
# Path: aodh/profiler.py
# LOG = log.getLogger(__name__)
# class WsgiMiddleware(object):
#     def __init__(self, application, **kwargs):
#     def factory(cls, global_conf, **local_conf):
#         def filter_(app):
#     def __call__(self, request):
# def setup(conf):
# def trace_cls(name, **kwargs):
#     def decorator(cls):


import pecan
import wsmeext.pecan as wsme_pecan
from pecan import rest
from wsme import types as wtypes
from aodh.api.controllers.v2 import base
from aodh import profiler
        for key, value in sorted(input.items()):
            temp[_decode_unicode(key)] = _decode_unicode(value)
        return temp
    elif isinstance(input, (tuple, list)):
        # When doing a pair of JSON encode/decode operations to the tuple,
        # the tuple would become list. So we have to generate the value as
        # list here.
        return [_decode_unicode(element) for element in input]
    elif isinstance(input, str):
        return input.encode('utf-8')
    else:
        return input


def _recursive_keypairs(d, separator=':'):
    """Generator that produces sequence of keypairs for nested dictionaries."""
    for name, value in sorted(d.items()):
        if isinstance(value, dict):
            for subname, subvalue in _recursive_keypairs(value, separator):
                yield ('%s%s%s' % (name, separator, subname), subvalue)
        elif isinstance(value, (tuple, list)):
            yield name, _decode_unicode(value)
        else:
            yield name, value


def _flatten_capabilities(capabilities):
    return dict((k, v) for k, v in _recursive_keypairs(capabilities))



# Path: aodh/api/controllers/v2/base.py
# class ClientSideError(wsme.exc.ClientSideError):
# class ProjectNotAuthorized(ClientSideError):
# class AdvEnum(wtypes.wsproperty):
# class Base(wtypes.DynamicBase):
# class Query(Base):
# class AlarmNotFound(ClientSideError):
# class AlarmRule(Base):
#     def __init__(self, error, status_code=400):
#     def __init__(self, id, aspect='project'):
#     def __init__(self, name, *args, **kwargs):
#     def _get(self, parent):
#     def _set(self, parent, value):
#     def from_db_model(cls, m):
#     def from_db_and_links(cls, m, links):
#     def as_dict(self, db_model):
#     def as_dict_from_keys(self, keys):
#     def to_dict(self):
#     def get_op(self):
#     def set_op(self, value):
#     def __repr__(self):
#     def sample(cls):
#     def as_dict(self):
#     def get_value(self, forced_type=None):
#     def __init__(self, alarm, auth_project):
#     def validate_alarm(alarm):
#     def create_hook(alarm):
#     def update_hook(alarm):
# 
# Path: aodh/profiler.py
# LOG = log.getLogger(__name__)
# class WsgiMiddleware(object):
#     def __init__(self, application, **kwargs):
#     def factory(cls, global_conf, **local_conf):
#         def filter_(app):
#     def __call__(self, request):
# def setup(conf):
# def trace_cls(name, **kwargs):
#     def decorator(cls):


# Path: aodh/api/controllers/v2/capabilities.py
import pecan
import wsmeext.pecan as wsme_pecan
from pecan import rest
from wsme import types as wtypes
from aodh.api.controllers.v2 import base
from aodh import profiler

        for key, value in sorted(input.items()):
            temp[_decode_unicode(key)] = _decode_unicode(value)
        return temp
    elif isinstance(input, (tuple, list)):
        # When doing a pair of JSON encode/decode operations to the tuple,
        # the tuple would become list. So we have to generate the value as
        # list here.
        return [_decode_unicode(element) for element in input]
    elif isinstance(input, str):
        return input.encode('utf-8')
    else:
        return input


def _recursive_keypairs(d, separator=':'):
    """Generator that produces sequence of keypairs for nested dictionaries."""
    for name, value in sorted(d.items()):
        if isinstance(value, dict):
            for subname, subvalue in _recursive_keypairs(value, separator):
                yield ('%s%s%s' % (name, separator, subname), subvalue)
        elif isinstance(value, (tuple, list)):
            yield name, _decode_unicode(value)
        else:
            yield name, value


def _flatten_capabilities(capabilities):
    return dict((k, v) for k, v in _recursive_keypairs(capabilities))



class Capabilities(base.Base):