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


Python InteractiveShellEmbed.register_magic_function方法代码示例

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


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

示例1: Device

# 需要导入模块: from IPython.terminal.embed import InteractiveShellEmbed [as 别名]
# 或者: from IPython.terminal.embed.InteractiveShellEmbed import register_magic_function [as 别名]
You can script the device's SCSI interface too:

    sc c ac              # Backdoor signature
    sc 8 ff 00 ff        # Undocumented firmware version
    ALSO: reset, eject, sc_sense, sc_read, scsi_in, scsi_out

Happy hacking!    -- Type 'thing?' for help on 'thing' or
~MeS`14              '?' for IPython, '%h' for this again.
"""

from IPython.terminal.embed import InteractiveShellEmbed
from shell_magics import ShellMagics
from remote import Device
import shell_namespace

# Make a global device, but only give it to the user namespace.
# Make it default by assigning it to 'd', our current device.
shell_namespace.d = shell_namespace.d_remote = Device()

# Make a shell that feels like a debugger
ipy = InteractiveShellEmbed(user_ns = shell_namespace.__dict__)
shell_namespace.ipy = ipy
ipy.register_magics(ShellMagics)
ipy.register_magic_function(lambda _: ipy.write(__doc__), magic_name='h')
ipy.alias_manager.define_alias('git', 'git')
ipy.alias_manager.define_alias('make', 'make')

# Hello, tiny world
ipy.mainloop(display_banner = __doc__)
开发者ID:chubbymaggie,项目名称:coastermelt,代码行数:31,代码来源:cmshell.py


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