# Path: tuskar/openstack/common/gettextutils.py
# def _(msg):
#     return _t.ugettext(msg)
# 
# Path: tuskar/openstack/common/importutils.py
# def import_class(import_str):
# def import_object(import_str, *args, **kwargs):
# def import_object_ns(name_space, import_str, *args, **kwargs):
# def import_module(import_str):
# def try_import(import_str, default=None):
# 
# Path: tuskar/openstack/common/jsonutils.py
# def to_primitive(value, convert_instances=False, convert_datetime=True,
#                  level=0, max_depth=3):
# def dumps(value, default=to_primitive, **kwargs):
# def loads(s):
# def load(s):
# 
# Path: tuskar/openstack/common/local.py
# class WeakLocal(corolocal.local):
#     def __getattribute__(self, attr):
#     def __setattr__(self, attr, value):
# 
# Path: tuskar/openstack/common/log.py
# _DEFAULT_LOG_DATE_FORMAT = "%Y-%m-%d %H:%M:%S"
# CONF = cfg.CONF
#     LEVEL_COLORS = {
#         logging.DEBUG: '\033[00;32m',  # GREEN
#         logging.INFO: '\033[00;36m',  # CYAN
#         logging.AUDIT: '\033[01;36m',  # BOLD CYAN
#         logging.WARN: '\033[01;33m',  # BOLD YELLOW
#         logging.ERROR: '\033[01;31m',  # BOLD RED
#         logging.CRITICAL: '\033[01;31m',  # BOLD RED
#     }
#     class NullHandler(logging.Handler):
# class BaseLoggerAdapter(logging.LoggerAdapter):
# class LazyAdapter(BaseLoggerAdapter):
# class ContextAdapter(BaseLoggerAdapter):
# class JSONFormatter(logging.Formatter):
# class LogConfigError(Exception):
# class WritableLogger(object):
# class ContextFormatter(logging.Formatter):
# class ColorHandler(logging.StreamHandler):
# class DeprecatedConfig(Exception):
#         def handle(self, record):
#         def emit(self, record):
#         def createLock(self):
# def _dictify_context(context):
# def _get_binary_name():
# def _get_log_file_path(binary=None):
#     def audit(self, msg, *args, **kwargs):
#     def __init__(self, name='unknown', version='unknown'):
#     def logger(self):
#     def __init__(self, logger, project_name, version_string):
#     def handlers(self):
#     def deprecated(self, msg, *args, **kwargs):
#     def process(self, msg, kwargs):
#     def __init__(self, fmt=None, datefmt=None):
#     def formatException(self, ei, strip_newlines=True):
#     def format(self, record):
# def _create_logging_excepthook(product_name):
#     def logging_excepthook(type, value, tb):
#     def __init__(self, log_config, err_msg):
#     def __str__(self):
# def _load_log_config(log_config):
# def setup(product_name):
# def set_defaults(logging_context_format_string):
# def _find_facility_from_conf():
# def _setup_logging_from_conf():
# def getLogger(name='unknown', version='unknown'):
# def getLazyLogger(name='unknown', version='unknown'):
#     def __init__(self, logger, level=logging.INFO):
#     def write(self, msg):
#     def format(self, record):
#     def formatException(self, exc_info, record=None):
#     def format(self, record):
#     def __init__(self, msg):


import copy
import sys
import traceback
import six
from oslo.config import cfg
from tuskar.openstack.common.gettextutils import _
from tuskar.openstack.common import importutils
from tuskar.openstack.common import jsonutils
from tuskar.openstack.common import local
from tuskar.openstack.common import log as logging
        # the __str__ method.
        failure.__class__ = new_ex_type
    except TypeError:
        # NOTE(ameade): If a core exception then just add the traceback to the
        # first exception argument.
        failure.args = (message,) + failure.args[1:]
    return failure


class CommonRpcContext(object):
    def __init__(self, **kwargs):
        self.values = kwargs

    def __getattr__(self, key):
        try:
            return self.values[key]
        except KeyError:
            raise AttributeError(key)

    def to_dict(self):
        return copy.deepcopy(self.values)

    @classmethod
    def from_dict(cls, values):
        return cls(**values)

    def deepcopy(self):
        return self.from_dict(self.to_dict())

    def update_store(self):

