Python __builtin__ 模块,input() 实例源码

我们从Python开源项目中,提取了以下23个代码示例,用于说明如何使用__builtin__.input()

项目:leetcode    作者:thomasyimgit    | 项目源码 | 文件源码
def input(prompt=''):
        return builtin_mod.input(prompt)
项目:leetcode    作者:thomasyimgit    | 项目源码 | 文件源码
def input(prompt=''):
        return builtin_mod.raw_input(prompt)
项目:leetcode    作者:thomasyimgit    | 项目源码 | 文件源码
def input(prompt=''):
        return builtin_mod.input(prompt)
项目:leetcode    作者:thomasyimgit    | 项目源码 | 文件源码
def input(prompt=''):
        return builtin_mod.raw_input(prompt)
项目:pwndemo    作者:zh-explorer    | 项目源码 | 文件源码
def init():
    # defer imports until initialization
    import sys, __builtin__
    from ..util import safeeval

    class Wrapper:
        def __init__(self, fd):
            self._fd = fd
        def readline(self, size = None):
            return readline(size)
        def __getattr__(self, k):
            return self._fd.__getattribute__(k)
    sys.stdin = Wrapper(sys.stdin)

    def raw_input(prompt = '', float = True):
        """raw_input(prompt = '', float = True)

        Replacement for the built-in `raw_input` using ``pwnlib``s readline
        implementation.

        Arguments:
            prompt(str): The prompt to show to the user.
            float(bool): If set to `True`, prompt and input will float to the
                         bottom of the screen when `term.term_mode` is enabled.
        """
        return readline(None, prompt, float)
    __builtin__.raw_input = raw_input

    def input(prompt = '', float = True):
        """input(prompt = '', float = True)

        Replacement for the built-in `input` using ``pwnlib``s readline
        implementation, and `pwnlib.util.safeeval.expr` instead of `eval` (!).

        Arguments:
            prompt(str): The prompt to show to the user.
            float(bool): If set to `True`, prompt and input will float to the
                         bottom of the screen when `term.term_mode` is enabled.
        """
        return safeeval.const(readline(None, prompt, float))
    __builtin__.input = input
项目:specto    作者:mrknow    | 项目源码 | 文件源码
def input(prompt=''):
            #input must also be rebinded for using the new raw_input defined
            return eval(raw_input(prompt))
项目:specto    作者:mrknow    | 项目源码 | 文件源码
def input(prompt=''):
            #the original input would only remove a trailing \n, so, at
            #this point if we had a \r\n the \r would remain (which is valid for eclipse)
            #so, let's remove the remaining \r which python didn't expect.
            ret = original_input(prompt)

            if ret.endswith('\r'):
                return ret[:-1]

            return ret
项目:Repobot    作者:Desgard    | 项目源码 | 文件源码
def input(prompt=''):
        return builtin_mod.input(prompt)
项目:Repobot    作者:Desgard    | 项目源码 | 文件源码
def input(prompt=''):
        return builtin_mod.raw_input(prompt)
项目:Repobot    作者:Desgard    | 项目源码 | 文件源码
def input(prompt=''):
        return builtin_mod.input(prompt)
项目:Repobot    作者:Desgard    | 项目源码 | 文件源码
def input(prompt=''):
        return builtin_mod.raw_input(prompt)
项目:black_zone    作者:zh-explorer    | 项目源码 | 文件源码
def init():
    # defer imports until initialization
    import sys, __builtin__
    from ..util import safeeval

    class Wrapper:
        def __init__(self, fd):
            self._fd = fd
        def readline(self, size = None):
            return readline(size)
        def __getattr__(self, k):
            return self._fd.__getattribute__(k)
    sys.stdin = Wrapper(sys.stdin)

    def raw_input(prompt = '', float = True):
        """raw_input(prompt = '', float = True)

        Replacement for the built-in `raw_input` using ``pwnlib``s readline
        implementation.

        Arguments:
            prompt(str): The prompt to show to the user.
            float(bool): If set to `True`, prompt and input will float to the
                         bottom of the screen when `term.term_mode` is enabled.
        """
        return readline(None, prompt, float)
    __builtin__.raw_input = raw_input

    def input(prompt = '', float = True):
        """input(prompt = '', float = True)

        Replacement for the built-in `input` using ``pwnlib``s readline
        implementation, and `pwnlib.util.safeeval.expr` instead of `eval` (!).

        Arguments:
            prompt(str): The prompt to show to the user.
            float(bool): If set to `True`, prompt and input will float to the
                         bottom of the screen when `term.term_mode` is enabled.
        """
        return safeeval.const(readline(None, prompt, float))
    __builtin__.input = input
项目:blender    作者:gastrodia    | 项目源码 | 文件源码
def raw_input(prompt=""):
    """raw_input([prompt]) -> string

Read a string from standard input.  The trailing newline is stripped.
If the user hits EOF (Unix: Ctl-D, Windows: Ctl-Z+Return), raise EOFError.
On Unix, GNU readline is used if enabled.  The prompt string, if given,
is printed without a trailing newline before reading."""

    sys.stderr.flush()

    tty = STDIN.is_a_TTY() and STDOUT.is_a_TTY()

    if RETURN_UNICODE:
        if tty:
            line_bytes = readline(prompt)
            line = stdin_decode(line_bytes)
        else:
            line = stdio_readline(prompt)

    else:
        if tty:
            line = readline(prompt)
        else:
            line_unicode = stdio_readline(prompt)
            line = stdin_encode(line_unicode)

    if line:
        return line[:-1] # strip strailing "\n"
    else:
        raise EOFError
项目:blender    作者:gastrodia    | 项目源码 | 文件源码
def input(prompt=""):
    """input([prompt]) -> value

Equivalent to eval(raw_input(prompt))."""

    string = stdin_decode(raw_input(prompt))

    caller_frame = sys._getframe(1)
    globals = caller_frame.f_globals
    locals = caller_frame.f_locals

    return eval(string, globals, locals)
项目:blender    作者:gastrodia    | 项目源码 | 文件源码
def enable(return_unicode=RETURN_UNICODE):
    global RETURN_UNICODE
    RETURN_UNICODE = return_unicode

    builtins.raw_input = raw_input
    builtins.input = input
项目:blender    作者:gastrodia    | 项目源码 | 文件源码
def disable():
    builtins.raw_input = original_raw_input
    builtins.input = original_input
项目:blender    作者:gastrodia    | 项目源码 | 文件源码
def input(prompt=''):
        return builtin_mod.input(prompt)
项目:blender    作者:gastrodia    | 项目源码 | 文件源码
def input(prompt=''):
        return builtin_mod.input(prompt)
项目:blender    作者:gastrodia    | 项目源码 | 文件源码
def input(prompt=''):
        return builtin_mod.raw_input(prompt)
项目:yatta_reader    作者:sound88    | 项目源码 | 文件源码
def input(prompt=''):
        return builtin_mod.input(prompt)
项目:yatta_reader    作者:sound88    | 项目源码 | 文件源码
def input(prompt=''):
        return builtin_mod.raw_input(prompt)
项目:yatta_reader    作者:sound88    | 项目源码 | 文件源码
def input(prompt=''):
        return builtin_mod.input(prompt)
项目:yatta_reader    作者:sound88    | 项目源码 | 文件源码
def input(prompt=''):
        return builtin_mod.raw_input(prompt)