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

Function assign_from_magic

IPython/core/inputtransformer.py:527–536  ·  view source on GitHub ↗

Transform assignment from magic commands (e.g. a = %who_ls)

(line)

Source from the content-addressed store, hash-verified

525assign_magic_template = '%s = get_ipython().run_line_magic(%r, %r)'
526@StatelessInputTransformer.wrap
527def assign_from_magic(line):
528 """Transform assignment from magic commands (e.g. a = %who_ls)"""
529 m = assign_magic_re.match(line)
530 if m is None:
531 return line
532 #Prepare arguments for get_ipython().run_line_magic(magic_name, magic_args)
533 m_lhs, m_cmd = m.group('lhs', 'cmd')
534 t_magic_name, _, t_magic_arg_s = m_cmd.partition(' ')
535 t_magic_name = t_magic_name.lstrip(ESC_MAGIC)
536 return assign_magic_template % (m_lhs, t_magic_name, t_magic_arg_s)

Callers 1

__init__Method · 0.90

Calls 1

groupMethod · 0.80

Tested by

no test coverage detected