当前位置: 首页>>代码示例>>Python>>正文


Python IPKernelApp.initialize方法代码示例

本文整理汇总了Python中IPython.zmq.ipkernel.IPKernelApp.initialize方法的典型用法代码示例。如果您正苦于以下问题:Python IPKernelApp.initialize方法的具体用法?Python IPKernelApp.initialize怎么用?Python IPKernelApp.initialize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IPython.zmq.ipkernel.IPKernelApp的用法示例。


在下文中一共展示了IPKernelApp.initialize方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: InternalIPKernel

# 需要导入模块: from IPython.zmq.ipkernel import IPKernelApp [as 别名]
# 或者: from IPython.zmq.ipkernel.IPKernelApp import initialize [as 别名]
class InternalIPKernel(object):
    """Class for managing an IPython kernel inside of QGIS.

    IPython normally runs kernels in seperate processes, but this setup is
    limiting in the case of QGIS because external kernels cannot access the
    data and variables that QGIS is working with. This class manages an
    in-process kernel and is capable of launching external consoles that can
    attach to the kernel.

    IPython Consoles are run as external processes because they rely on
    Version 2 of the PyQt api and QGIS is using Version 1 which is
    incompatible.
    """
    def __init__(self):
        self.ipkernel = IPKernelApp()
        self.ipkernel.initialize(['python',
            # Ensure the Kernel pre-loads the same modules as are available
            # from the QGIS python console.
            "--c='from qgis.core import *;import qgis.utils;'"])
        # Ensure we use an event loop that is QGIS-friendly.
        self.ipkernel.kernel.eventloop = loop_qgis
        self.ipkernel.start()

        # To create and track active qt consoles
        self._qtconsole_cmd = ['ipython', 'qtconsole', '--existing'] + \
                [os.path.basename(self.ipkernel.connection_file)]
        self.consoles = []

    def new_qt_console(self, evt=None):
        self.consoles.append(subprocess.Popen(self._qtconsole_cmd))

    def cleanup_consoles(self, evt=None):
        for c in self.consoles:
            c.kill()
开发者ID:carriercomm,项目名称:qgis-ipython,代码行数:36,代码来源:internal_ipkernel.py

示例2: pylab_kernel

# 需要导入模块: from IPython.zmq.ipkernel import IPKernelApp [as 别名]
# 或者: from IPython.zmq.ipkernel.IPKernelApp import initialize [as 别名]
def pylab_kernel(gui):
    """Launch and return an IPython kernel with pylab support for the desired gui
    """
    kernel = IPKernelApp()
    kernel.initialize(['python', '--pylab=%s' % gui,
                       #'--log-level=10'
                       ])
    return kernel
开发者ID:AhmedPho,项目名称:ipython,代码行数:10,代码来源:internal_ipkernel.py

示例3: pylab_kernel

# 需要导入模块: from IPython.zmq.ipkernel import IPKernelApp [as 别名]
# 或者: from IPython.zmq.ipkernel.IPKernelApp import initialize [as 别名]
def pylab_kernel(gui):
    """Launch and return an IPython kernel with pylab support for the desired gui
    """
    kernel = IPKernelApp()
    # FIXME: we're hardcoding the heartbeat port b/c of a bug in IPython 0.11
    # that will set it to 0 if not specified.  Once this is fixed, the --hb
    # parameter can be omitted and all ports will be automatic
    kernel.initialize(['python', '--pylab=%s' % gui, '--hb=19999',
                       #'--log-level=10'
                       ])
    return kernel
开发者ID:Paolopost,项目名称:fos,代码行数:13,代码来源:fosapp.py

示例4: locals

# 需要导入模块: from IPython.zmq.ipkernel import IPKernelApp [as 别名]
# 或者: from IPython.zmq.ipkernel.IPKernelApp import initialize [as 别名]
    sys.path.remove(osp.dirname(__file__))
except ValueError:
    pass


locals().pop('__file__')
__doc__ = ''
__name__ = '__main__'


if os.environ.get('IPYTHON_KERNEL', False):

    # IPython >=v0.11 Kernel
    from IPython.zmq.ipkernel import IPKernelApp
    __ipythonkernel__ = IPKernelApp().instance()
    __ipythonkernel__.initialize(sys.argv[1:])
    __ipythonshell__ = __ipythonkernel__.shell
    __ipythonkernel__.start()

elif os.environ.get('IPYTHON', False):

    sys.path.insert(0, '')
    if os.name == 'nt':
        # Windows platforms: monkey-patching *pyreadline* module
        # to make IPython work in a remote process
        from pyreadline import unicode_helper
        unicode_helper.pyreadline_codepage = "ascii"
        # For pyreadline >= v1.7:
        from pyreadline import rlmain
        class Readline(rlmain.Readline):
            def __init__(self):
开发者ID:jromang,项目名称:retina-old,代码行数:33,代码来源:startup.py


注:本文中的IPython.zmq.ipkernel.IPKernelApp.initialize方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。