# Path: dnf/module/exceptions.py
# class EnableMultipleStreamsException(dnf.exceptions.Error):
#     def __init__(self, module_spec, value=None):
#         if value is None:
#             value = _("Cannot enable more streams from module '{}' at the same time").format(module_spec)
#         super(EnableMultipleStreamsException, self).__init__(value)
# 
# Path: dnf/util.py
# MAIN_PROG = argparse.ArgumentParser().prog if argparse.ArgumentParser().prog == "yum" else "dnf"
# MAIN_PROG_UPPER = MAIN_PROG.upper()
# def _parse_specs(namespace, values):
# def _urlopen_progress(url, conf, progress=None):
# def _urlopen(url, conf=None, repo=None, mode='w+b', **kwargs):
# def rtrim(s, r):
# def am_i_root():
# def clear_dir(path):
# def ensure_dir(dname):
# def split_path(path):
# def empty(iterable):
# def first(iterable):
# def first_not_none(iterable):
# def file_age(fn):
# def file_timestamp(fn):
# def get_effective_login():
# def get_in(dct, keys, not_found):
# def group_by_filter(fn, iterable):
#     def splitter(acc, item):
# def insert_if(item, iterable, condition):
# def is_exhausted(iterator):
# def is_glob_pattern(pattern):
# def is_string_type(obj):
# def lazyattr(attrname):
#     def get_decorated(fn):
#         def cached_getter(obj):
# def mapall(fn, *seq):
# def normalize_time(timestamp):
# def on_ac_power():
# def on_metered_connection():
# def partition(pred, iterable):
# def rm_rf(path):
# def split_by(iterable, condition):
#     def next_subsequence(it):
# def strip_prefix(s, prefix):
# def touch(path, no_create=False):
# def _terminal_messenger(tp='write', msg="", out=sys.stdout):
# def _format_resolve_problems(resolve_problems):
# def _te_nevra(te):
# def _log_rpm_trans_with_swdb(rpm_transaction, swdb_transaction):
# def _sync_rpm_trans_with_swdb(rpm_transaction, swdb_transaction):
#     def __init__(self):
#     def __enter__(self):
#     def __exit__(self, exc_type, exc_value, traceback):
#     def __init__(self, *args, **kwds):
#     def __hash__(self):
#     def __init__(self, iterable):
#     def __getattr__(self, what):
#         def fn(*args, **kwargs):
#             def call_what(v):
#     def __setattr__(self, what, val):
#         def setter(item):
# def _make_lists(transaction):
# def _post_transaction_output(base, transaction, action_callback):
#     def _tsi_or_pkg_nevra_cmp(item1, item2):
# def _name_unset_wrapper(input_name):
# class tmpdir(object):
# class Bunch(dict):
# class MultiCallList(list):
# 
# Path: dnf/i18n.py
# class UnicodeStream(object):
#     def __init__(self, stream, encoding):
#     def write(self, s):
#     def __getattr__(self, name):
# def _full_ucd_support(encoding):
# def _guess_encoding():
# def setup_locale():
# def setup_stdout():
# def ucd_input(ucstring):
# def ucd(obj):
# def _exact_width_char(uchar):
# def chop_str(msg, chop=None):
# def exact_width(msg):
# def fill_exact_width(msg, fill, chop=None, left=True, prefix='', suffix=''):
# def textwrap_fill(text, width=70, initial_indent='', subsequent_indent=''):
#     def _indent_at_beg(line):
# def select_short_long(width, msg_short, msg_long):
# def translation(name):
#     def ucd_wrapper(fnc):
# def pgettext(context, message):
# _, P_ = translation("dnf")
# C_ = pgettext


from collections import OrderedDict
from dnf.module.exceptions import EnableMultipleStreamsException
from dnf.util import logger
from dnf.i18n import _, P_, ucd
import hawkey
import libdnf.smartcols
import libdnf.module
import dnf.selector
import dnf.exceptions
import functools

    def _get_package_name_set_and_remove_profiles(self, module_list, nsvcap, remove=False):
        package_name_set = set()
        latest_module = self._get_latest(module_list)
        installed_profiles_strings = set(self.base._moduleContainer.getInstalledProfiles(
            latest_module.getName()))
        if not installed_profiles_strings:
            return set()
        if nsvcap.profile:
            profiles_set = latest_module.getProfiles(nsvcap.profile)
            if not profiles_set:
                return set()
            for profile in profiles_set:
                if profile.getName() in installed_profiles_strings:
                    if remove:
                        self.base._moduleContainer.uninstall(latest_module, profile.getName())
                    package_name_set.update(profile.getContent())
        else:
            for profile_string in installed_profiles_strings:
                if remove:
                    self.base._moduleContainer.uninstall(latest_module, profile_string)
                for profile in latest_module.getProfiles(profile_string):
                    package_name_set.update(profile.getContent())
        return package_name_set

    def _get_info_profiles(self, module_specs):
        output = set()
        for module_spec in module_specs:
            module_list, nsvcap = self._get_modules(module_spec)
            if not module_list:

