本文整理汇总了Python中IPython.frontend.terminal.embed.InteractiveShellEmbed.instance方法的典型用法代码示例。如果您正苦于以下问题:Python InteractiveShellEmbed.instance方法的具体用法?Python InteractiveShellEmbed.instance怎么用?Python InteractiveShellEmbed.instance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IPython.frontend.terminal.embed.InteractiveShellEmbed
的用法示例。
在下文中一共展示了InteractiveShellEmbed.instance方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _12shell
# 需要导入模块: from IPython.frontend.terminal.embed import InteractiveShellEmbed [as 别名]
# 或者: from IPython.frontend.terminal.embed.InteractiveShellEmbed import instance [as 别名]
def _12shell(vars, message, prompt, exit_msg):
#prompt_message = "Welcome! Useful: G is the graph, DB, C"
prompt_message = message
from IPython.frontend.terminal.embed import InteractiveShellEmbed
from IPython.config.loader import Config
cfg = Config()
# cfg.InteractiveShellEmbed.prompt_in1="pylans:ipy> "
cfg.PromptManager.in_template="myprompt:> "
# cfg.InteractiveShellEmbed.prompt_out="myprompt [\\#]: "
cfg.InteractiveShellEmbed.profile="pysh"
ipshell = InteractiveShellEmbed.instance(config=cfg, user_ns=vars,
banner2=message, exit_msg=exit_msg)
return ipshell
示例2: shell
# 需要导入模块: from IPython.frontend.terminal.embed import InteractiveShellEmbed [as 别名]
# 或者: from IPython.frontend.terminal.embed.InteractiveShellEmbed import instance [as 别名]
def shell(no_ipython):
"""Start a new interactive python session."""
banner = 'Interactive Werkzeug Shell'
namespace = make_shell()
if not no_ipython:
try:
try:
from IPython.frontend.terminal.embed import InteractiveShellEmbed
sh = InteractiveShellEmbed.instance(banner1=banner)
except ImportError:
from IPython.Shell import IPShellEmbed
sh = IPShellEmbed(banner=banner)
except ImportError:
pass
else:
sh(local_ns=namespace)
return
from code import interact
interact(banner, local=namespace)
示例3: action
# 需要导入模块: from IPython.frontend.terminal.embed import InteractiveShellEmbed [as 别名]
# 或者: from IPython.frontend.terminal.embed.InteractiveShellEmbed import instance [as 别名]
def action(ipython=use_ipython):
"""Start a new interactive python session."""
namespace = init_func()
if ipython:
try:
try:
from IPython.frontend.terminal.embed import InteractiveShellEmbed
sh = InteractiveShellEmbed.instance(banner1=banner)
except ImportError:
from IPython.Shell import IPShellEmbed
sh = IPShellEmbed(banner=banner)
except ImportError:
pass
else:
sh(local_ns=namespace)
return
from code import interact
interact(banner, local=namespace)
示例4: ip
# 需要导入模块: from IPython.frontend.terminal.embed import InteractiveShellEmbed [as 别名]
# 或者: from IPython.frontend.terminal.embed.InteractiveShellEmbed import instance [as 别名]
def ip(banner1='Dropping into IPython\n', **kw):
"interactive IPython shell"
shell = InteractiveShellEmbed.instance(banner1=banner1, **kw)
shell(header='', stack_depth=2)
示例5: create
# 需要导入模块: from IPython.frontend.terminal.embed import InteractiveShellEmbed [as 别名]
# 或者: from IPython.frontend.terminal.embed.InteractiveShellEmbed import instance [as 别名]
def create(path="~", args=[], log=None, shell=False):
"""
Creates a paul-browser instance, returns the main window object.
A "paul-browser" is a GUI window featuring a tree-view and a
paul viewer window. Clicking on an item in the tree view will
display it in the viewer window.
Parameters:
*path*: Starting point of the tree view, if specified
*args*: Arguments to pass to the paul-browser. You can
pass qt command line arguments, or a single
file name, which, if it is an IBW, will be loaded
and displayed.
*shell*: If 'True', the paul-browser will feature an interactive
IPython shell in the main terminal, which can be used
for introspection and for control of main features
of the paul-browser. Enjoy! ;-)
Default is 'False', but the parameter will be set
explicitly 'True' when the browser is called as a
stand-alone application.
"""
app = gui.get_app_qt4(args)
# find the first non-option argument
if len(args) > 1:
for a in args[1:]:
if a[0] != "-":
path = a
break
if log is not None:
log.debug("Start path is '%s'" % path)
main_win = BrowserWindow(path)
main_win.show()
if shell:
# Start an interactive shell, this will be the name space
# of the shell. Basically, everything needs to be accessed
# through main_win (aliased 'P' in the shell :-) )
import numpy as np
import scipy as sp
import matplotlib as mpl
import paul.loader.igor as igor
import paul.loader.elmitec as elmitec
import paul.base.wave as wave
import paul.base.wave as wave
import paul.toolbox.arpes as arpes
import paul.toolbox.arplot as arplot
import paul.toolbox.atrix as atrix
import paul.toolbox as tools
import paul.shell as psh
P = main_win
ipshell = InteractiveShellEmbed.instance()
IPython.lib.inputhook.enable_gui(gui="qt")
ipshell()
if not gui.is_event_loop_running_qt4():
if log is not None:
log.debug("Starting main event loop")
app.exec_()
else:
if log is not None:
log.debug("Event loop is already running")
return main_win
示例6: ip
# 需要导入模块: from IPython.frontend.terminal.embed import InteractiveShellEmbed [as 别名]
# 或者: from IPython.frontend.terminal.embed.InteractiveShellEmbed import instance [as 别名]
def ip(banner1='', **kw):
shell = InteractiveShellEmbed.instance(banner1=banner1, **kw)
shell(header='', stack_depth=2)