# Path: charms/reactive/trace.py
# def tracer():
#     global _tracer
#     return _tracer


import importlib
import os
import sys
import errno
import subprocess
from itertools import chain
from functools import partial
from charmhelpers.core import hookenv
from charmhelpers.core import unitdata
from charms.reactive.trace import tracer
LOG_OPTS = {
    'register': 'register' in _log_opts,
}


class BrokenHandlerException(Exception):
    def __init__(self, path):
        message = ("File at '{}' is marked as executable but "
                   "execution failed. Only handler files may be marked "
                   "as executable.".format(path))
        super(BrokenHandlerException, self).__init__(message)


def _action_id(action, suffix=None):
    if hasattr(action, '_action_id'):
        return action._action_id
    parts = [
        action.__code__.co_filename,
        action.__code__.co_firstlineno,
        action.__code__.co_name,
    ]
    if suffix is not None:
        parts.append(suffix)
    return ':'.join(map(str, parts))


def _short_action_id(action, suffix=None):
    if hasattr(action, '_short_action_id'):
        return action._short_action_id
    filepath = os.path.relpath(action.__code__.co_filename, hookenv.charm_dir())

# Path: charms/reactive/trace.py
# def tracer():
#     global _tracer
#     return _tracer


# Path: charms/reactive/bus.py
import importlib
import os
import sys
import errno
import subprocess
from itertools import chain
from functools import partial
from charmhelpers.core import hookenv
from charmhelpers.core import unitdata
from charms.reactive.trace import tracer

LOG_OPTS = {
    'register': 'register' in _log_opts,
}


class BrokenHandlerException(Exception):
    def __init__(self, path):
        message = ("File at '{}' is marked as executable but "
                   "execution failed. Only handler files may be marked "
                   "as executable.".format(path))
        super(BrokenHandlerException, self).__init__(message)


def _action_id(action, suffix=None):
    if hasattr(action, '_action_id'):
        return action._action_id
    parts = [
        action.__code__.co_filename,
        action.__code__.co_firstlineno,
        action.__code__.co_name,
    ]
    if suffix is not None:
        parts.append(suffix)
    return ':'.join(map(str, parts))


def _short_action_id(action, suffix=None):
    if hasattr(action, '_short_action_id'):
        return action._short_action_id
    filepath = os.path.relpath(action.__code__.co_filename, hookenv.charm_dir())

    parts = [