# Path: dnf/module/exceptions.py
# class EnableMultipleStreamsException(dnf.exceptions.Error):
#     def __init__(self, module_spec, value=None):
#         if value is None:
#             value = _("Cannot enable more streams from module '{}' at the same time").format(module_spec)
#         super(EnableMultipleStreamsException, self).__init__(value)
# 
# Path: dnf/util.py
# MAIN_PROG = argparse.ArgumentParser().prog if argparse.ArgumentParser().prog == "yum" else "dnf"
# MAIN_PROG_UPPER = MAIN_PROG.upper()
# def _parse_specs(namespace, values):
# def _urlopen_progress(url, conf, progress=None):
# def _urlopen(url, conf=None, repo=None, mode='w+b', **kwargs):
# def rtrim(s, r):
# def am_i_root():
# def clear_dir(path):
# def ensure_dir(dname):
# def split_path(path):
# def empty(iterable):
# def first(iterable):
# def first_not_none(iterable):
# def file_age(fn):
# def file_timestamp(fn):
# def get_effective_login():
# def get_in(dct, keys, not_found):
# def group_by_filter(fn, iterable):
#     def splitter(acc, item):
# def insert_if(item, iterable, condition):
# def is_exhausted(iterator):
# def is_glob_pattern(pattern):
# def is_string_type(obj):
# def lazyattr(attrname):
#     def get_decorated(fn):
#         def cached_getter(obj):
# def mapall(fn, *seq):
# def normalize_time(timestamp):
# def on_ac_power():
# def on_metered_connection():
# def partition(pred, iterable):
# def rm_rf(path):
# def split_by(iterable, condition):
#     def next_subsequence(it):
# def strip_prefix(s, prefix):
# def touch(path, no_create=False):
# def _terminal_messenger(tp='write', msg="", out=sys.stdout):
# def _format_resolve_problems(resolve_problems):
# def _te_nevra(te):
# def _log_rpm_trans_with_swdb(rpm_transaction, swdb_transaction):
# def _sync_rpm_trans_with_swdb(rpm_transaction, swdb_transaction):
#     def __init__(self):
#     def __enter__(self):
#     def __exit__(self, exc_type, exc_value, traceback):
#     def __init__(self, *args, **kwds):
#     def __hash__(self):
#     def __init__(self, iterable):
#     def __getattr__(self, what):
#         def fn(*args, **kwargs):
#             def call_what(v):
#     def __setattr__(self, what, val):
#         def setter(item):
# def _make_lists(transaction):
# def _post_transaction_output(base, transaction, action_callback):
#     def _tsi_or_pkg_nevra_cmp(item1, item2):
# def _name_unset_wrapper(input_name):
# class tmpdir(object):
# class Bunch(dict):
# class MultiCallList(list):
# 
# Path: dnf/i18n.py
# class UnicodeStream(object):
#     def __init__(self, stream, encoding):
#     def write(self, s):
#     def __getattr__(self, name):
# def _full_ucd_support(encoding):
# def _guess_encoding():
# def setup_locale():
# def setup_stdout():
# def ucd_input(ucstring):
# def ucd(obj):
# def _exact_width_char(uchar):
# def chop_str(msg, chop=None):
# def exact_width(msg):
# def fill_exact_width(msg, fill, chop=None, left=True, prefix='', suffix=''):
# def textwrap_fill(text, width=70, initial_indent='', subsequent_indent=''):
#     def _indent_at_beg(line):
# def select_short_long(width, msg_short, msg_long):
# def translation(name):
#     def ucd_wrapper(fnc):
# def pgettext(context, message):
# _, P_ = translation("dnf")
# C_ = pgettext


# Path: dnf/module/module_base.py
from collections import OrderedDict
from dnf.module.exceptions import EnableMultipleStreamsException
from dnf.util import logger
from dnf.i18n import _, P_, ucd
import hawkey
import libdnf.smartcols
import libdnf.module
import dnf.selector
import dnf.exceptions
import functools


    def _get_package_name_set_and_remove_profiles(self, module_list, nsvcap, remove=False):
        package_name_set = set()
        latest_module = self._get_latest(module_list)
        installed_profiles_strings = set(self.base._moduleContainer.getInstalledProfiles(
            latest_module.getName()))
        if not installed_profiles_strings:
            return set()
        if nsvcap.profile:
            profiles_set = latest_module.getProfiles(nsvcap.profile)
            if not profiles_set:
                return set()
            for profile in profiles_set:
                if profile.getName() in installed_profiles_strings:
                    if remove:
                        self.base._moduleContainer.uninstall(latest_module, profile.getName())
                    package_name_set.update(profile.getContent())
        else:
            for profile_string in installed_profiles_strings:
                if remove:
                    self.base._moduleContainer.uninstall(latest_module, profile_string)
                for profile in latest_module.getProfiles(profile_string):
                    package_name_set.update(profile.getContent())
        return package_name_set

    def _get_info_profiles(self, module_specs):
        output = set()
        for module_spec in module_specs:
            module_list, nsvcap = self._get_modules(module_spec)
            if not module_list:

                logger.info(_("Unable to resolve argument {}").format(module_spec))