当前位置: 首页>>代码示例>>Python>>正文


Python TerminalInteractiveShell.raw_input方法代码示例

本文整理汇总了Python中IPython.terminal.interactiveshell.TerminalInteractiveShell.raw_input方法的典型用法代码示例。如果您正苦于以下问题:Python TerminalInteractiveShell.raw_input方法的具体用法?Python TerminalInteractiveShell.raw_input怎么用?Python TerminalInteractiveShell.raw_input使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IPython.terminal.interactiveshell.TerminalInteractiveShell的用法示例。


在下文中一共展示了TerminalInteractiveShell.raw_input方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: raw_input

# 需要导入模块: from IPython.terminal.interactiveshell import TerminalInteractiveShell [as 别名]
# 或者: from IPython.terminal.interactiveshell.TerminalInteractiveShell import raw_input [as 别名]
 def raw_input(self, *args, **kw):
     try:
         return TerminalInteractiveShell.raw_input(self,
             *args, **kw) # needs decoding (see below)?
     except EOFError:
         r = raw_input("Do you wish to commit your "
                     "database changes? [yes]")
         if not r.lower().startswith("n"):
             if using_sqlalchemy:
                 self.push("session.flush()")
             else:
                 self.push("hub.commit()")
         raise EOFError
开发者ID:OnShift,项目名称:turbogears,代码行数:15,代码来源:base.py

示例2: get_python_console

# 需要导入模块: from IPython.terminal.interactiveshell import TerminalInteractiveShell [as 别名]
# 或者: from IPython.terminal.interactiveshell.TerminalInteractiveShell import raw_input [as 别名]
def get_python_console(namespace=None):
    """
    Return a interactive python console instance with caller's stack
    """

    if namespace is None:
        import inspect

        frame = inspect.currentframe()
        caller = frame.f_back
        if not caller:
            logging.error("can't find caller who start this console.")
            caller = frame
        namespace = dict(caller.f_globals)
        namespace.update(caller.f_locals)

    try:
        from IPython.terminal.interactiveshell import TerminalInteractiveShell

        shell = TerminalInteractiveShell(user_ns=namespace)
    except ImportError:
        try:
            import readline
            import rlcompleter

            readline.set_completer(rlcompleter.Completer(namespace).complete)
            readline.parse_and_bind("tab: complete")
        except ImportError:
            pass
        import code

        shell = code.InteractiveConsole(namespace)
        shell._quit = False

        def exit():
            shell._quit = True

        def readfunc(prompt=""):
            if shell._quit:
                raise EOFError
            return six.moves.input(prompt)

        # inject exit method
        shell.ask_exit = exit
        shell.raw_input = readfunc

    return shell
开发者ID:railroadman,项目名称:pyspider,代码行数:49,代码来源:utils.py

示例3: raw_input

# 需要导入模块: from IPython.terminal.interactiveshell import TerminalInteractiveShell [as 别名]
# 或者: from IPython.terminal.interactiveshell.TerminalInteractiveShell import raw_input [as 别名]
 def raw_input(self, prompt=""):
     # TODO correct eof issue with custom prompt.
     prompt = "iridium >>>"
     return TerminalInteractiveShell.raw_input(self, prompt)
开发者ID:subecho,项目名称:Iridium,代码行数:6,代码来源:cli.py


注:本文中的IPython.terminal.interactiveshell.TerminalInteractiveShell.raw_input方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。