本文整理汇总了Python中ipykernel.kernelapp.IPKernelApp.launch_instance方法的典型用法代码示例。如果您正苦于以下问题:Python IPKernelApp.launch_instance方法的具体用法?Python IPKernelApp.launch_instance怎么用?Python IPKernelApp.launch_instance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ipykernel.kernelapp.IPKernelApp
的用法示例。
在下文中一共展示了IPKernelApp.launch_instance方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
# 需要导入模块: from ipykernel.kernelapp import IPKernelApp [as 别名]
# 或者: from ipykernel.kernelapp.IPKernelApp import launch_instance [as 别名]
def main():
"""launch a root kernel"""
try:
from ipykernel.kernelapp import IPKernelApp
except ImportError:
from IPython.kernel.zmq.kernelapp import IPKernelApp
IPKernelApp.launch_instance(kernel_class=ROOTKernel)
示例2: start_kernel
# 需要导入模块: from ipykernel.kernelapp import IPKernelApp [as 别名]
# 或者: from ipykernel.kernelapp.IPKernelApp import launch_instance [as 别名]
def start_kernel():
"""
Start Pytuga Jupyter kernel.
"""
from ipykernel.kernelapp import IPKernelApp
IPKernelApp.launch_instance(kernel_class=PytugaKernel)
示例3:
# 需要导入模块: from ipykernel.kernelapp import IPKernelApp [as 别名]
# 或者: from ipykernel.kernelapp.IPKernelApp import launch_instance [as 别名]
from ipykernel.kernelapp import IPKernelApp
from .kernel import CQLKernel
IPKernelApp.launch_instance(kernel_class=CQLKernel)
示例4: repr
# 需要导入模块: from ipykernel.kernelapp import IPKernelApp [as 别名]
# 或者: from ipykernel.kernelapp.IPKernelApp import launch_instance [as 别名]
backend = settings["backend"]
width, height = settings["size"]
resolution = settings["resolution"]
for k, v in {
"defaultfigurevisible": backends[backend],
"defaultfigurepaperpositionmode": "manual",
"defaultfigurepaperposition":
matlab.double([0, 0, width / resolution, height / resolution]),
"defaultfigurepaperunits": "inches"}.items():
self._matlab.set(0., k, v, nargout=0)
def repr(self, obj):
return obj
def restart_kernel(self):
self._matlab.exit()
self._matlab = matlab.engine.start_matlab()
self._first = True
def do_shutdown(self, restart):
self._matlab.exit()
return super(MatlabKernel, self).do_shutdown(restart)
if __name__ == '__main__':
try:
from ipykernel.kernelapp import IPKernelApp
except ImportError:
from IPython.kernel.zmq.kernelapp import IPKernelApp
IPKernelApp.launch_instance(kernel_class=MatlabKernel)
示例5: len
# 需要导入模块: from ipykernel.kernelapp import IPKernelApp [as 别名]
# 或者: from ipykernel.kernelapp.IPKernelApp import launch_instance [as 别名]
response = {'name': 'stdout', 'text': hist.outs[-1]}
self.send_response(self.iopub_socket, 'stream', response)
if interrupted:
return {'status': 'abort', 'execution_count': self.execution_count}
rtn = 0 if len(hist) == 0 else hist.rtns[-1]
if 0 < rtn:
message = {'status': 'error', 'execution_count': self.execution_count,
'ename': '', 'evalue': str(rtn), 'traceback': []}
else:
message = {'status': 'ok', 'execution_count': self.execution_count,
'payload': [], 'user_expressions': {}}
return message
def do_complete(self, code, pos):
"""Get completions."""
shell = builtins.__xonsh_shell__
comps, beg, end = shell.completer.find_and_complete(code, pos, shell.ctx)
message = {'matches': comps, 'cursor_start': beg, 'cursor_end': end+1,
'metadata': {}, 'status': 'ok'}
return message
if __name__ == '__main__':
from ipykernel.kernelapp import IPKernelApp
# must manually pass in args to avoid interfering w/ Jupyter arg parsing
with main_context(argv=['--shell-type=readline']):
IPKernelApp.launch_instance(kernel_class=XonshKernel)
示例6:
# 需要导入模块: from ipykernel.kernelapp import IPKernelApp [as 别名]
# 或者: from ipykernel.kernelapp.IPKernelApp import launch_instance [as 别名]
#
# Copyright SAS Institute
#
# Licensed under the Apache License, Version 2.0 (the License);
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
from ipykernel.kernelapp import IPKernelApp
from .kernel import SASKernel
IPKernelApp.launch_instance(kernel_class=SASKernel)
示例7:
# 需要导入模块: from ipykernel.kernelapp import IPKernelApp [as 别名]
# 或者: from ipykernel.kernelapp.IPKernelApp import launch_instance [as 别名]
from ipykernel.kernelapp import IPKernelApp
from .kernel import polymakeKernel
IPKernelApp.launch_instance(kernel_class=polymakeKernel)
示例8: jyrepl
# 需要导入模块: from ipykernel.kernelapp import IPKernelApp [as 别名]
# 或者: from ipykernel.kernelapp.IPKernelApp import launch_instance [as 别名]
except:
self._child.kill(signal.SIGKILL)
return {'status':'ok', 'restart':restart}
def jyrepl(self,code,timeout=None):
out=""
#this if is needed for printing output if command entered is "variable" or fucntions like abc(var) and for code completion
# if (len(re.split(r"\=",code.strip()))==1) and (len(re.split(r"[\ ]",code.strip()))==1):
# code='eval('+repr(code.strip())+')'
# self._child.sendline(code)
# now_prompt=self._child.expect_exact([u">>> ",u"... "])
# if len(self._child.before.splitlines())>1: out+='\n'.join(self._child.before.splitlines()[1:])+'\n'
# now_prompt=self._child.expect_exact([u">>> ",u"... "])
# else:
# code='exec('+repr(code)+')'
# for line in code.splitlines():
# self._child.sendline(line)
# now_prompt=self._child.expect_exact([u">>> ",u"... "])
# if len(self._child.before.splitlines())>1: out+='\n'.join(self._child.before.splitlines()[1:])+'\n'
# now_prompt=self._child.expect_exact([u">>> ",u"... "])
code='exec('+repr(code)+')'
for line in code.splitlines():
self._child.sendline(line)
now_prompt=self._child.expect_exact([u">>> ",u"... "])
if len(self._child.before.splitlines())>1: out+='\n'.join(self._child.before.splitlines()[1:])+'\n'
now_prompt=self._child.expect_exact([u">>> ",u"... "])
return out
if __name__ == '__main__':
from ipykernel.kernelapp import IPKernelApp
IPKernelApp.launch_instance(kernel_class=JythonKernel)
示例9: do_execute_command
# 需要导入模块: from ipykernel.kernelapp import IPKernelApp [as 别名]
# 或者: from ipykernel.kernelapp.IPKernelApp import launch_instance [as 别名]
self.send_response(self.iopub_socket, 'stream', stream_content)
if interrupted:
return {'status': 'abort', 'execution_count': self.execution_count}
return {'status': 'ok', 'execution_count': self.execution_count, 'payload': [], 'user_expressions': {}}
def do_execute_command(self, cmd, silent):
interrupted = False
if cmd.startswith('%'):
args = shlex.split(cmd)
cmd = args.pop(0)[1:]
if hasattr(self, '_cmd_' + cmd):
return getattr(self, '_cmd_' + cmd)(args, silent), interrupted
output = ''
try:
output = self.msf_wrapper.run_command(cmd, timeout=self.timeout)
except KeyboardInterrupt:
self.msf_wrapper.child.sendintr()
interrupted = True
self.msf_wrapper._expect_prompt()
output = self.msf_wrapper.child.before
except pexpect.EOF:
output = self.msf_wrapper.child.before + 'Restarting Metasploit'
self._start_msfconsole()
return output, interrupted
if __name__ == '__main__':
IPKernelApp.launch_instance(kernel_class=MetasploitKernel)