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

Function get_pasted_lines

IPython/terminal/magics.py:18–36  ·  view source on GitHub ↗

Yield pasted lines until the user enters the given sentinel value.

(sentinel, l_input=py3compat.input, quiet=False)

Source from the content-addressed store, hash-verified

16from IPython.utils import py3compat
17
18def get_pasted_lines(sentinel, l_input=py3compat.input, quiet=False):
19 """ Yield pasted lines until the user enters the given sentinel value.
20 """
21 if not quiet:
22 print("Pasting code; enter '%s' alone on the line to stop or use Ctrl-D." \
23 % sentinel)
24 prompt = ":"
25 else:
26 prompt = ""
27 while True:
28 try:
29 l = l_input(prompt)
30 if l == sentinel:
31 return
32 else:
33 yield l
34 except EOFError:
35 print('<EOF>')
36 return
37
38
39@magics_class

Callers 1

cpasteMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…