# Path: pyanaconda/threads.py
# class ThreadManager(object):
# class AnacondaThread(threading.Thread):
#     def __init__(self):
#     def __call__(self):
#     def add(self, obj):
#     def remove(self, name):
#     def exists(self, name):
#     def get(self, name):
#     def wait(self, name):
#     def wait_all(self):
#     def set_error(self, name, *exc_info):
#     def get_error(self, name):
#     def any_errors(self):
#     def raise_if_error(self, name):
#     def in_main_thread(self):
#     def running(self):
#     def names(self):
#     def __init__(self, *args, **kwargs):
#     def run(self, *args, **kwargs):
# def initThreading():
# 
# Path: pyanaconda/ui/communication.py

# 
# Path: pyanaconda/constants.py
# SELINUX_DEFAULT = 1
# DISPATCH_BACK = -1
# DISPATCH_FORWARD = 1
# DISPATCH_DEFAULT = None
# DISPATCH_WAITING = 2
# MAX_PART_SIZE = 1024*1024*1024
# SKIP_KEY = -50
# ADDON_PATHS = ["/usr/share/anaconda/addons"]
# DD_ALL = "/tmp/DD"
# DD_EXTRACTED = re.compile("/lib/modules/[^/]+/updates/DD/(?P<moduledir>.*/)?(?P<modulename>[^/.]+).ko.*")
# DD_FIRMWARE = "/tmp/DD/lib/firmware"
# DD_RPMS = "/tmp/DD-*"
# TRANSLATIONS_UPDATE_DIR="/tmp/updates/po"
# ANACONDA_CLEANUP = "anaconda-cleanup"
# ROOT_PATH = "/mnt/sysimage"
# MOUNT_DIR = "/mnt/install"
# DRACUT_REPODIR = "/run/install/repo"
# DRACUT_ISODIR = "/run/install/source"
# ISO_DIR = MOUNT_DIR + "/isodir"
# IMAGE_DIR = MOUNT_DIR + "/image"
# INSTALL_TREE = MOUNT_DIR + "/source"
# BASE_REPO_NAME = "anaconda"
# DEFAULT_LANG = "en_US.UTF-8"
# DEFAULT_VC_FONT = "latarcyrheb-sun16"
# DRACUT_SHUTDOWN_EJECT = "/run/initramfs/usr/lib/dracut/hooks/shutdown/99anaconda-eject.sh"
# USEVNC = _("Start VNC")
# USETEXT = _("Use text mode")
# RUNLEVELS = {3: 'multi-user.target', 5: 'graphical.target'}
# NETWORK_CONNECTION_TIMEOUT = 45  # in seconds
# DEFAULT_DBUS_TIMEOUT = -1       # use default
# THREAD_EXECUTE_STORAGE = "AnaExecuteStorageThread"
# THREAD_STORAGE = "AnaStorageThread"
# THREAD_STORAGE_WATCHER = "AnaStorageWatcher"
# THREAD_CHECK_STORAGE = "AnaCheckStorageThread"
# THREAD_CUSTOM_STORAGE_INIT = "AnaCustomStorageInit"
# THREAD_WAIT_FOR_CONNECTING_NM = "AnaWaitForConnectingNMThread"
# THREAD_PAYLOAD = "AnaPayloadThread"
# THREAD_PAYLOAD_MD = "AnaPayloadMDThread"
# THREAD_INPUT_BASENAME = "AnaInputThread"
# THREAD_SYNC_TIME_BASENAME = "AnaSyncTime"
# THREAD_EXCEPTION_HANDLING_TEST = "AnaExceptionHandlingTest"
# THREAD_LIVE_PROGRESS = "AnaLiveProgressThread"
# THREAD_SOFTWARE_WATCHER = "AnaSoftwareWatcher"
# THREAD_CHECK_SOFTWARE = "AnaCheckSoftwareThread"
# THREAD_SOURCE_WATCHER = "AnaSourceWatcher"
# THREAD_INSTALL = "AnaInstallThread"
# THREAD_CONFIGURATION = "AnaConfigurationThread"
# THREAD_FCOE = "AnaFCOEThread"
# THREAD_ISCSI_DISCOVER = "AnaIscsiDiscoverThread"
# THREAD_ISCSI_LOGIN = "AnaIscsiLoginThread"
# THREAD_GEOLOCATION_REFRESH = "AnaGeolocationRefreshThread"
# THREAD_DATE_TIME = "AnaDateTimeThread"
# THREAD_TIME_INIT = "AnaTimeInitThread"
# THREAD_DASDFMT = "AnaDasdfmtThread"
# GEOLOC_PROVIDER_FEDORA_GEOIP = "provider_fedora_geoip"
# GEOLOC_PROVIDER_HOSTIP = "provider_hostip"
# GEOLOC_PROVIDER_GOOGLE_WIFI = "provider_google_wifi"
# GEOLOC_GEOCODER_NOMINATIM = "geocoder_nominatim"
# GEOLOC_DEFAULT_PROVIDER = GEOLOC_PROVIDER_FEDORA_GEOIP
# GEOLOC_DEFAULT_GEOCODER = GEOLOC_GEOCODER_NOMINATIM
# ANACONDA_ENVIRON = "anaconda"
# FIRSTBOOT_ENVIRON = "firstboot"
# UNSUPPORTED_HW = 1 << 28
# CMDLINE_APPEND = ["modprobe.blacklist"]


