def shell(no_ipython): """Start a new interactive python session.""" banner = ('\nWelcome to the interactive shell environment of LodgeIt!\n' '\n' 'You can use the following predefined objects: app, local, db.\n' 'To run the application (creates a request) use *run_app*.') 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)
def _start_ipython1(overrides, banner, *, debug=False): try: from IPython.frontend.terminal.embed import InteractiveShellEmbed except ImportError: if debug: print_exc() return None return InteractiveShellEmbed.instance(banner1=banner, user_ns=overrides)
def _start_ipython4(overrides, banner, *, debug=False): try: from IPython.terminal.embed import InteractiveShellEmbed shell = InteractiveShellEmbed.instance() except ImportError: if debug: print_exc() return None return partial(shell.mainloop, local_ns=overrides, display_banner=banner)
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
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)
def shell(no_ipython): """Start a new interactive python session.""" banner = 'Interactive Werkzeug Shell' namespace = {'app': make_app()} 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)
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)
def ip(banner1='Dropping into IPython\n', **kw): "interactive IPython shell" shell = InteractiveShellEmbed.instance(banner1=banner1, **kw) shell(header='', stack_depth=2)
def shell(): from IPython.frontend.terminal.embed import InteractiveShellEmbed sh = InteractiveShellEmbed.instance(banner1="standard-web-flask shell") sh(local_ns={'application': app})
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
def ip(banner1='', **kw): shell = InteractiveShellEmbed.instance(banner1=banner1, **kw) shell(header='', stack_depth=2)