MCPcopy Index your code
hub / github.com/ipython/ipython / rerun_pasted

Method rerun_pasted

IPython/terminal/magics.py:66–79  ·  view source on GitHub ↗

Rerun a previously pasted command.

(self, name='pasted_block')

Source from the content-addressed store, hash-verified

64 return strip_email_quotes('\n'.join(lines))
65
66 def rerun_pasted(self, name='pasted_block'):
67 """ Rerun a previously pasted command.
68 """
69 b = self.shell.user_ns.get(name)
70
71 # Sanity checks
72 if b is None:
73 raise UsageError('No previous pasted block available')
74 if not isinstance(b, str):
75 raise UsageError(
76 "Variable 'pasted_block' is not a string, can't execute")
77
78 print("Re-executing '%s...' (%d chars)"% (b.split('\n',1)[0], len(b)))
79 self.shell.run_cell(b)
80
81 @line_magic
82 def autoindent(self, parameter_s = ''):

Callers 2

cpasteMethod · 0.95
pasteMethod · 0.95

Calls 3

UsageErrorClass · 0.90
getMethod · 0.80
run_cellMethod · 0.45

Tested by

no test coverage detected