本文整理汇总了Python中IPython.kernel.inprocess.blocking.BlockingInProcessKernelClient.get_shell_msg方法的典型用法代码示例。如果您正苦于以下问题:Python BlockingInProcessKernelClient.get_shell_msg方法的具体用法?Python BlockingInProcessKernelClient.get_shell_msg怎么用?Python BlockingInProcessKernelClient.get_shell_msg使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IPython.kernel.inprocess.blocking.BlockingInProcessKernelClient
的用法示例。
在下文中一共展示了BlockingInProcessKernelClient.get_shell_msg方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_complete
# 需要导入模块: from IPython.kernel.inprocess.blocking import BlockingInProcessKernelClient [as 别名]
# 或者: from IPython.kernel.inprocess.blocking.BlockingInProcessKernelClient import get_shell_msg [as 别名]
def test_complete(self):
""" Does requesting completion from an in-process kernel work?
"""
km = InProcessKernelManager()
km.start_kernel()
kc = BlockingInProcessKernelClient(kernel=km.kernel)
kc.start_channels()
km.kernel.shell.push({"my_bar": 0, "my_baz": 1})
kc.complete("my_ba", "my_ba", 5)
msg = kc.get_shell_msg()
self.assertEqual(msg["header"]["msg_type"], "complete_reply")
self.assertEqual(sorted(msg["content"]["matches"]), ["my_bar", "my_baz"])
示例2: test_object_info
# 需要导入模块: from IPython.kernel.inprocess.blocking import BlockingInProcessKernelClient [as 别名]
# 或者: from IPython.kernel.inprocess.blocking.BlockingInProcessKernelClient import get_shell_msg [as 别名]
def test_object_info(self):
""" Does requesting object information from an in-process kernel work?
"""
km = InProcessKernelManager()
km.start_kernel()
kc = BlockingInProcessKernelClient(kernel=km.kernel)
kc.start_channels()
km.kernel.shell.user_ns['foo'] = 1
kc.object_info('foo')
msg = kc.get_shell_msg()
self.assertEquals(msg['header']['msg_type'], 'object_info_reply')
self.assertEquals(msg['content']['name'], 'foo')
self.assertEquals(msg['content']['type_name'], 'int')
示例3: test_complete
# 需要导入模块: from IPython.kernel.inprocess.blocking import BlockingInProcessKernelClient [as 别名]
# 或者: from IPython.kernel.inprocess.blocking.BlockingInProcessKernelClient import get_shell_msg [as 别名]
def test_complete(self):
""" Does requesting completion from an in-process kernel work?
"""
km = InProcessKernelManager()
km.start_kernel()
kc = BlockingInProcessKernelClient(kernel=km.kernel)
kc.start_channels()
km.kernel.shell.push({'my_bar': 0, 'my_baz': 1})
kc.complete('my_ba', 'my_ba', 5)
msg = kc.get_shell_msg()
self.assertEqual(msg['header']['msg_type'], 'complete_reply')
self.assertEqual(sorted(msg['content']['matches']),
['my_bar', 'my_baz'])
示例4: test_inspect
# 需要导入模块: from IPython.kernel.inprocess.blocking import BlockingInProcessKernelClient [as 别名]
# 或者: from IPython.kernel.inprocess.blocking.BlockingInProcessKernelClient import get_shell_msg [as 别名]
def test_inspect(self):
""" Does requesting object information from an in-process kernel work?
"""
km = InProcessKernelManager()
km.start_kernel()
kc = BlockingInProcessKernelClient(kernel=km.kernel)
kc.start_channels()
km.kernel.shell.user_ns['foo'] = 1
kc.inspect('foo')
msg = kc.get_shell_msg()
self.assertEqual(msg['header']['msg_type'], 'inspect_reply')
content = msg['content']
assert content['found']
text = content['data']['text/plain']
self.assertIn('int', text)