本文整理汇总了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()
示例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()
示例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()
示例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()
示例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
示例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 = []
示例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);
示例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)
示例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()
示例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()
示例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)
示例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()
示例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()
示例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()
示例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