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


Python Kernel.__init__方法代码示例

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


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

示例1: __init__

# 需要导入模块: from ipykernel.kernelbase import Kernel [as 别名]
# 或者: from ipykernel.kernelbase.Kernel import __init__ [as 别名]
 def __init__(self, **kwargs):
     Kernel.__init__(self, **kwargs)
     log('inside init')
     # Catch KeyboardInterrupt, cancel query, raise QueryCancelledError
     psycopg2.extensions.set_wait_callback(wait_select_inter)
     self._conn_string = os.getenv('DATABASE_URL', '')
     self._autocommit = True
     self._conn = None
     self._start_connection()
开发者ID:bgschiller,项目名称:postgres_kernel,代码行数:11,代码来源:kernel.py

示例2: __init__

# 需要导入模块: from ipykernel.kernelbase import Kernel [as 别名]
# 或者: from ipykernel.kernelbase.Kernel import __init__ [as 别名]
    def __init__(self, **kwargs):
        Kernel.__init__(self, **kwargs)
        # The path to the unix micropython should be in the PATH, if not check
        # the env for MPUNIX
        #TODO: Use shutil.which() in python 3.3+
        self.micropython_exe = 'micropython'
        if os.environ.get('MPUNIX') is not None:
            self.micropython_exe = os.environ.get('MPUNIX')

        self._start_interpreter()
开发者ID:TDAbboud,项目名称:mpkernel,代码行数:12,代码来源:unix.py

示例3: __init__

# 需要导入模块: from ipykernel.kernelbase import Kernel [as 别名]
# 或者: from ipykernel.kernelbase.Kernel import __init__ [as 别名]
 def __init__(self, **kwargs):
     Kernel.__init__(self, **kwargs)
     self._replace_get_ipython()
     self.comm_manager = CommManager(shell=None, parent=self,
                                     kernel=self)
     self.shell_handlers['comm_open'] = self.comm_manager.comm_open
     self.shell_handlers['comm_msg'] = self.comm_manager.comm_msg
     self.shell_handlers['comm_close'] = self.comm_manager.comm_close
     if ipywidgets_extension_loaded:
         self.comm_manager.register_target('ipython.widget', Widget.handle_comm_opened)
     self._start_polymake()
开发者ID:sebasguts,项目名称:jupyter-polymake,代码行数:13,代码来源:kernel.py

示例4: __init__

# 需要导入模块: from ipykernel.kernelbase import Kernel [as 别名]
# 或者: from ipykernel.kernelbase.Kernel import __init__ [as 别名]
    def __init__(self, **kwargs):
        Kernel.__init__(self, **kwargs)
        self._replace_get_ipython()
        self.comm_manager = CommManager(shell=None, parent=self, kernel=self)

        self.shell_handlers["comm_open"] = self.comm_manager.comm_open
        self.shell_handlers["comm_msg"] = self.comm_manager.comm_msg
        self.shell_handlers["comm_close"] = self.comm_manager.comm_close

        self.comm_manager.register_target("ipython.widget", Widget.handle_comm_opened)
        self._start_singular()
开发者ID:sebasguts,项目名称:jupyter-singular,代码行数:13,代码来源:kernel.py

示例5: __init__

# 需要导入模块: from ipykernel.kernelbase import Kernel [as 别名]
# 或者: from ipykernel.kernelbase.Kernel import __init__ [as 别名]
    def __init__(self, **kwargs):
        self.mathjax_initialized = False
        Kernel.__init__(self, **kwargs)
        if self.log is None:
            # This occurs if we call as a stand-alone kernel
            # (eg, not as a process)
            # FIXME: take care of input/output, eg StringIO
            #        make work without a session
            self.log = logging.Logger("NotebookApp")

        self.definitions = Definitions(add_builtin=True)        # TODO Cache
        self.definitions.set_ownvalue('$Line', Integer(0))  # Reset the line number
开发者ID:mmatera,项目名称:IMathics,代码行数:14,代码来源:kernel.py

示例6: __init__

# 需要导入模块: from ipykernel.kernelbase import Kernel [as 别名]
# 或者: from ipykernel.kernelbase.Kernel import __init__ [as 别名]
    def __init__(self, **kwargs):
        Kernel.__init__(self, **kwargs)
        self._start_jython()

        try:
            self.hist_file = os.path.join(locate_profile(),'jython_kernel.hist')
        except:
            self.hist_file = None
            self.log.warn('No default profile found, history unavailable')

        self.max_hist_cache = 1000
        self.hist_cache = []
开发者ID:suvarchal,项目名称:IJython,代码行数:14,代码来源:jython_kernel.py

示例7: __init__

# 需要导入模块: from ipykernel.kernelbase import Kernel [as 别名]
# 或者: from ipykernel.kernelbase.Kernel import __init__ [as 别名]
    def __init__(self, **kwargs):
        """
        Constructor
        """
        Kernel.__init__(self, **kwargs);
        opt = "";
        if "LOG4J_CONF_FILE" in os.environ:
            opt += " -4 " + os.environ["LOG4J_CONF_FILE"];
        # Start grunt
        self.pig = pexpect.spawn("/opt/pig-0.15.0/bin/pig -x local " + opt);

        # Wait until grunt start
        self.pig.expect(GRUNT_NEW_LINE_MODEL, timeout=GRUNT_START_TIMEOUT);
开发者ID:Valdimus,项目名称:SimplePigKernel,代码行数:15,代码来源:kernel.py

