# Path: dput/core.py
# CONFIG_LOCATIONS = {
#     "/usr/share/dput-ng/": 30,
#     "/etc/dput.d/": 20,
#     os.path.expanduser("~/.dput.d"): 10,
#     "skel/": 100
# }
# DPUT_CONFIG_LOCATIONS = {
#     "/etc/dput.cf": 15,
#     os.path.expanduser("~/.dput.cf"): 5
# }
# SCHEMA_DIRS = [
#     "/usr/share/dput-ng/schemas",
#     "skel/schemas"
# ]
# def _write_upload_log(logfile, full_log):
# def _enable_debugging(level):
# def mangle_sys():
# def maybe_print_traceback(debug_level, stack):
# def get_local_username():
# 
# Path: dput/interface.py
# class AbstractInterface(object):
#     """
#     Abstract base class for Concrete implementations of user interfaces.
# 
#     The invoking process will instantiate the process, call initialize,
#     query (any number of times), and shutdown.
#     """
# 
#     __metaclass__ = abc.ABCMeta
# 
#     @abc.abstractmethod
#     def initialize(self, **kwargs):
#         """
#         Set up the interface state.
#         """
#         pass
# 
#     def boolean(self, title, message, question_type=BUTTON_YES_NO,
#                 default=None):
#         """
#         Display a question returning a boolean value. This is evaluated
#         by checking the button return code either to be BUTTON_YES or
#         BUTTON_OK
#         """
#         self.widget_type = WIDGET_BOOLEAN
#         self.message = message
#         self.question_type = question_type
#         self.default = default
# 
#     def message(self, title, message, question_type=BUTTON_OK):
#         """
#         Display a message and a confirmation button when required by the
#         interface to make sure the user noticed the message Some interfaces,
#         e.g. the CLI may ignore the button.
#         """
#         self.widget_type = WIDGET_MESSAGE
#         self.message = message
#         self.question_type = question_type
# 
#     def list(self, title, message, selections=[]):
#         """
#         Display a list of alternatives the user can choose from, returns a
#         list of selections.
#         """
#         self.widget_type = WIDGET_LIST
#         self.message = message
#         self.selection = selections
# 
#     def question(self, title, message, echo_input=True):
#         """
#         Query for user input. The input is returned literally
#         """
#         self.widget_type = WIDGET_QUESTION
#         self.message = message
#         self.echo_input = True
# 
#     def password(self, title, message):
#         """
#         Query for user input. The input is returned literally but not printed
#         back. This is a shortcut to
#         :meth:`dput.interface.AbstractInterface.question` with echo_input
#         defaulting to False
#         """
#         self.question(title, message, echo_input=False)
# 
#     @abc.abstractmethod
#     def shutdown(self):
#         """
#         Get rid of everything, close out.
#         """
#         pass
# 
# ALL_BUTTONS = [BUTTON_YES, BUTTON_NO, BUTTON_CANCEL, BUTTON_OK]
# 
# BUTTON_YES_NO = [BUTTON_YES, BUTTON_NO]
# 
# BUTTON_OK = "ok"
# 
# BUTTON_YES = "yes"


import sys
import getpass
from dput.core import logger
from dput.interface import (AbstractInterface, ALL_BUTTONS, BUTTON_YES_NO,
                            BUTTON_OK, BUTTON_YES)
            elif len(buttons) == 1:
                return buttons[0]
        return None

    def boolean(self, title, message, question_type=BUTTON_YES_NO,
                default=None):
        """
        See :meth:`dput.interface.AbstractInterface.boolean`
        """
        super(CLInterface, self).boolean(title, message, question_type)

        choices = ""
        question_len = len(question_type)
        for question in question_type:
            button_name = self.button_to_str(question)
            if question == default:
                button_name = button_name.upper()
            choices += button_name
            question_len -= 1
            if question_len:
                choices += ", "
        user_input = None
        while not user_input:
            user_input = self.question(title, "%s [%s]" % (message, choices))
            user_input = self.str_to_button(user_input, default)
        logger.trace("translated user input '%s'" % (user_input))
        if user_input in (BUTTON_OK, BUTTON_YES):
            return True
        return False


