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

Function cell_magic

IPython/core/inputtransformer2.py:94–103  ·  view source on GitHub ↗
(lines)

Source from the content-addressed store, hash-verified

92ipython_prompt = PromptStripper(re.compile(r'^(In \[\d+\]: |\s*\.{3,}: ?)'))
93
94def cell_magic(lines):
95 if not lines or not lines[0].startswith('%%'):
96 return lines
97 if re.match(r'%%\w+\?', lines[0]):
98 # This case will be handled by help_end
99 return lines
100 magic_name, _, first_line = lines[0][2:].rstrip().partition(' ')
101 body = ''.join(lines[1:])
102 return ['get_ipython().run_cell_magic(%r, %r, %r)\n'
103 % (magic_name, first_line, body)]
104
105
106def _find_assign_op(token_line) -> Union[int, None]:

Callers 1

OSMagicsClass · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected