本文整理匯總了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()