# 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
# 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:
            m = pat.search(value)
            if not m:
                new_values.append(value)
                continue
            whole_match = m.group(0)
            selected_groups = m.groups()
            for replacement in subf(*selected_groups):
                # have to replace one match at a time, or we'll lose combinations
                # e.g., '{A,B}{A,B}' would turn to ['AA', 'BB'] instead of
                # ['A{A,B}', 'B{A,B}'] -> ['AA', 'AB', 'BA', 'BB']
                new_values.append(value.replace(whole_match, replacement, 1))
        values = new_values
    return values


@cmdline.subcommand()

# 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

# 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:
            m = pat.search(value)
            if not m:
                new_values.append(value)
                continue
            whole_match = m.group(0)
            selected_groups = m.groups()
            for replacement in subf(*selected_groups):
                # have to replace one match at a time, or we'll lose combinations
                # e.g., '{A,B}{A,B}' would turn to ['AA', 'BB'] instead of
                # ['A{A,B}', 'B{A,B}'] -> ['AA', 'AB', 'BA', 'BB']
                new_values.append(value.replace(whole_match, replacement, 1))
        values = new_values
    return values


@cmdline.subcommand()

@cmdline.test_command