Show More
@@ -28,6 +28,7 b' from pprint import pformat' | |||||
28 | from IPython.core import ultratb |
|
28 | from IPython.core import ultratb | |
29 | from IPython.core.release import author_email |
|
29 | from IPython.core.release import author_email | |
30 | from IPython.utils.sysinfo import sys_info |
|
30 | from IPython.utils.sysinfo import sys_info | |
|
31 | from IPython.utils.py3compat import input | |||
31 |
|
32 | |||
32 | #----------------------------------------------------------------------------- |
|
33 | #----------------------------------------------------------------------------- | |
33 | # Code |
|
34 | # Code | |
@@ -176,7 +177,7 b' class CrashHandler(object):' | |||||
176 | # Construct report on disk |
|
177 | # Construct report on disk | |
177 | report.write(self.make_report(traceback)) |
|
178 | report.write(self.make_report(traceback)) | |
178 | report.close() |
|
179 | report.close() | |
179 |
|
|
180 | input("Hit <Enter> to quit (your terminal may close):") | |
180 |
|
181 | |||
181 | def make_report(self,traceback): |
|
182 | def make_report(self,traceback): | |
182 | """Return a string containing a crash report.""" |
|
183 | """Return a string containing a crash report.""" |
@@ -314,7 +314,7 b" if os.name == 'nt' and os.environ.get('TERM','dumb') != 'emacs':" | |||||
314 | return result |
|
314 | return result | |
315 | else: |
|
315 | else: | |
316 | def page_more(): |
|
316 | def page_more(): | |
317 |
ans = |
|
317 | ans = py3compat.input('---Return to continue, q to quit--- ') | |
318 | if ans.lower().startswith('q'): |
|
318 | if ans.lower().startswith('q'): | |
319 | return False |
|
319 | return False | |
320 | else: |
|
320 | else: | |
@@ -345,6 +345,6 b" def snip_print(str,width = 75,print_full = 0,header = ''):" | |||||
345 | print(str[:whalf] + ' <...> ' + str[-whalf:]) |
|
345 | print(str[:whalf] + ' <...> ' + str[-whalf:]) | |
346 | snip = 1 |
|
346 | snip = 1 | |
347 | if snip and print_full == 2: |
|
347 | if snip and print_full == 2: | |
348 |
if |
|
348 | if py3compat.input(header+' Snipped. View (y/n)? [N]').lower() == 'y': | |
349 | page(str) |
|
349 | page(str) | |
350 | return snip |
|
350 | return snip |
@@ -29,7 +29,7 b' from IPython.core import inputsplitter as isp' | |||||
29 | from IPython.core.tests.test_inputtransformer import syntax, syntax_ml |
|
29 | from IPython.core.tests.test_inputtransformer import syntax, syntax_ml | |
30 | from IPython.testing import tools as tt |
|
30 | from IPython.testing import tools as tt | |
31 | from IPython.utils import py3compat |
|
31 | from IPython.utils import py3compat | |
32 | from IPython.utils.py3compat import string_types |
|
32 | from IPython.utils.py3compat import string_types, input | |
33 |
|
33 | |||
34 | #----------------------------------------------------------------------------- |
|
34 | #----------------------------------------------------------------------------- | |
35 | # Semi-complete examples (also used as tests) |
|
35 | # Semi-complete examples (also used as tests) | |
@@ -489,9 +489,9 b" if __name__ == '__main__':" | |||||
489 | while isp.push_accepts_more(): |
|
489 | while isp.push_accepts_more(): | |
490 | indent = ' '*isp.indent_spaces |
|
490 | indent = ' '*isp.indent_spaces | |
491 | if autoindent: |
|
491 | if autoindent: | |
492 |
line = indent + |
|
492 | line = indent + input(prompt+indent) | |
493 | else: |
|
493 | else: | |
494 |
line = |
|
494 | line = input(prompt) | |
495 | isp.push(line) |
|
495 | isp.push(line) | |
496 | prompt = '... ' |
|
496 | prompt = '... ' | |
497 |
|
497 |
@@ -186,6 +186,7 b' import sys' | |||||
186 | from IPython.utils import io |
|
186 | from IPython.utils import io | |
187 | from IPython.utils.text import marquee |
|
187 | from IPython.utils.text import marquee | |
188 | from IPython.utils import openpy |
|
188 | from IPython.utils import openpy | |
|
189 | from IPython.utils import py3compat | |||
189 | __all__ = ['Demo','IPythonDemo','LineDemo','IPythonLineDemo','DemoError'] |
|
190 | __all__ = ['Demo','IPythonDemo','LineDemo','IPythonLineDemo','DemoError'] | |
190 |
|
191 | |||
191 | class DemoError(Exception): pass |
|
192 | class DemoError(Exception): pass | |
@@ -449,7 +450,7 b' class Demo(object):' | |||||
449 | print(marquee('output:'), file=io.stdout) |
|
450 | print(marquee('output:'), file=io.stdout) | |
450 | else: |
|
451 | else: | |
451 | print(marquee('Press <q> to quit, <Enter> to execute...'), end=' ', file=io.stdout) |
|
452 | print(marquee('Press <q> to quit, <Enter> to execute...'), end=' ', file=io.stdout) | |
452 |
ans = |
|
453 | ans = py3compat.input().strip() | |
453 | if ans: |
|
454 | if ans: | |
454 | print(marquee('Block NOT executed'), file=io.stdout) |
|
455 | print(marquee('Block NOT executed'), file=io.stdout) | |
455 | return |
|
456 | return |
@@ -12,6 +12,7 b' import subprocess' | |||||
12 |
|
12 | |||
13 | from IPython import get_ipython |
|
13 | from IPython import get_ipython | |
14 | from IPython.core.error import TryNext |
|
14 | from IPython.core.error import TryNext | |
|
15 | from IPython.utils import py3compat | |||
15 |
|
16 | |||
16 |
|
17 | |||
17 | def install_editor(template, wait=False): |
|
18 | def install_editor(template, wait=False): | |
@@ -51,7 +52,7 b' def install_editor(template, wait=False):' | |||||
51 | if wait and proc.wait() != 0: |
|
52 | if wait and proc.wait() != 0: | |
52 | raise TryNext() |
|
53 | raise TryNext() | |
53 | if wait: |
|
54 | if wait: | |
54 |
|
|
55 | py3compat.input("Press Enter when done editing:") | |
55 |
|
56 | |||
56 | get_ipython().set_hook('editor', call_editor) |
|
57 | get_ipython().set_hook('editor', call_editor) | |
57 | get_ipython().editor = template |
|
58 | get_ipython().editor = template |
@@ -31,7 +31,7 b' except ImportError:' | |||||
31 | from IPython.core import page |
|
31 | from IPython.core import page | |
32 | from IPython.utils.warn import warn, error |
|
32 | from IPython.utils.warn import warn, error | |
33 | from IPython.utils import io |
|
33 | from IPython.utils import io | |
34 | from IPython.utils.py3compat import string_types |
|
34 | from IPython.utils.py3compat import string_types, input | |
35 | from IPython.utils.traitlets import List, Enum, Any, Instance, Unicode, Float |
|
35 | from IPython.utils.traitlets import List, Enum, Any, Instance, Unicode, Float | |
36 | from IPython.utils.tempdir import NamedFileInTemporaryDirectory |
|
36 | from IPython.utils.tempdir import NamedFileInTemporaryDirectory | |
37 |
|
37 | |||
@@ -330,7 +330,7 b' class ZMQTerminalInteractiveShell(TerminalInteractiveShell):' | |||||
330 | signal.signal(signal.SIGINT, double_int) |
|
330 | signal.signal(signal.SIGINT, double_int) | |
331 |
|
331 | |||
332 | try: |
|
332 | try: | |
333 |
raw_data = |
|
333 | raw_data = input(msg_rep["content"]["prompt"]) | |
334 | except EOFError: |
|
334 | except EOFError: | |
335 | # turn EOFError into EOF character |
|
335 | # turn EOFError into EOF character | |
336 | raw_data = '\x04' |
|
336 | raw_data = '\x04' |
@@ -18,7 +18,7 b' import os' | |||||
18 | import sys |
|
18 | import sys | |
19 | import tempfile |
|
19 | import tempfile | |
20 | from .capture import CapturedIO, capture_output |
|
20 | from .capture import CapturedIO, capture_output | |
21 | from .py3compat import string_types |
|
21 | from .py3compat import string_types, input | |
22 |
|
22 | |||
23 | #----------------------------------------------------------------------------- |
|
23 | #----------------------------------------------------------------------------- | |
24 | # Code |
|
24 | # Code | |
@@ -170,7 +170,7 b' def ask_yes_no(prompt,default=None):' | |||||
170 | ans = None |
|
170 | ans = None | |
171 | while ans not in answers.keys(): |
|
171 | while ans not in answers.keys(): | |
172 | try: |
|
172 | try: | |
173 |
ans = |
|
173 | ans = input(prompt+' ').lower() | |
174 | if not ans: # response was an empty string |
|
174 | if not ans: # response was an empty string | |
175 | ans = default |
|
175 | ans = default | |
176 | except KeyboardInterrupt: |
|
176 | except KeyboardInterrupt: |
General Comments 0
You need to be logged in to leave comments.
Login now