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

Method rerun_pasted

IPython/terminal/magics.py:65–78  ·  view source on GitHub ↗

Rerun a previously pasted command.

(self, name='pasted_block')

Source from the content-addressed store, hash-verified

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

Callers 2

cpasteMethod · 0.95
pasteMethod · 0.95

Calls 2

UsageErrorClass · 0.90
run_cellMethod · 0.45

Tested by

no test coverage detected