本文整理汇总了Python中IPython.frontend.terminal.interactiveshell.TerminalInteractiveShell.mainloop方法的典型用法代码示例。如果您正苦于以下问题:Python TerminalInteractiveShell.mainloop方法的具体用法?Python TerminalInteractiveShell.mainloop怎么用?Python TerminalInteractiveShell.mainloop使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IPython.frontend.terminal.interactiveshell.TerminalInteractiveShell
的用法示例。
在下文中一共展示了TerminalInteractiveShell.mainloop方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: interactive
# 需要导入模块: from IPython.frontend.terminal.interactiveshell import TerminalInteractiveShell [as 别名]
# 或者: from IPython.frontend.terminal.interactiveshell.TerminalInteractiveShell import mainloop [as 别名]
def interactive(idx=0, DongleClass=RfCat, intro=''):
global d
import rflib.chipcon_nic as rfnic
import atexit
d = DongleClass(idx=idx)
d.setModeRX() # this puts the dongle into receive mode
atexit.register(cleanupInteractiveAtExit)
gbls = globals()
lcls = locals()
try:
import IPython.Shell
ipsh = IPython.Shell.IPShell(argv=[''], user_ns=lcls, user_global_ns=gbls)
print intro
ipsh.mainloop(intro)
except ImportError, e:
try:
from IPython.frontend.terminal.interactiveshell import TerminalInteractiveShell
ipsh = TerminalInteractiveShell()
ipsh.user_global_ns.update(gbls)
ipsh.user_global_ns.update(lcls)
ipsh.autocall = 2 # don't require parenthesis around *everything*. be smart!
ipsh.mainloop(intro)
except ImportError, e:
print e
shell = code.InteractiveConsole(gbls)
shell.interact(intro)
示例2: handle
# 需要导入模块: from IPython.frontend.terminal.interactiveshell import TerminalInteractiveShell [as 别名]
# 或者: from IPython.frontend.terminal.interactiveshell.TerminalInteractiveShell import mainloop [as 别名]
def handle(self, *args, **kwargs):
imported_objects = {
'config' : self.config,
}
try:
# Try IPython imports
from IPython.frontend.terminal.interactiveshell import TerminalInteractiveShell
from IPython.config.loader import Config
cfg = Config()
shell = TerminalInteractiveShell(config=cfg, user_ns=imported_objects)
shell.mainloop(display_banner='\n Samovar \n')
except:
import code
code.InteractiveConsole(locals=imported_objects).interact()
示例3: debug
# 需要导入模块: from IPython.frontend.terminal.interactiveshell import TerminalInteractiveShell [as 别名]
# 或者: from IPython.frontend.terminal.interactiveshell.TerminalInteractiveShell import mainloop [as 别名]
def debug():
from IPython.frontend.terminal.interactiveshell import TerminalInteractiveShell
shell = TerminalInteractiveShell(user_ns=vars())
shell.mainloop()