示例8: __init__

# 需要导入模块: from ipykernel.kernelbase import Kernel [as 别名]
# 或者: from ipykernel.kernelbase.Kernel import __init__ [as 别名]
    def __init__(self, **kwargs):
        Kernel.__init__(self, **kwargs)
        
        # powershell_command env variable is set by the kernel to allow both powershell and pwsh
        # but on python2 we cannot pass it thru env variable, see https://github.com/vors/jupyter-powershell/issues/7
        # TODO(python2): can we pass it somehow differently and still provide user-picked value on python2?
        try:
            powershell_command = environ['powershell_command']
        except:
            powershell_command = get_powershell()

        repl = subprocess_repl.SubprocessRepl([powershell_command, '-noprofile', '-File', '-'])
        self.proxy = powershell_proxy.ReplProxy(repl)
开发者ID:osmsc,项目名称:SimVascular,代码行数:15,代码来源:kernel.py

示例9: __init__

# 需要导入模块: from ipykernel.kernelbase import Kernel [as 别名]
# 或者: from ipykernel.kernelbase.Kernel import __init__ [as 别名]
    def __init__(self, **kwargs):
        Kernel.__init__(self, **kwargs)
        self._start_ncl()

        try:
            self.hist_file = os.path.join(locate_profile(),'ncl_kernel.hist')
        except:
            self.hist_file = None
            self.log.warn('No default profile found, history unavailable')

        self.max_hist_cache = 1000
        self.hist_cache = []
	#self._default_matches=cPickle.load(open('data/inbuilt_list', 'rb'))
        self._default_matches=self.inbuiltlist()
开发者ID:suvarchal,项目名称:IPyNCL,代码行数:16,代码来源:ncl_kernel.py

示例10: __init__

# 需要导入模块: from ipykernel.kernelbase import Kernel [as 别名]
# 或者: from ipykernel.kernelbase.Kernel import __init__ [as 别名]
    def __init__(self, **kwargs):
        Kernel.__init__(self, **kwargs)
        ON_POSIX = 'posix' in sys.builtin_module_names

        def enqueue_output(out, queue):
            for line in iter(out.readline, b''):
                queue.put(line)
            out.close()
        
        self._gforth = Popen('gforth', stdin=PIPE, stdout=PIPE, bufsize=2, close_fds=ON_POSIX)
        self._gforth_queue = Queue()

        t = Thread(target=enqueue_output, args=(self._gforth.stdout, self._gforth_queue))
        t.daemon = True
        t.start()
开发者ID:erasmusa,项目名称:iforth,代码行数:17,代码来源:forth_kernel.py

示例11: __init__

# 需要导入模块: from ipykernel.kernelbase import Kernel [as 别名]
# 或者: from ipykernel.kernelbase.Kernel import __init__ [as 别名]
    def __init__(self, **kwargs):
        Kernel.__init__(self, **kwargs)

        # Instantiate IPython.core.debugger.Pdb here, pass it a phony 
        # stdout that provides a dummy flush() method and a write() method
        # that internally sends data using a function so that it can
        # be initialized to use self.send_response()
        write_func = lambda s: self.send_response(self.iopub_socket,
                                                  'stream',
                                                  {'name': 'stdout',
                                                   'text': s})
        sys.excepthook = functools.partial(BdbQuit_excepthook,
                                           excepthook=sys.excepthook)
        self.debugger = Pdb(stdout=PhonyStdout(write_func))
        self.debugger.set_trace(sys._getframe().f_back)
开发者ID:lebedov,项目名称:ipdbkernel,代码行数:17,代码来源:ipdbkernel.py

示例12: __init__

# 需要导入模块: from ipykernel.kernelbase import Kernel [as 别名]
# 或者: from ipykernel.kernelbase.Kernel import __init__ [as 别名]
 def __init__(self, **kwargs):
     Kernel.__init__(self, **kwargs)
     self._start_magma()
开发者ID:cgranade,项目名称:magma_kernel,代码行数:5,代码来源:kernel.py

示例13: __init__

# 需要导入模块: from ipykernel.kernelbase import Kernel [as 别名]
# 或者: from ipykernel.kernelbase.Kernel import __init__ [as 别名]
 def __init__(self, **kwargs):
     Kernel.__init__(self, **kwargs)
     self.hostname = os.environ.get('CASSANDRA_HOSTNAME','localhost')
     self._start_cql()
开发者ID:bhmortim,项目名称:cql_kernel,代码行数:6,代码来源:kernel.py

示例14: __init__

# 需要导入模块: from ipykernel.kernelbase import Kernel [as 别名]
# 或者: from ipykernel.kernelbase.Kernel import __init__ [as 别名]
 def __init__(self, **kwargs):
     Kernel.__init__(self, **kwargs)
     self.start_redis(**kwargs)
     self.get_commands()
     self.start_history()
开发者ID:supercoderz,项目名称:redis_kernel,代码行数:7,代码来源:kernel.py

示例15: __init__

# 需要导入模块: from ipykernel.kernelbase import Kernel [as 别名]
# 或者: from ipykernel.kernelbase.Kernel import __init__ [as 别名]
 def __init__(self, **kwargs):
     Kernel.__init__(self, **kwargs)
     self.tcl = Tkinter.Tcl()
     self.execution_count = 0
开发者ID:ryanpepper,项目名称:tcl_kernel,代码行数:6,代码来源:kernel.py


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