# Path: charms/reactive/helpers.py
# def _expand_replacements(pat, subf, values):
# def any_hook(*hook_patterns):
# def any_file_changed(filenames, hash_type='md5'):
# def was_invoked(invocation_id):
# def mark_invoked(invocation_id):
# def _data_changed(data_id, data, hash_type, update):
# def data_changed(data_id, data, hash_type='md5'):
# def is_data_changed(data_id, data, hash_type='md5'):
# def _hook(hook_patterns):
# def _restricted_hook(hook_name):
# def _when_all(flags):
# def _when_any(flags):
# def _when_none(flags):
# def _when_not_all(flags):
# 
# Path: charms/reactive/bus.py
# LOG_OPTS = {
#     'register': 'register' in _log_opts,
# }
#     _HANDLERS = {}
#     _CONSUMED_FLAGS = set()
# class BrokenHandlerException(Exception):
# class Handler(object):
# class ExternalHandler(Handler):
# class FlagWatch(object):
#     def __init__(self, path):
# def _action_id(action, suffix=None):
# def _short_action_id(action, suffix=None):
#     def get(cls, action, suffix=None):
#     def get_handlers(cls):
#     def clear(cls):
#     def __init__(self, action, suffix=None):
#     def id(self):
#     def add_args(self, args):
#     def has_args(self):
#     def add_predicate(self, predicate):
#     def add_post_callback(self, callback):
#     def test(self):
#     def _get_args(self):
#     def invoke(self):
#     def register_flags(self, flags):
#     def register(cls, filepath):
#     def __init__(self, filepath):
#     def id(self):
#     def test(self):
#     def invoke(self):
#     def _store(cls):
#     def _get(cls):
#     def _set(cls, data):
#     def reset(cls):
#     def iteration(cls, i):
#     def watch(cls, watcher, flags):
#     def change(cls, flag):
#     def commit(cls):
# def dispatch(restricted=False):
#     def _test(to_test):
#     def _invoke(to_invoke):
# def discover():
# def _append_path(d):
# def _load_module(root, filepath):
# def _is_external_handler(filepath):
# def _register_handlers_from_file(root, filepath):


import os
import shlex
from charmhelpers.cli import cmdline
from charmhelpers.core import templating
from charms.reactive import helpers
from charms.reactive import bus
# You should have received a copy of the GNU Lesser General Public License
# along with charm-helpers.  If not, see <http://www.gnu.org/licenses/>.




@cmdline.subcommand()
@cmdline.test_command
def hook(*hook_patterns):
    """
    Check if the current hook matches one of the patterns.
    """
    return helpers._hook(hook_patterns)


@cmdline.subcommand()
@cmdline.test_command
def when(*desired_flags):
    """
    Alias of when_all.
    """
    return helpers._when_all(desired_flags)


@cmdline.subcommand()
@cmdline.test_command
def when_all(*desired_flags):
    """
    Check if all of the desired_flags are active and have changed.
    """

# Path: charms/reactive/helpers.py
# def _expand_replacements(pat, subf, values):
# def any_hook(*hook_patterns):
# def any_file_changed(filenames, hash_type='md5'):
# def was_invoked(invocation_id):
# def mark_invoked(invocation_id):
# def _data_changed(data_id, data, hash_type, update):
# def data_changed(data_id, data, hash_type='md5'):
# def is_data_changed(data_id, data, hash_type='md5'):
# def _hook(hook_patterns):
# def _restricted_hook(hook_name):
# def _when_all(flags):
# def _when_any(flags):
# def _when_none(flags):
# def _when_not_all(flags):
# 
# Path: charms/reactive/bus.py
# LOG_OPTS = {
#     'register': 'register' in _log_opts,
# }
#     _HANDLERS = {}
#     _CONSUMED_FLAGS = set()
# class BrokenHandlerException(Exception):
# class Handler(object):
# class ExternalHandler(Handler):
# class FlagWatch(object):
#     def __init__(self, path):
# def _action_id(action, suffix=None):
# def _short_action_id(action, suffix=None):
#     def get(cls, action, suffix=None):
#     def get_handlers(cls):
#     def clear(cls):
#     def __init__(self, action, suffix=None):
#     def id(self):
#     def add_args(self, args):
#     def has_args(self):
#     def add_predicate(self, predicate):
#     def add_post_callback(self, callback):
#     def test(self):
#     def _get_args(self):
#     def invoke(self):
#     def register_flags(self, flags):
#     def register(cls, filepath):
#     def __init__(self, filepath):
#     def id(self):
#     def test(self):
#     def invoke(self):
#     def _store(cls):
#     def _get(cls):
#     def _set(cls, data):
#     def reset(cls):
#     def iteration(cls, i):
#     def watch(cls, watcher, flags):
#     def change(cls, flag):
#     def commit(cls):
# def dispatch(restricted=False):
#     def _test(to_test):
#     def _invoke(to_invoke):
# def discover():
# def _append_path(d):
# def _load_module(root, filepath):
# def _is_external_handler(filepath):
# def _register_handlers_from_file(root, filepath):


# Path: charms/reactive/cli.py
import os
import shlex
from charmhelpers.cli import cmdline
from charmhelpers.core import templating
from charms.reactive import helpers
from charms.reactive import bus

# You should have received a copy of the GNU Lesser General Public License
# along with charm-helpers.  If not, see <http://www.gnu.org/licenses/>.




@cmdline.subcommand()
@cmdline.test_command
def hook(*hook_patterns):
    """
    Check if the current hook matches one of the patterns.
    """
    return helpers._hook(hook_patterns)


@cmdline.subcommand()
@cmdline.test_command
def when(*desired_flags):
    """
    Alias of when_all.
    """
    return helpers._when_all(desired_flags)


@cmdline.subcommand()
@cmdline.test_command
def when_all(*desired_flags):
    """
    Check if all of the desired_flags are active and have changed.
    """

    return helpers._when_all(desired_flags)