# Path: charms/reactive/flags.py
# @cmdline.subcommand()
# @cmdline.test_command
# def any_flags_set(*desired_flags):
#     """Assert that any of the desired_flags are set"""
#     active_flags = get_flags()
#     return any(flag in active_flags for flag in desired_flags)
# 
# @cmdline.subcommand()
# @cmdline.test_command
# def all_flags_set(*desired_flags):
#     """Assert that all desired_flags are set"""
#     active_flags = get_flags()
#     return all(flag in active_flags for flag in desired_flags)
# 
# Path: charms/reactive/flags.py
# @cmdline.subcommand()
# @cmdline.test_command
# def is_state(state):
#     """
#     .. deprecated:: 0.5.0
#        Alias for :func:`is_flag_set`"""
#     return is_flag_set(state)
# 
# @cmdline.subcommand()
# @cmdline.test_command
# def all_states(*desired_states):
#     """
#     .. deprecated:: 0.5.0
#        Alias for :func:`all_flags_set`"""
#     return all_flags_set(*desired_states)
# 
# @cmdline.subcommand()
# @cmdline.test_command
# def any_states(*desired_states):
#     """
#     .. deprecated:: 0.5.0
#        Alias for :func:`any_flags_set`"""
#     return any_flags_set(*desired_states)


import re
import json
import hashlib
from charmhelpers.core import host
from charmhelpers.core import hookenv
from charmhelpers.core import unitdata
from charmhelpers.cli import cmdline
from charms.reactive.flags import any_flags_set, all_flags_set
from charms.reactive.flags import is_state, all_states, any_states  # noqa
# Copyright 2014-2015 Canonical Limited.
#
# This file is part of charm-helpers.
#
# charm-helpers is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License version 3 as
# published by the Free Software Foundation.
#
# charm-helpers is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU Lesser General Public License for more details.
#
# 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/>.


# import deprecated functions for backwards compatibility


__all__ = [
    'data_changed',
    'is_data_changed',
    'any_file_changed',
]


def _expand_replacements(pat, subf, values):
    while any(pat.search(r) for r in values):
        new_values = []

# Path: charms/reactive/flags.py
# @cmdline.subcommand()
# @cmdline.test_command
# def any_flags_set(*desired_flags):
#     """Assert that any of the desired_flags are set"""
#     active_flags = get_flags()
#     return any(flag in active_flags for flag in desired_flags)
# 
# @cmdline.subcommand()
# @cmdline.test_command
# def all_flags_set(*desired_flags):
#     """Assert that all desired_flags are set"""
#     active_flags = get_flags()
#     return all(flag in active_flags for flag in desired_flags)
# 
# Path: charms/reactive/flags.py
# @cmdline.subcommand()
# @cmdline.test_command
# def is_state(state):
#     """
#     .. deprecated:: 0.5.0
#        Alias for :func:`is_flag_set`"""
#     return is_flag_set(state)
# 
# @cmdline.subcommand()
# @cmdline.test_command
# def all_states(*desired_states):
#     """
#     .. deprecated:: 0.5.0
#        Alias for :func:`all_flags_set`"""
#     return all_flags_set(*desired_states)
# 
# @cmdline.subcommand()
# @cmdline.test_command
# def any_states(*desired_states):
#     """
#     .. deprecated:: 0.5.0
#        Alias for :func:`any_flags_set`"""
#     return any_flags_set(*desired_states)


# Path: charms/reactive/helpers.py
import re
import json
import hashlib
from charmhelpers.core import host
from charmhelpers.core import hookenv
from charmhelpers.core import unitdata
from charmhelpers.cli import cmdline
from charms.reactive.flags import any_flags_set, all_flags_set
from charms.reactive.flags import is_state, all_states, any_states  # noqa

# Copyright 2014-2015 Canonical Limited.
#
# This file is part of charm-helpers.
#
# charm-helpers is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License version 3 as
# published by the Free Software Foundation.
#
# charm-helpers is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU Lesser General Public License for more details.
#
# 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/>.


# import deprecated functions for backwards compatibility


__all__ = [
    'data_changed',
    'is_data_changed',
    'any_file_changed',
]


def _expand_replacements(pat, subf, values):
    while any(pat.search(r) for r in values):
        new_values = []

        for value in values: