# Path: conjureup/utils.py
# def chdir(directory):
# def run(cmd, **kwargs):
# def run_script(path, stderr=PIPE, stdout=PIPE):
# def run_attach(cmd, output_cb=None):
#     def last_ten_lines(s):
# async def arun(cmd, input=None, check=False, env=None, encoding='utf8',
#                stdin=PIPE, stdout=PIPE, stderr=PIPE, cb_stdout=None,
#                cb_stderr=None, **kwargs):
#         async def tstream(source_name, sink, ui_cb):
# def sentry_report(message=None, exc_info=None, tags=None, **kwargs):
# def _sentry_report(message=None, exc_info=None, tags=None, **kwargs):
# async def can_sudo(password=None):
# def juju_version():
# def snap_version():
# def send_msg(msg, label, color, attrs=['bold']):
# def info(msg):
# def error(msg):
# def warning(msg):
# def install_home():
# def juju_path():
# def mkdir(path):
# def _normalize_bundle(original_bundle, overlay_bundle):
# def merge_dicts(*dicts):
# def subtract_dicts(*dicts):
# def chown(path, user, group=None, recursive=False):
# def spew(path, data, owner=None):
# def slurp(path):
# def install_user():
# def set_chosen_spell(spell_name, spell_dir):
# def set_spell_metadata():
# def get_spell_metadata(spell):
# def __available_on_darwin(key):
# def find_spells():
# def find_addons_matching(key):
# def find_spells_matching(key):
# def get_options_whitelist(service_name):
# def gen_hash():
# def gen_model():
# def gen_cloud():
# def is_darwin():
# def is_linux():
# def is_valid_hostname(hostname):
# def set_terminal_title(title):
# def get_physical_network_interfaces():
# def get_physical_network_ipaddr(iface):
# def get_open_port():
#     def __init__(self, *args, **kwargs):
#     def __aiter__(self):
#     async def __anext__(self):
#     async def close(self):
#     def sanitize(self, key, value):
#         def _check_str(s):
#     def __init__(self):
# class IterQueue(asyncio.Queue):
# class SanitizeDataProcessor(SanitizePasswordsProcessor):
# class TestError(Exception):
# class SudoError(Exception):
# class UtilsHTTPError(Exception):
# 
# Path: conjureup/ui/widgets/buttons.py
# class SubmitButton(StyledButton):
#     pass
# 
# Path: conjureup/ui/widgets/selectors.py
# class RadioList(SelectList):
#     option_type = ValuedRadioButton
#     allow_multiple = False
# 
#     def __init__(self, *args, **kwargs):
#         self.group = []
#         super().__init__(*args, **kwargs)
# 
#     def _create_option(self, label, value):
#         return self.option_type(self.group, label, value)
# 
#     def select_first_option(self):
#         """
#         Select the first option.
#         """
#         for item in self.contents:
#             if isinstance(item, self.option_type):
#                 item.set_state(True)
#                 break
# 
#     def select_option(self, value):
#         """
#         Select an option by value.
#         """
#         for item in self.contents:
#             if isinstance(item, self.option_type):
#                 item.set_state(item.value == value)
# 
# class ValuedCheckBox(CheckBox):
#     """
#     Subclass of CheckBox that associates a value with the checkbox.
#     """
# 
#     def __init__(self, label, value, *args, **kwargs):
#         super().__init__(label, *args, **kwargs)
#         self.value = value
# 
# class ValuedRadioButton(RadioButton):
#     """
#     Subclass of RadioButton that associates a value with the radio button.
#     """
# 
#     def __init__(self, group, label, value, *args, **kwargs):
#         super().__init__(group, label, *args, **kwargs)
#         self.value = value


import asyncio
from ubuntui.utils import Color, Padding
from ubuntui.widgets.hr import HR
from ubuntui.widgets.input import (
    IntegerEditor,
    PasswordEditor,
    StringEditor,
    YesNo
)
from urwid import Columns, Filler, Pile, Text, WidgetWrap
from conjureup import utils
from conjureup.ui.widgets.buttons import SubmitButton
from conjureup.ui.widgets.selectors import (
    RadioList,
    ValuedCheckBox,
    ValuedRadioButton
)
            self.button if self.requires_input else Text(""),
            HR(),
        ])

        if self.requires_input:
            self.complete.clear()
        else:
            self.complete.set()

        return form_fields

    def lock_form(self):
        # make unselectable by "focusing" the non-focusable description
        self.focus_position = 0
        self.clear_button()

    def submit(self, btn):
        self.app.loop.create_task(self.validate())

    async def validate(self):
        error_field = None
        if self.sudo_input:
            self.clear_sudo_error()
            # the sudo form can be at the bottom of a long list of forms and
            # if there is no focused widget below it, it will get scrolled
            # off the bottom while checking, making it invisible; so we render
            # the button disabled and focus it to ensure the user can see the
            # sudo form
            self.show_button('Checking sudo...', enabled=False)
            self.focus_position = self.current_button_index

