當前位置: 首頁>>代碼示例>>Python>>正文


Python TerminalIPythonApp.instance方法代碼示例

本文整理匯總了Python中IPython.frontend.terminal.ipapp.TerminalIPythonApp.instance方法的典型用法代碼示例。如果您正苦於以下問題:Python TerminalIPythonApp.instance方法的具體用法?Python TerminalIPythonApp.instance怎麽用?Python TerminalIPythonApp.instance使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在IPython.frontend.terminal.ipapp.TerminalIPythonApp的用法示例。


在下文中一共展示了TerminalIPythonApp.instance方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: ipython_start

# 需要導入模塊: from IPython.frontend.terminal.ipapp import TerminalIPythonApp [as 別名]
# 或者: from IPython.frontend.terminal.ipapp.TerminalIPythonApp import instance [as 別名]
 def ipython_start(self):
     from IPython.frontend.terminal.ipapp import TerminalIPythonApp
     ip = TerminalIPythonApp.instance()
     ip.initialize(argv=[])
     for key, value in self.global_namespace().items():
         ip.shell.user_global_ns[key] = value
     ip.start()
開發者ID:adamchainz,項目名稱:hashdist,代碼行數:9,代碼來源:ipy_shell.py

示例2: __init__

# 需要導入模塊: from IPython.frontend.terminal.ipapp import TerminalIPythonApp [as 別名]
# 或者: from IPython.frontend.terminal.ipapp.TerminalIPythonApp import instance [as 別名]
    def __init__(self):
        """Constructor.

        Imports IPython's embedded shell with separator lines removed."""
        Shell.__init__(self)
        ConsoleProgressBarMixin.__init__(self)

        # We cannot use IPShellEmbed here because generator expressions do not
        # work there (e.g., set(g.degree(x) for x in [1,2,3])) where g comes
        # from an external context
        import sys

        from IPython import __version__ as ipython_version
        self.ipython_version = ipython_version

        try:
            # IPython >= 0.11 supports this
            from IPython.frontend.terminal.ipapp import TerminalIPythonApp
            self._shell = TerminalIPythonApp.instance()
            sys.argv.append("--nosep")
        except ImportError:
            # IPython 0.10 and earlier
            import IPython.Shell
            self._shell = IPython.Shell.start()
            self._shell.IP.runsource("from igraph import *")
            sys.argv.append("-nosep")
開發者ID:AdrianBajdiuk,項目名稱:PowerGridResillience,代碼行數:28,代碼來源:shell.py

示例3: _ipython_pre_100

# 需要導入模塊: from IPython.frontend.terminal.ipapp import TerminalIPythonApp [as 別名]
# 或者: from IPython.frontend.terminal.ipapp.TerminalIPythonApp import instance [as 別名]
    def _ipython_pre_100(self):
        """Start IPython pre-1.0.0"""
        from IPython.frontend.terminal.ipapp import TerminalIPythonApp

        app = TerminalIPythonApp.instance()
        app.initialize(argv=[])
        app.start()
開發者ID:yashu-seth,項目名稱:django,代碼行數:9,代碼來源:shell.py

示例4: debug_shell

# 需要導入模塊: from IPython.frontend.terminal.ipapp import TerminalIPythonApp [as 別名]
# 或者: from IPython.frontend.terminal.ipapp.TerminalIPythonApp import instance [as 別名]
def debug_shell(app):
    from IPython.frontend.terminal.ipapp import TerminalIPythonApp
    ip = TerminalIPythonApp.instance()
    ip.initialize(argv=[])
    ip.shell.user_global_ns['app'] = app
    ip.shell.user_global_ns['repo'] = app.repo
    ip.shell.user_global_ns['git'] = app.git
    ip.shell.user_global_ns['trac'] = app.trac
    def ipy_import(module_name, identifier):
        module = importlib.import_module(module_name)
        ip.shell.user_global_ns[identifier] = getattr(module, identifier) 
    ipy_import('git_trac.git_interface', 'GitInterface')
    ipy_import('git_trac.trac_server', 'TracServer')
    ip.start()
開發者ID:kcrisman,項目名稱:git-trac-command,代碼行數:16,代碼來源:cmdline.py

示例5: start_ipymote

# 需要導入模塊: from IPython.frontend.terminal.ipapp import TerminalIPythonApp [as 別名]
# 或者: from IPython.frontend.terminal.ipapp.TerminalIPythonApp import instance [as 別名]
def start_ipymote():
    import os
    import sys
    if sys.platform.startswith("win32") or sys.platform.startswith("linux2"):
        try:
            os.environ['VIRTUAL_ENV'] = os.environ['PYMOTE_ENV']
            os.environ['IPYTHONDIR'] = os.path.join(os.environ['PYMOTE_ENV'],
                                                    '.ipython')
        except KeyError:
            pass

        from IPython.frontend.terminal.ipapp import TerminalIPythonApp
        app = TerminalIPythonApp.instance()
        app.initialize(argv=['--profile=pymote'])
        app.start()
開發者ID:SoonSYJ,項目名稱:pymote2.0,代碼行數:17,代碼來源:ipymote.py

示例6: debug_shell

# 需要導入模塊: from IPython.frontend.terminal.ipapp import TerminalIPythonApp [as 別名]
# 或者: from IPython.frontend.terminal.ipapp.TerminalIPythonApp import instance [as 別名]
def debug_shell(app):
    from IPython.lib.inputhook import enable_gtk3
    enable_gtk3()
    from IPython.frontend.terminal.ipapp import TerminalIPythonApp
    ip = TerminalIPythonApp.instance()
    ip.initialize(argv=[])
    ip.shell.enable_gui('gtk3')
    ip.shell.user_global_ns['app'] = app
    ip.shell.user_global_ns['repo'] = app.model.repo
    ip.shell.user_global_ns['git'] = app.model.repo.git
    def ipy_import(module_name, identifier):
        module = importlib.import_module(module_name)
        ip.shell.user_global_ns[identifier] = getattr(module, identifier) 
    ipy_import('sageui.model.git_interface', 'GitInterface')
    ipy_import('sageui.model.git_repository', 'GitRepository')
    ip.start()
開發者ID:vbraun,項目名稱:SageUI,代碼行數:18,代碼來源:cmdline.py

示例7: debug_shell_gtk

# 需要導入模塊: from IPython.frontend.terminal.ipapp import TerminalIPythonApp [as 別名]
# 或者: from IPython.frontend.terminal.ipapp.TerminalIPythonApp import instance [as 別名]
    def debug_shell_gtk(self, app):
        from IPython.lib.inputhook import enable_gtk3

        enable_gtk3()
        from IPython.frontend.terminal.ipapp import TerminalIPythonApp

        ip = TerminalIPythonApp.instance()
        ip.initialize(argv=[])
        ip.shell.enable_gui("gtk3")
        ip.shell.user_global_ns["app"] = app

        def ipy_import(module_name, identifier):
            module = importlib.import_module(module_name)
            ip.shell.user_global_ns[identifier] = getattr(module, identifier)

        # ipy_import('sage_notebook.model.git_interface', 'GitInterface')
        ip.start()
開發者ID:bossjones,項目名稱:notebook,代碼行數:19,代碼來源:main_loop_gtk.py

示例8: ipython

# 需要導入模塊: from IPython.frontend.terminal.ipapp import TerminalIPythonApp [as 別名]
# 或者: from IPython.frontend.terminal.ipapp.TerminalIPythonApp import instance [as 別名]
 def ipython(self):
     try:
         from IPython.frontend.terminal.ipapp import TerminalIPythonApp
         app = TerminalIPythonApp.instance()
         app.initialize(argv=[])
         app.start()
     except ImportError:
         # IPython < 0.11
         # Explicitly pass an empty list as arguments, because otherwise
         # IPython would use sys.argv from this script.
         try:
             from IPython.Shell import IPShell
             shell = IPShell(argv=[])
             shell.mainloop()
         except ImportError:
             # IPython not found at all, raise ImportError
             raise
開發者ID:AdrianScott,項目名稱:django,代碼行數:19,代碼來源:shell.py

示例9: _launch_qt_console

# 需要導入模塊: from IPython.frontend.terminal.ipapp import TerminalIPythonApp [as 別名]
# 或者: from IPython.frontend.terminal.ipapp.TerminalIPythonApp import instance [as 別名]
def _launch_qt_console(ppid, connection_file):
    """called as a new process"""
    from IPython.frontend.terminal.ipapp import TerminalIPythonApp
    import threading
    import psutil
    import time

    # start a thread to kill this process when the parent process exits
    def thread_func():
        while True:
            if not psutil.pid_exists(ppid):
                os._exit(1)
            time.sleep(5)

    thread = threading.Thread(target=thread_func)
    thread.daemon = True
    thread.start()

    # start the qtconsole app
    app = TerminalIPythonApp.instance()
    app.initialize(["qtconsole", "--existing", connection_file])
    app.start()
開發者ID:pyxll,項目名稱:pyxll-examples,代碼行數:24,代碼來源:ipython.py

示例10: _ipython_pre_10

# 需要導入模塊: from IPython.frontend.terminal.ipapp import TerminalIPythonApp [as 別名]
# 或者: from IPython.frontend.terminal.ipapp.TerminalIPythonApp import instance [as 別名]
 def _ipython_pre_10(self):  # pragma: no cover
     from IPython.frontend.terminal.ipapp import TerminalIPythonApp
     app = TerminalIPythonApp.instance()
     app.initialize(argv=[])
     app.shell.user_ns.update(self.locals)
     app.start()
開發者ID:277800076,項目名稱:celery,代碼行數:8,代碼來源:celery.py

示例11: str

# 需要導入模塊: from IPython.frontend.terminal.ipapp import TerminalIPythonApp [as 別名]
# 或者: from IPython.frontend.terminal.ipapp.TerminalIPythonApp import instance [as 別名]
        print str(recommended)

    user_ns = user_ns or {}
    try:
        user_ns.update(get_args(sys.argv))
    except exception.SpockException, e:
        print e.message
        print 'Starting normal IPython console'
    except KeyboardInterrupt:
        print "\nUser pressed Ctrl+C. Exiting..."
        sys.exit()
    except Exception, e:
        print 'spock exited with an unmanaged exception: %s' % str(e)
        sys.exit(-2)

    app = TerminalIPythonApp.instance()
    app.initialize()
    #config = get_config()
    return app

def mainloop(app=None, user_ns=None):
    if app is None:
        app = start(user_ns)
    app.start()

def prepare_input_handler():
    # initialize input handler as soon as possible
    import sardana.spock.inputhandler
    _ = sardana.spock.inputhandler.InputHandler()

開發者ID:cmft,項目名稱:sardana,代碼行數:31,代碼來源:genutils.py

示例12: command

# 需要導入模塊: from IPython.frontend.terminal.ipapp import TerminalIPythonApp [as 別名]
# 或者: from IPython.frontend.terminal.ipapp.TerminalIPythonApp import instance [as 別名]
    def command(self, **options):
        from IPython.frontend.terminal.ipapp import TerminalIPythonApp

        app = TerminalIPythonApp.instance()
        app.initialize(argv=[])
        app.start()
開發者ID:VikParuchuri,項目名稱:percept,代碼行數:8,代碼來源:shell.py

示例13: ipython

# 需要導入模塊: from IPython.frontend.terminal.ipapp import TerminalIPythonApp [as 別名]
# 或者: from IPython.frontend.terminal.ipapp.TerminalIPythonApp import instance [as 別名]
def ipython():
    from IPython.frontend.terminal.ipapp import TerminalIPythonApp
    app = TerminalIPythonApp.instance()
    app.initialize(argv=[])
    app.shell.user_ns.update(_get_locals())
    app.start()
開發者ID:pombreda,項目名稱:UnnaturalCodeFork,代碼行數:8,代碼來源:harness.py

示例14: ipython

# 需要導入模塊: from IPython.frontend.terminal.ipapp import TerminalIPythonApp [as 別名]
# 或者: from IPython.frontend.terminal.ipapp.TerminalIPythonApp import instance [as 別名]
    def ipython(self, project, args, unknown_args):
        from IPython.frontend.terminal.ipapp import TerminalIPythonApp  # pylint: disable-msg=F0401

        app = TerminalIPythonApp.instance()
        app.initialize(argv=[])
        app.start()
開發者ID:osantana,項目名稱:forecast,代碼行數:8,代碼來源:shell.py

示例15:

# 需要導入模塊: from IPython.frontend.terminal.ipapp import TerminalIPythonApp [as 別名]
# 或者: from IPython.frontend.terminal.ipapp.TerminalIPythonApp import instance [as 別名]
import os
開發者ID:letouriste001,項目名稱:SmartForest_2.0,代碼行數:3,代碼來源:shell.py


注:本文中的IPython.frontend.terminal.ipapp.TerminalIPythonApp.instance方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。