本文整理汇总了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__)