コード例 #1
0
ファイル: __init__.py プロジェクト: Cmerun/fistutils
def ask(message, options):
    """Ask the message interactively, with the given possible responses"""
    while 1:
        if os.environ.get("PIP_NO_INPUT"):
            raise Exception("No input was expected ($PIP_NO_INPUT set); question: %s" % message)
        response = input(message)
        response = response.strip().lower()
        if response not in options:
            print("Your response (%r) was not one of the expected responses: " "%s" % (response, ", ".join(options)))
        else:
            return response
コード例 #2
0
def ask(message, options):
    # type: (str, Iterable[str]) -> str
    """Ask the message interactively, with the given possible responses"""
    while 1:
        _check_no_input(message)
        response = input(message)
        response = response.strip().lower()
        if response not in options:
            print('Your response (%r) was not one of the expected responses: '
                  '%s' % (response, ', '.join(options)))
        else:
            return response
コード例 #3
0
ファイル: __init__.py プロジェクト: jtorresyap/learning-flask
def ask(message, options):
    """Ask the message interactively, with the given possible responses"""
    while 1:
        if os.environ.get('PIP_NO_INPUT'):
            raise Exception(
                'No input was expected ($PIP_NO_INPUT set); question: %s' %
                message)
        response = input(message)
        response = response.strip().lower()
        if response not in options:
            print('Your response (%r) was not one of the expected responses: '
                  '%s' % (response, ', '.join(options)))
        else:
            return response
コード例 #4
0
ファイル: misc.py プロジェクト: pypa/pip
def ask(message, options):
    # type: (str, Iterable[str]) -> str
    """Ask the message interactively, with the given possible responses"""
    while 1:
        _check_no_input(message)
        response = input(message)
        response = response.strip().lower()
        if response not in options:
            print(
                'Your response (%r) was not one of the expected responses: '
                '%s' % (response, ', '.join(options))
            )
        else:
            return response
コード例 #5
0
def ask(message, options):
    # type: (str, Iterable[str]) -> str
    """Ask the message interactively, with the given possible responses"""
    while 1:
        if os.environ.get("PIP_NO_INPUT"):
            raise Exception("No input was expected ($PIP_NO_INPUT set); question: %s" % message)
        response = input(message)
        response = response.strip().lower()
        if response not in options:
            print(
                "Your response (%r) was not one of the expected responses: "
                "%s" % (response, ", ".join(options))
            )
        else:
            return response
コード例 #6
0
ファイル: misc.py プロジェクト: pfmoore/pip
def ask(message, options):
    # type: (str, Iterable[str]) -> str
    """Ask the message interactively, with the given possible responses"""
    while 1:
        if os.environ.get('PIP_NO_INPUT'):
            raise Exception(
                'No input was expected ($PIP_NO_INPUT set); question: %s' %
                message
            )
        response = input(message)
        response = response.strip().lower()
        if response not in options:
            print(
                'Your response (%r) was not one of the expected responses: '
                '%s' % (response, ', '.join(options))
            )
        else:
            return response
コード例 #7
0
def ask_input(message):
    # type: (str) -> str
    """Ask for input interactively."""
    _check_no_input(message)
    return input(message)
コード例 #8
0
ファイル: misc.py プロジェクト: pypa/pip
def ask_input(message):
    # type: (str) -> str
    """Ask for input interactively."""
    _check_no_input(message)
    return input(message)