# Path: conjureup/utils.py
# def chdir(directory):
# def run(cmd, **kwargs):
# def run_script(path, stderr=PIPE, stdout=PIPE):
# def run_attach(cmd, output_cb=None):
#     def last_ten_lines(s):
# async def arun(cmd, input=None, check=False, env=None, encoding='utf8',
#                stdin=PIPE, stdout=PIPE, stderr=PIPE, cb_stdout=None,
#                cb_stderr=None, **kwargs):
#         async def tstream(source_name, sink, ui_cb):
# def sentry_report(message=None, exc_info=None, tags=None, **kwargs):
# def _sentry_report(message=None, exc_info=None, tags=None, **kwargs):
# async def can_sudo(password=None):
# def juju_version():
# def snap_version():
# def send_msg(msg, label, color, attrs=['bold']):
# def info(msg):
# def error(msg):
# def warning(msg):
# def install_home():
# def juju_path():
# def mkdir(path):
# def _normalize_bundle(original_bundle, overlay_bundle):
# def merge_dicts(*dicts):
# def subtract_dicts(*dicts):
# def chown(path, user, group=None, recursive=False):
# def spew(path, data, owner=None):
# def slurp(path):
# def install_user():
# def set_chosen_spell(spell_name, spell_dir):
# def set_spell_metadata():
# def get_spell_metadata(spell):
# def __available_on_darwin(key):
# def find_spells():
# def find_addons_matching(key):
# def find_spells_matching(key):
# def get_options_whitelist(service_name):
# def gen_hash():
# def gen_model():
# def gen_cloud():
# def is_darwin():
# def is_linux():
# def is_valid_hostname(hostname):
# def set_terminal_title(title):
# def get_physical_network_interfaces():
# def get_physical_network_ipaddr(iface):
# def get_open_port():
#     def __init__(self, *args, **kwargs):
#     def __aiter__(self):
#     async def __anext__(self):
#     async def close(self):
#     def sanitize(self, key, value):
#         def _check_str(s):
#     def __init__(self):
# class IterQueue(asyncio.Queue):
# class SanitizeDataProcessor(SanitizePasswordsProcessor):
# class TestError(Exception):
# class SudoError(Exception):
# class UtilsHTTPError(Exception):
# 
# Path: conjureup/ui/widgets/buttons.py
# class SubmitButton(StyledButton):
#     pass
# 
# Path: conjureup/ui/widgets/selectors.py
# class RadioList(SelectList):
#     option_type = ValuedRadioButton
#     allow_multiple = False
# 
#     def __init__(self, *args, **kwargs):
#         self.group = []
#         super().__init__(*args, **kwargs)
# 
#     def _create_option(self, label, value):
#         return self.option_type(self.group, label, value)
# 
#     def select_first_option(self):
#         """
#         Select the first option.
#         """
#         for item in self.contents:
#             if isinstance(item, self.option_type):
#                 item.set_state(True)
#                 break
# 
#     def select_option(self, value):
#         """
#         Select an option by value.
#         """
#         for item in self.contents:
#             if isinstance(item, self.option_type):
#                 item.set_state(item.value == value)
# 
# class ValuedCheckBox(CheckBox):
#     """
#     Subclass of CheckBox that associates a value with the checkbox.
#     """
# 
#     def __init__(self, label, value, *args, **kwargs):
#         super().__init__(label, *args, **kwargs)
#         self.value = value
# 
# class ValuedRadioButton(RadioButton):
#     """
#     Subclass of RadioButton that associates a value with the radio button.
#     """
# 
#     def __init__(self, group, label, value, *args, **kwargs):
#         super().__init__(group, label, *args, **kwargs)
#         self.value = value


# Path: conjureup/ui/widgets/step.py
import asyncio
from ubuntui.utils import Color, Padding
from ubuntui.widgets.hr import HR
from ubuntui.widgets.input import (
    IntegerEditor,
    PasswordEditor,
    StringEditor,
    YesNo
)
from urwid import Columns, Filler, Pile, Text, WidgetWrap
from conjureup import utils
from conjureup.ui.widgets.buttons import SubmitButton
from conjureup.ui.widgets.selectors import (
    RadioList,
    ValuedCheckBox,
    ValuedRadioButton
)

            self.button if self.requires_input else Text(""),
            HR(),
        ])

        if self.requires_input:
            self.complete.clear()
        else:
            self.complete.set()

        return form_fields

    def lock_form(self):
        # make unselectable by "focusing" the non-focusable description
        self.focus_position = 0
        self.clear_button()

    def submit(self, btn):
        self.app.loop.create_task(self.validate())

    async def validate(self):
        error_field = None
        if self.sudo_input:
            self.clear_sudo_error()
            # the sudo form can be at the bottom of a long list of forms and
            # if there is no focused widget below it, it will get scrolled
            # off the bottom while checking, making it invisible; so we render
            # the button disabled and focus it to ensure the user can see the
            # sudo form
            self.show_button('Checking sudo...', enabled=False)
            self.focus_position = self.current_button_index

            if not await utils.can_sudo(self.sudo_input.value):