solvebio/cli/ipython.py
def launch_ipython_legacy_shell(args):  # pylint: disable=unused-argument
    """Open the SolveBio shell (IPython wrapper) for older IPython versions"""
    try:
        from IPython.config.loader import Config
    except ImportError:
        _print("The SolveBio Python shell requires IPython.\n"
               "To install, type: 'pip install ipython'")
        return False

    try:
        # see if we're already inside IPython
        get_ipython  # pylint: disable=undefined-variable
    except NameError:
        cfg = Config()
        prompt_config = cfg.PromptManager
        prompt_config.in_template = '[SolveBio] In <\\#>: '
        prompt_config.in2_template = '   .\\D.: '
        prompt_config.out_template = 'Out<\\#>: '
        banner1 = '\nSolveBio Python shell started.'

        exit_msg = 'Quitting SolveBio shell.'
    else:
        _print("Running nested copies of IPython.")
        cfg = Config()
        banner1 = exit_msg = ''

    # First import the embeddable shell class
    try:
        from IPython.terminal.embed import InteractiveShellEmbed
    except ImportError:
        # pylint: disable=import-error,no-name-in-module
        from IPython.frontend.terminal.embed import InteractiveShellEmbed

    path = os.path.dirname(os.path.abspath(__file__))
    init_file = '{}/ipython_init.py'.format(path)
    exec(compile(open(init_file).read(), init_file, 'exec'),
         globals(), locals())

    InteractiveShellEmbed(config=cfg, banner1=banner1, exit_msg=exit_msg)()
def launch_ipython_legacy_shell(args):  # pylint: disable=unused-argument
    """Open the SolveBio shell (IPython wrapper) for older IPython versions"""
    try:
        from IPython.config.loader import Config
    except ImportError:
        _print("The SolveBio Python shell requires IPython.\n"
               "To install, type: 'pip install ipython'")
        return False

    try:
        # see if we're already inside IPython
        get_ipython  # pylint: disable=undefined-variable
    except NameError:
        cfg = Config()
        prompt_config = cfg.PromptManager
        prompt_config.in_template = '[SolveBio] In <\\#>: '
        prompt_config.in2_template = '   .\\D.: '
        prompt_config.out_template = 'Out<\\#>: '
        banner1 = '\nSolveBio Python shell started.'

        exit_msg = 'Quitting SolveBio shell.'
    else:
        _print("Running nested copies of IPython.")
        cfg = Config()
        banner1 = exit_msg = ''

    # First import the embeddable shell class
    try:
        from IPython.terminal.embed import InteractiveShellEmbed
    except ImportError:
        # pylint: disable=import-error,no-name-in-module
        from IPython.frontend.terminal.embed import InteractiveShellEmbed

    path = os.path.dirname(os.path.abspath(__file__))
    init_file = '{}/ipython_init.py'.format(path)
    exec(compile(open(init_file).read(), init_file, 'exec'),
         globals(), locals())

    InteractiveShellEmbed(config=cfg, banner1=banner1, exit_msg=exit_msg)()
def launch_ipython_legacy_shell ( args ) : # pylint: disable=unused-argument try : from IPython . config . loader import Config except ImportError : _print ( "The SolveBio Python shell requires IPython.\n" "To install, type: 'pip install ipython'" ) return False try : # see if we're already inside IPython get_ipython # pylint: disable=undefined-variable except NameError : cfg = Config ( ) prompt_config = cfg . PromptManager prompt_config . in_template = '[SolveBio] In <\\#>: ' prompt_config . in2_template = '   .\\D.: ' prompt_config . out_template = 'Out<\\#>: ' banner1 = '\nSolveBio Python shell started.' exit_msg = 'Quitting SolveBio shell.' else : _print ( "Running nested copies of IPython." ) cfg = Config ( ) banner1 = exit_msg = '' # First import the embeddable shell class try : from IPython . terminal . embed import InteractiveShellEmbed except ImportError : # pylint: disable=import-error,no-name-in-module from IPython . frontend . terminal . embed import InteractiveShellEmbed path = os . path . dirname ( os . path . abspath ( __file__ ) ) init_file = '{}/ipython_init.py' . format ( path ) exec ( compile ( open ( init_file ) . read ( ) , init_file , 'exec' ) , globals ( ) , locals ( ) ) InteractiveShellEmbed ( config = cfg , banner1 = banner1 , exit_msg = exit_msg ) ( )
Open the SolveBio shell (IPython wrapper) for older IPython versions
Open the SolveBio shell ( IPython wrapper ) for older IPython versions