import sys
import readline
import Queue
import getpass
import threading
from pyanaconda.threads import threadMgr, AnacondaThread
from pyanaconda.ui.communication import hubQ
from pyanaconda import constants
from pyanaconda.i18n import _, N_
        to be used in a thread started on demand by the App class and returns the
        input via the communication Queue.

        :param queue: communication queue to be used
        :type queue: Queue.Queue instance

        :param prompt: prompt to be displayed
        :type prompt: str

        :param hidden: whether typed characters should be echoed or not
        :type hidden: bool

        """

        if hidden:
            data = getpass.getpass(prompt)
        else:
            sys.stdout.write(prompt)
            sys.stdout.flush()
            # XXX: only one raw_input can run at a time, don't schedule another
            # one as it would cause weird behaviour and block other packages'
            # raw_inputs
            if not RAW_INPUT_LOCK.acquire(False):
                # raw_input is already running
                return
            else:
                # lock acquired, we can run raw_input
                data = raw_input()
                RAW_INPUT_LOCK.release()


# Path: pyanaconda/threads.py
# class ThreadManager(object):
# class AnacondaThread(threading.Thread):
#     def __init__(self):
#     def __call__(self):
#     def add(self, obj):
#     def remove(self, name):
#     def exists(self, name):
#     def get(self, name):
#     def wait(self, name):
#     def wait_all(self):
#     def set_error(self, name, *exc_info):
#     def get_error(self, name):
#     def any_errors(self):
#     def raise_if_error(self, name):
#     def in_main_thread(self):
#     def running(self):
#     def names(self):
#     def __init__(self, *args, **kwargs):
#     def run(self, *args, **kwargs):
# def initThreading():
# 
# Path: pyanaconda/ui/communication.py

# 
# Path: pyanaconda/constants.py
# SELINUX_DEFAULT = 1
# DISPATCH_BACK = -1
# DISPATCH_FORWARD = 1
# DISPATCH_DEFAULT = None
# DISPATCH_WAITING = 2
# MAX_PART_SIZE = 1024*1024*1024
# SKIP_KEY = -50
# ADDON_PATHS = ["/usr/share/anaconda/addons"]
# DD_ALL = "/tmp/DD"
# DD_EXTRACTED = re.compile("/lib/modules/[^/]+/updates/DD/(?P<moduledir>.*/)?(?P<modulename>[^/.]+).ko.*")
# DD_FIRMWARE = "/tmp/DD/lib/firmware"
# DD_RPMS = "/tmp/DD-*"
# TRANSLATIONS_UPDATE_DIR="/tmp/updates/po"
# ANACONDA_CLEANUP = "anaconda-cleanup"
# ROOT_PATH = "/mnt/sysimage"
# MOUNT_DIR = "/mnt/install"
# DRACUT_REPODIR = "/run/install/repo"
# DRACUT_ISODIR = "/run/install/source"
# ISO_DIR = MOUNT_DIR + "/isodir"
# IMAGE_DIR = MOUNT_DIR + "/image"
# INSTALL_TREE = MOUNT_DIR + "/source"
# BASE_REPO_NAME = "anaconda"
# DEFAULT_LANG = "en_US.UTF-8"
# DEFAULT_VC_FONT = "latarcyrheb-sun16"
# DRACUT_SHUTDOWN_EJECT = "/run/initramfs/usr/lib/dracut/hooks/shutdown/99anaconda-eject.sh"
# USEVNC = _("Start VNC")
# USETEXT = _("Use text mode")
# RUNLEVELS = {3: 'multi-user.target', 5: 'graphical.target'}
# NETWORK_CONNECTION_TIMEOUT = 45  # in seconds
# DEFAULT_DBUS_TIMEOUT = -1       # use default
# THREAD_EXECUTE_STORAGE = "AnaExecuteStorageThread"
# THREAD_STORAGE = "AnaStorageThread"
# THREAD_STORAGE_WATCHER = "AnaStorageWatcher"
# THREAD_CHECK_STORAGE = "AnaCheckStorageThread"
# THREAD_CUSTOM_STORAGE_INIT = "AnaCustomStorageInit"
# THREAD_WAIT_FOR_CONNECTING_NM = "AnaWaitForConnectingNMThread"
# THREAD_PAYLOAD = "AnaPayloadThread"
# THREAD_PAYLOAD_MD = "AnaPayloadMDThread"
# THREAD_INPUT_BASENAME = "AnaInputThread"
# THREAD_SYNC_TIME_BASENAME = "AnaSyncTime"
# THREAD_EXCEPTION_HANDLING_TEST = "AnaExceptionHandlingTest"
# THREAD_LIVE_PROGRESS = "AnaLiveProgressThread"
# THREAD_SOFTWARE_WATCHER = "AnaSoftwareWatcher"
# THREAD_CHECK_SOFTWARE = "AnaCheckSoftwareThread"
# THREAD_SOURCE_WATCHER = "AnaSourceWatcher"
# THREAD_INSTALL = "AnaInstallThread"
# THREAD_CONFIGURATION = "AnaConfigurationThread"
# THREAD_FCOE = "AnaFCOEThread"
# THREAD_ISCSI_DISCOVER = "AnaIscsiDiscoverThread"
# THREAD_ISCSI_LOGIN = "AnaIscsiLoginThread"
# THREAD_GEOLOCATION_REFRESH = "AnaGeolocationRefreshThread"
# THREAD_DATE_TIME = "AnaDateTimeThread"
# THREAD_TIME_INIT = "AnaTimeInitThread"
# THREAD_DASDFMT = "AnaDasdfmtThread"
# GEOLOC_PROVIDER_FEDORA_GEOIP = "provider_fedora_geoip"
# GEOLOC_PROVIDER_HOSTIP = "provider_hostip"
# GEOLOC_PROVIDER_GOOGLE_WIFI = "provider_google_wifi"
# GEOLOC_GEOCODER_NOMINATIM = "geocoder_nominatim"
# GEOLOC_DEFAULT_PROVIDER = GEOLOC_PROVIDER_FEDORA_GEOIP
# GEOLOC_DEFAULT_GEOCODER = GEOLOC_GEOCODER_NOMINATIM
# ANACONDA_ENVIRON = "anaconda"
# FIRSTBOOT_ENVIRON = "firstboot"
# UNSUPPORTED_HW = 1 << 28
# CMDLINE_APPEND = ["modprobe.blacklist"]


# Path: pyanaconda/ui/tui/simpleline/base.py
import sys
import readline
import Queue
import getpass
import threading
from pyanaconda.threads import threadMgr, AnacondaThread
from pyanaconda.ui.communication import hubQ
from pyanaconda import constants
from pyanaconda.i18n import _, N_

        to be used in a thread started on demand by the App class and returns the
        input via the communication Queue.

        :param queue: communication queue to be used
        :type queue: Queue.Queue instance

        :param prompt: prompt to be displayed
        :type prompt: str

        :param hidden: whether typed characters should be echoed or not
        :type hidden: bool

        """

        if hidden:
            data = getpass.getpass(prompt)
        else:
            sys.stdout.write(prompt)
            sys.stdout.flush()
            # XXX: only one raw_input can run at a time, don't schedule another
            # one as it would cause weird behaviour and block other packages'
            # raw_inputs
            if not RAW_INPUT_LOCK.acquire(False):
                # raw_input is already running
                return
            else:
                # lock acquired, we can run raw_input
                data = raw_input()
                RAW_INPUT_LOCK.release()


        queue.put((hubQ.HUB_CODE_INPUT, [data]))