# Path: dput/core.py
# CONFIG_LOCATIONS = {
#     "/usr/share/dput-ng/": 30,
#     "/etc/dput.d/": 20,
#     os.path.expanduser("~/.dput.d"): 10,
#     "skel/": 100
# }
# DPUT_CONFIG_LOCATIONS = {
#     "/etc/dput.cf": 15,
#     os.path.expanduser("~/.dput.cf"): 5
# }
# SCHEMA_DIRS = [
#     "/usr/share/dput-ng/schemas",
#     "skel/schemas"
# ]
# def _write_upload_log(logfile, full_log):
# def _enable_debugging(level):
# def mangle_sys():
# def maybe_print_traceback(debug_level, stack):
# def get_local_username():
# 
# Path: dput/interface.py
# class AbstractInterface(object):
#     """
#     Abstract base class for Concrete implementations of user interfaces.
# 
#     The invoking process will instantiate the process, call initialize,
#     query (any number of times), and shutdown.
#     """
# 
#     __metaclass__ = abc.ABCMeta
# 
#     @abc.abstractmethod
#     def initialize(self, **kwargs):
#         """
#         Set up the interface state.
#         """
#         pass
# 
#     def boolean(self, title, message, question_type=BUTTON_YES_NO,
#                 default=None):
#         """
#         Display a question returning a boolean value. This is evaluated
#         by checking the button return code either to be BUTTON_YES or
#         BUTTON_OK
#         """
#         self.widget_type = WIDGET_BOOLEAN
#         self.message = message
#         self.question_type = question_type
#         self.default = default
# 
#     def message(self, title, message, question_type=BUTTON_OK):
#         """
#         Display a message and a confirmation button when required by the
#         interface to make sure the user noticed the message Some interfaces,
#         e.g. the CLI may ignore the button.
#         """
#         self.widget_type = WIDGET_MESSAGE
#         self.message = message
#         self.question_type = question_type
# 
#     def list(self, title, message, selections=[]):
#         """
#         Display a list of alternatives the user can choose from, returns a
#         list of selections.
#         """
#         self.widget_type = WIDGET_LIST
#         self.message = message
#         self.selection = selections
# 
#     def question(self, title, message, echo_input=True):
#         """
#         Query for user input. The input is returned literally
#         """
#         self.widget_type = WIDGET_QUESTION
#         self.message = message
#         self.echo_input = True
# 
#     def password(self, title, message):
#         """
#         Query for user input. The input is returned literally but not printed
#         back. This is a shortcut to
#         :meth:`dput.interface.AbstractInterface.question` with echo_input
#         defaulting to False
#         """
#         self.question(title, message, echo_input=False)
# 
#     @abc.abstractmethod
#     def shutdown(self):
#         """
#         Get rid of everything, close out.
#         """
#         pass
# 
# ALL_BUTTONS = [BUTTON_YES, BUTTON_NO, BUTTON_CANCEL, BUTTON_OK]
# 
# BUTTON_YES_NO = [BUTTON_YES, BUTTON_NO]
# 
# BUTTON_OK = "ok"
# 
# BUTTON_YES = "yes"


# Path: dput/interfaces/cli.py
import sys
import getpass
from dput.core import logger
from dput.interface import (AbstractInterface, ALL_BUTTONS, BUTTON_YES_NO,
                            BUTTON_OK, BUTTON_YES)

            elif len(buttons) == 1:
                return buttons[0]
        return None

    def boolean(self, title, message, question_type=BUTTON_YES_NO,
                default=None):
        """
        See :meth:`dput.interface.AbstractInterface.boolean`
        """
        super(CLInterface, self).boolean(title, message, question_type)

        choices = ""
        question_len = len(question_type)
        for question in question_type:
            button_name = self.button_to_str(question)
            if question == default:
                button_name = button_name.upper()
            choices += button_name
            question_len -= 1
            if question_len:
                choices += ", "
        user_input = None
        while not user_input:
            user_input = self.question(title, "%s [%s]" % (message, choices))
            user_input = self.str_to_button(user_input, default)
        logger.trace("translated user input '%s'" % (user_input))
        if user_input in (BUTTON_OK, BUTTON_YES):
            return True
        return False


    def message(self, title, message, question_type=BUTTON_OK):