# Path: tuskar/openstack/common/gettextutils.py
# def _(msg):
#     return _t.ugettext(msg)
# 
# Path: tuskar/openstack/common/importutils.py
# def import_class(import_str):
# def import_object(import_str, *args, **kwargs):
# def import_object_ns(name_space, import_str, *args, **kwargs):
# def import_module(import_str):
# def try_import(import_str, default=None):
# 
# Path: tuskar/openstack/common/jsonutils.py
# def to_primitive(value, convert_instances=False, convert_datetime=True,
#                  level=0, max_depth=3):
# def dumps(value, default=to_primitive, **kwargs):
# def loads(s):
# def load(s):
# 
# Path: tuskar/openstack/common/local.py
# class WeakLocal(corolocal.local):
#     def __getattribute__(self, attr):
#     def __setattr__(self, attr, value):
# 
# Path: tuskar/openstack/common/log.py
# _DEFAULT_LOG_DATE_FORMAT = "%Y-%m-%d %H:%M:%S"
# CONF = cfg.CONF
#     LEVEL_COLORS = {
#         logging.DEBUG: '\033[00;32m',  # GREEN
#         logging.INFO: '\033[00;36m',  # CYAN
#         logging.AUDIT: '\033[01;36m',  # BOLD CYAN
#         logging.WARN: '\033[01;33m',  # BOLD YELLOW
#         logging.ERROR: '\033[01;31m',  # BOLD RED
#         logging.CRITICAL: '\033[01;31m',  # BOLD RED
#     }
#     class NullHandler(logging.Handler):
# class BaseLoggerAdapter(logging.LoggerAdapter):
# class LazyAdapter(BaseLoggerAdapter):
# class ContextAdapter(BaseLoggerAdapter):
# class JSONFormatter(logging.Formatter):
# class LogConfigError(Exception):
# class WritableLogger(object):
# class ContextFormatter(logging.Formatter):
# class ColorHandler(logging.StreamHandler):
# class DeprecatedConfig(Exception):
#         def handle(self, record):
#         def emit(self, record):
#         def createLock(self):
# def _dictify_context(context):
# def _get_binary_name():
# def _get_log_file_path(binary=None):
#     def audit(self, msg, *args, **kwargs):
#     def __init__(self, name='unknown', version='unknown'):
#     def logger(self):
#     def __init__(self, logger, project_name, version_string):
#     def handlers(self):
#     def deprecated(self, msg, *args, **kwargs):
#     def process(self, msg, kwargs):
#     def __init__(self, fmt=None, datefmt=None):
#     def formatException(self, ei, strip_newlines=True):
#     def format(self, record):
# def _create_logging_excepthook(product_name):
#     def logging_excepthook(type, value, tb):
#     def __init__(self, log_config, err_msg):
#     def __str__(self):
# def _load_log_config(log_config):
# def setup(product_name):
# def set_defaults(logging_context_format_string):
# def _find_facility_from_conf():
# def _setup_logging_from_conf():
# def getLogger(name='unknown', version='unknown'):
# def getLazyLogger(name='unknown', version='unknown'):
#     def __init__(self, logger, level=logging.INFO):
#     def write(self, msg):
#     def format(self, record):
#     def formatException(self, exc_info, record=None):
#     def format(self, record):
#     def __init__(self, msg):


# Path: tuskar/openstack/common/rpc/common.py
import copy
import sys
import traceback
import six
from oslo.config import cfg
from tuskar.openstack.common.gettextutils import _
from tuskar.openstack.common import importutils
from tuskar.openstack.common import jsonutils
from tuskar.openstack.common import local
from tuskar.openstack.common import log as logging

        # the __str__ method.
        failure.__class__ = new_ex_type
    except TypeError:
        # NOTE(ameade): If a core exception then just add the traceback to the
        # first exception argument.
        failure.args = (message,) + failure.args[1:]
    return failure


class CommonRpcContext(object):
    def __init__(self, **kwargs):
        self.values = kwargs

    def __getattr__(self, key):
        try:
            return self.values[key]
        except KeyError:
            raise AttributeError(key)

    def to_dict(self):
        return copy.deepcopy(self.values)

    @classmethod
    def from_dict(cls, values):
        return cls(**values)

    def deepcopy(self):
        return self.from_dict(self.to_dict())

    def update_store(self):

        local.store.context = self