MCPcopy Create free account
hub / github.com/ipython/ipython / _tr_magic

Function _tr_magic

IPython/core/inputtransformer.py:231–240  ·  view source on GitHub ↗

Translate lines escaped with: %

(line_info)

Source from the content-addressed store, hash-verified

229 return _make_help_call(line_info.ifun, line_info.esc, line_info.pre)
230
231def _tr_magic(line_info):
232 "Translate lines escaped with: %"
233 tpl = '%sget_ipython().run_line_magic(%r, %r)'
234 if line_info.line.startswith(ESC_MAGIC2):
235 return line_info.line
236 cmd = ' '.join([line_info.ifun, line_info.the_rest]).strip()
237 #Prepare arguments for get_ipython().run_line_magic(magic_name, magic_args)
238 t_magic_name, _, t_magic_arg_s = cmd.partition(' ')
239 t_magic_name = t_magic_name.lstrip(ESC_MAGIC)
240 return tpl % (line_info.pre, t_magic_name, t_magic_arg_s)
241
242def _tr_quote(line_info):
243 "Translate lines escaped with: ,"

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected