Show More
@@ -7,6 +7,7 b' Authors:' | |||
|
7 | 7 | * Brian Granger |
|
8 | 8 | * Min RK |
|
9 | 9 | """ |
|
10 | from __future__ import print_function | |
|
10 | 11 | |
|
11 | 12 | #----------------------------------------------------------------------------- |
|
12 | 13 | # Copyright (C) 2008-2011 The IPython Development Team |
@@ -286,7 +287,7 b' class Application(SingletonConfigurable):' | |||
|
286 | 287 | help[0] = help[0].replace('--%s='%alias, '-%s '%alias) |
|
287 | 288 | lines.extend(help) |
|
288 | 289 | # lines.append('') |
|
289 |
print |
|
|
290 | print(os.linesep.join(lines)) | |
|
290 | 291 | |
|
291 | 292 | def print_flag_help(self): |
|
292 | 293 | """Print the flag part of the help.""" |
@@ -299,7 +300,7 b' class Application(SingletonConfigurable):' | |||
|
299 | 300 | lines.append(prefix+m) |
|
300 | 301 | lines.append(indent(dedent(help.strip()))) |
|
301 | 302 | # lines.append('') |
|
302 |
print |
|
|
303 | print(os.linesep.join(lines)) | |
|
303 | 304 | |
|
304 | 305 | def print_options(self): |
|
305 | 306 | if not self.flags and not self.aliases: |
@@ -310,10 +311,10 b' class Application(SingletonConfigurable):' | |||
|
310 | 311 | for p in wrap_paragraphs(self.option_description): |
|
311 | 312 | lines.append(p) |
|
312 | 313 | lines.append('') |
|
313 |
print |
|
|
314 | print(os.linesep.join(lines)) | |
|
314 | 315 | self.print_flag_help() |
|
315 | 316 | self.print_alias_help() |
|
316 | ||
|
317 | print() | |
|
317 | 318 | |
|
318 | 319 | def print_subcommands(self): |
|
319 | 320 | """Print the subcommand part of the help.""" |
@@ -331,7 +332,7 b' class Application(SingletonConfigurable):' | |||
|
331 | 332 | if help: |
|
332 | 333 | lines.append(indent(dedent(help.strip()))) |
|
333 | 334 | lines.append('') |
|
334 |
print |
|
|
335 | print(os.linesep.join(lines)) | |
|
335 | 336 | |
|
336 | 337 | def print_help(self, classes=False): |
|
337 | 338 | """Print the help for each Configurable class in self.classes. |
@@ -344,19 +345,19 b' class Application(SingletonConfigurable):' | |||
|
344 | 345 | |
|
345 | 346 | if classes: |
|
346 | 347 | if self.classes: |
|
347 |
print |
|
|
348 |
print |
|
|
349 | ||
|
348 | print("Class parameters") | |
|
349 | print("----------------") | |
|
350 | print() | |
|
350 | 351 | for p in wrap_paragraphs(self.keyvalue_description): |
|
351 |
print |
|
|
352 | ||
|
352 | print(p) | |
|
353 | print() | |
|
353 | 354 | |
|
354 | 355 | for cls in self.classes: |
|
355 | 356 | cls.class_print_help() |
|
356 | ||
|
357 | print() | |
|
357 | 358 | else: |
|
358 |
print |
|
|
359 | ||
|
359 | print("To see all available configurables, use `--help-all`") | |
|
360 | print() | |
|
360 | 361 | |
|
361 | 362 | self.print_examples() |
|
362 | 363 | |
@@ -364,8 +365,8 b' class Application(SingletonConfigurable):' | |||
|
364 | 365 | def print_description(self): |
|
365 | 366 | """Print the application description.""" |
|
366 | 367 | for p in wrap_paragraphs(self.description): |
|
367 |
print |
|
|
368 | ||
|
368 | print(p) | |
|
369 | print() | |
|
369 | 370 | |
|
370 | 371 | def print_examples(self): |
|
371 | 372 | """Print usage and examples. |
@@ -374,15 +375,15 b' class Application(SingletonConfigurable):' | |||
|
374 | 375 | and should contain examples of the application's usage. |
|
375 | 376 | """ |
|
376 | 377 | if self.examples: |
|
377 |
print |
|
|
378 |
print |
|
|
379 | ||
|
380 |
print |
|
|
381 | ||
|
378 | print("Examples") | |
|
379 | print("--------") | |
|
380 | print() | |
|
381 | print(indent(dedent(self.examples.strip()))) | |
|
382 | print() | |
|
382 | 383 | |
|
383 | 384 | def print_version(self): |
|
384 | 385 | """Print the version string.""" |
|
385 |
print |
|
|
386 | print(self.version) | |
|
386 | 387 | |
|
387 | 388 | def update_config(self, config): |
|
388 | 389 | """Fire the traits events when the config is updated.""" |
@@ -13,6 +13,7 b' Authors:' | |||
|
13 | 13 | * Fernando Perez |
|
14 | 14 | * Min RK |
|
15 | 15 | """ |
|
16 | from __future__ import print_function | |
|
16 | 17 | |
|
17 | 18 | #----------------------------------------------------------------------------- |
|
18 | 19 | # Copyright (C) 2008-2011 The IPython Development Team |
@@ -236,7 +237,7 b' class Configurable(HasTraits):' | |||
|
236 | 237 | @classmethod |
|
237 | 238 | def class_print_help(cls, inst=None): |
|
238 | 239 | """Get the help string for a single trait and print it.""" |
|
239 |
print |
|
|
240 | print(cls.class_get_help(inst)) | |
|
240 | 241 | |
|
241 | 242 | @classmethod |
|
242 | 243 | def class_config_section(cls): |
@@ -1,5 +1,6 b'' | |||
|
1 | 1 | """Logger class for IPython's logging facilities. |
|
2 | 2 | """ |
|
3 | from __future__ import print_function | |
|
3 | 4 | |
|
4 | 5 | #***************************************************************************** |
|
5 | 6 | # Copyright (C) 2001 Janko Hauser <jhauser@zscout.de> and |
@@ -137,33 +138,33 b' class Logger(object):' | |||
|
137 | 138 | label = {0:'OFF',1:'ON',False:'OFF',True:'ON'} |
|
138 | 139 | |
|
139 | 140 | if self.logfile is None: |
|
140 |
print |
|
|
141 | print(""" | |
|
141 | 142 | Logging hasn't been started yet (use logstart for that). |
|
142 | 143 | |
|
143 | 144 | %logon/%logoff are for temporarily starting and stopping logging for a logfile |
|
144 | 145 | which already exists. But you must first start the logging process with |
|
145 | %logstart (optionally giving a logfile name).""" | |
|
146 | %logstart (optionally giving a logfile name).""") | |
|
146 | 147 | |
|
147 | 148 | else: |
|
148 | 149 | if self.log_active == val: |
|
149 |
print |
|
|
150 | print('Logging is already',label[val]) | |
|
150 | 151 | else: |
|
151 |
print |
|
|
152 | print('Switching logging',label[val]) | |
|
152 | 153 | self.log_active = not self.log_active |
|
153 | 154 | self.log_active_out = self.log_active |
|
154 | 155 | |
|
155 | 156 | def logstate(self): |
|
156 | 157 | """Print a status message about the logger.""" |
|
157 | 158 | if self.logfile is None: |
|
158 |
print |
|
|
159 | print('Logging has not been activated.') | |
|
159 | 160 | else: |
|
160 | 161 | state = self.log_active and 'active' or 'temporarily suspended' |
|
161 |
print |
|
|
162 |
print |
|
|
163 |
print |
|
|
164 |
print |
|
|
165 |
print |
|
|
166 |
print |
|
|
162 | print('Filename :',self.logfname) | |
|
163 | print('Mode :',self.logmode) | |
|
164 | print('Output logging :',self.log_output) | |
|
165 | print('Raw input log :',self.log_raw_input) | |
|
166 | print('Timestamping :',self.timestamp) | |
|
167 | print('State :',state) | |
|
167 | 168 | |
|
168 | 169 | def log(self, line_mod, line_ori): |
|
169 | 170 | """Write the sources to a log. |
@@ -213,7 +214,7 b' which already exists. But you must first start the logging process with' | |||
|
213 | 214 | self.logfile.close() |
|
214 | 215 | self.logfile = None |
|
215 | 216 | else: |
|
216 |
print |
|
|
217 | print("Logging hadn't been started.") | |
|
217 | 218 | self.log_active = False |
|
218 | 219 | |
|
219 | 220 | # For backwards compatibility, in case anyone was using this. |
@@ -1,6 +1,7 b'' | |||
|
1 | 1 | # encoding: utf-8 |
|
2 | 2 | """Magic functions for InteractiveShell. |
|
3 | 3 | """ |
|
4 | from __future__ import print_function | |
|
4 | 5 | |
|
5 | 6 | #----------------------------------------------------------------------------- |
|
6 | 7 | # Copyright (C) 2001 Janko Hauser <jhauser@zscout.de> and |
@@ -544,8 +545,8 b' class Magics(Configurable):' | |||
|
544 | 545 | |
|
545 | 546 | def arg_err(self,func): |
|
546 | 547 | """Print docstring if incorrect arguments were passed""" |
|
547 |
print |
|
|
548 |
print |
|
|
548 | print('Error in arguments:') | |
|
549 | print(oinspect.getdoc(func)) | |
|
549 | 550 | |
|
550 | 551 | def format_latex(self, strng): |
|
551 | 552 | """Format a string for latex inclusion.""" |
@@ -1,5 +1,6 b'' | |||
|
1 | 1 | """Implementation of magic functions that control various automatic behaviors. |
|
2 | 2 | """ |
|
3 | from __future__ import print_function | |
|
3 | 4 | #----------------------------------------------------------------------------- |
|
4 | 5 | # Copyright (c) 2012 The IPython Development Team. |
|
5 | 6 | # |
@@ -57,7 +58,7 b' class AutoMagics(Magics):' | |||
|
57 | 58 | else: |
|
58 | 59 | val = not mman.auto_magic |
|
59 | 60 | mman.auto_magic = val |
|
60 |
print |
|
|
61 | print('\n' + self.shell.magics_manager.auto_status()) | |
|
61 | 62 | |
|
62 | 63 | @skip_doctest |
|
63 | 64 | @line_magic |
@@ -125,4 +126,4 b' class AutoMagics(Magics):' | |||
|
125 | 126 | except AttributeError: |
|
126 | 127 | self.shell.autocall = self._magic_state.autocall_save = 1 |
|
127 | 128 | |
|
128 |
print |
|
|
129 | print("Automatic calling is:",['OFF','Smart','Full'][self.shell.autocall]) |
@@ -1,5 +1,6 b'' | |||
|
1 | 1 | """Implementation of code management magic functions. |
|
2 | 2 | """ |
|
3 | from __future__ import print_function | |
|
3 | 4 | #----------------------------------------------------------------------------- |
|
4 | 5 | # Copyright (c) 2012 The IPython Development Team. |
|
5 | 6 | # |
@@ -189,15 +190,15 b' class CodeMagics(Magics):' | |||
|
189 | 190 | try: |
|
190 | 191 | overwrite = self.shell.ask_yes_no('File `%s` exists. Overwrite (y/[N])? ' % fname, default='n') |
|
191 | 192 | except StdinNotImplementedError: |
|
192 |
print |
|
|
193 | print("File `%s` exists. Use `%%save -f %s` to force overwrite" % (fname, parameter_s)) | |
|
193 | 194 | return |
|
194 | 195 | if not overwrite : |
|
195 |
print |
|
|
196 | print('Operation cancelled.') | |
|
196 | 197 | return |
|
197 | 198 | try: |
|
198 | 199 | cmds = self.shell.find_user_code(codefrom,raw) |
|
199 | 200 | except (TypeError, ValueError) as e: |
|
200 |
print |
|
|
201 | print(e.args[0]) | |
|
201 | 202 | return |
|
202 | 203 | out = py3compat.cast_unicode(cmds) |
|
203 | 204 | with io.open(fname, mode, encoding="utf-8") as f: |
@@ -207,8 +208,8 b' class CodeMagics(Magics):' | |||
|
207 | 208 | # make sure we end on a newline |
|
208 | 209 | if not out.endswith(u'\n'): |
|
209 | 210 | f.write(u'\n') |
|
210 |
print |
|
|
211 |
print |
|
|
211 | print('The following commands were written to file `%s`:' % fname) | |
|
212 | print(cmds) | |
|
212 | 213 | |
|
213 | 214 | @line_magic |
|
214 | 215 | def pastebin(self, parameter_s=''): |
@@ -230,7 +231,7 b' class CodeMagics(Magics):' | |||
|
230 | 231 | try: |
|
231 | 232 | code = self.shell.find_user_code(args) |
|
232 | 233 | except (ValueError, TypeError) as e: |
|
233 |
print |
|
|
234 | print(e.args[0]) | |
|
234 | 235 | return |
|
235 | 236 | |
|
236 | 237 | from urllib2 import urlopen # Deferred import |
@@ -337,7 +338,7 b' class CodeMagics(Magics):' | |||
|
337 | 338 | ans = True |
|
338 | 339 | |
|
339 | 340 | if ans is False : |
|
340 |
print |
|
|
341 | print('Operation cancelled.') | |
|
341 | 342 | return |
|
342 | 343 | |
|
343 | 344 | self.shell.set_next_input(contents) |
@@ -459,7 +460,7 b' class CodeMagics(Magics):' | |||
|
459 | 460 | |
|
460 | 461 | if use_temp: |
|
461 | 462 | filename = shell.mktempfile(data) |
|
462 |
print |
|
|
463 | print('IPython will make a temporary file named:',filename) | |
|
463 | 464 | |
|
464 | 465 | # use last_call to remember the state of the previous call, but don't |
|
465 | 466 | # let it be clobbered by successive '-p' calls. |
@@ -637,7 +638,7 b' class CodeMagics(Magics):' | |||
|
637 | 638 | self._edit_macro(args, e.args[0]) |
|
638 | 639 | return |
|
639 | 640 | except InteractivelyDefined as e: |
|
640 |
print |
|
|
641 | print("Editing In[%i]" % e.index) | |
|
641 | 642 | args = str(e.index) |
|
642 | 643 | filename, lineno, is_temp = self._find_edit_target(self.shell, |
|
643 | 644 | args, opts, last_call) |
@@ -647,7 +648,7 b' class CodeMagics(Magics):' | |||
|
647 | 648 | return |
|
648 | 649 | |
|
649 | 650 | # do actual editing here |
|
650 |
print |
|
|
651 | print('Editing...', end=' ') | |
|
651 | 652 | sys.stdout.flush() |
|
652 | 653 | try: |
|
653 | 654 | # Quote filenames that may have spaces in them |
@@ -665,9 +666,9 b' class CodeMagics(Magics):' | |||
|
665 | 666 | self.shell.user_ns['pasted_block'] = f.read() |
|
666 | 667 | |
|
667 | 668 | if 'x' in opts: # -x prevents actual execution |
|
668 | ||
|
669 | print() | |
|
669 | 670 | else: |
|
670 |
print |
|
|
671 | print('done. Executing edited code...') | |
|
671 | 672 | with preserve_keys(self.shell.user_ns, '__file__'): |
|
672 | 673 | if not is_temp: |
|
673 | 674 | self.shell.user_ns['__file__'] = filename |
@@ -1,5 +1,6 b'' | |||
|
1 | 1 | """Implementation of configuration-related magic functions. |
|
2 | 2 | """ |
|
3 | from __future__ import print_function | |
|
3 | 4 | #----------------------------------------------------------------------------- |
|
4 | 5 | # Copyright (c) 2012 The IPython Development Team. |
|
5 | 6 | # |
@@ -116,9 +117,9 b' class ConfigMagics(Magics):' | |||
|
116 | 117 | line = s.strip() |
|
117 | 118 | if not line: |
|
118 | 119 | # print available configurable names |
|
119 |
print |
|
|
120 | print("Available objects for config:") | |
|
120 | 121 | for name in classnames: |
|
121 |
print |
|
|
122 | print(" ", name) | |
|
122 | 123 | return |
|
123 | 124 | elif line in classnames: |
|
124 | 125 | # `%config TerminalInteractiveShell` will print trait info for |
@@ -128,7 +129,7 b' class ConfigMagics(Magics):' | |||
|
128 | 129 | help = cls.class_get_help(c) |
|
129 | 130 | # strip leading '--' from cl-args: |
|
130 | 131 | help = re.sub(re.compile(r'^--', re.MULTILINE), '', help) |
|
131 |
print |
|
|
132 | print(help) | |
|
132 | 133 | return |
|
133 | 134 | elif reg.match(line): |
|
134 | 135 | cls, attr = line.split('.') |
@@ -1,5 +1,6 b'' | |||
|
1 | 1 | """Deprecated Magic functions. |
|
2 | 2 | """ |
|
3 | from __future__ import print_function | |
|
3 | 4 | #----------------------------------------------------------------------------- |
|
4 | 5 | # Copyright (c) 2012 The IPython Development Team. |
|
5 | 6 | # |
@@ -26,20 +27,20 b' class DeprecatedMagics(Magics):' | |||
|
26 | 27 | @line_magic |
|
27 | 28 | def install_profiles(self, parameter_s=''): |
|
28 | 29 | """%install_profiles has been deprecated.""" |
|
29 |
print |
|
|
30 | print('\n'.join([ | |
|
30 | 31 | "%install_profiles has been deprecated.", |
|
31 | 32 | "Use `ipython profile list` to view available profiles.", |
|
32 | 33 | "Requesting a profile with `ipython profile create <name>`", |
|
33 | 34 | "or `ipython --profile=<name>` will start with the bundled", |
|
34 | 35 | "profile of that name if it exists." |
|
35 | ]) | |
|
36 | ])) | |
|
36 | 37 | |
|
37 | 38 | @line_magic |
|
38 | 39 | def install_default_config(self, parameter_s=''): |
|
39 | 40 | """%install_default_config has been deprecated.""" |
|
40 |
print |
|
|
41 | print('\n'.join([ | |
|
41 | 42 | "%install_default_config has been deprecated.", |
|
42 | 43 | "Use `ipython profile create <name>` to initialize a profile", |
|
43 | 44 | "with the default config files.", |
|
44 | 45 | "Add `--reset` to overwrite already existing config files with defaults." |
|
45 | ]) | |
|
46 | ])) |
@@ -1,6 +1,7 b'' | |||
|
1 | 1 | # -*- coding: utf-8 -*- |
|
2 | 2 | """Implementation of execution-related magic functions. |
|
3 | 3 | """ |
|
4 | from __future__ import print_function | |
|
4 | 5 | #----------------------------------------------------------------------------- |
|
5 | 6 | # Copyright (c) 2012 The IPython Development Team. |
|
6 | 7 | # |
@@ -277,22 +278,22 b' python-profiler package from non-free.""")' | |||
|
277 | 278 | |
|
278 | 279 | if 'q' not in opts: |
|
279 | 280 | page.page(output) |
|
280 |
print |
|
|
281 | print(sys_exit, end=' ') | |
|
281 | 282 | |
|
282 | 283 | dump_file = opts.D[0] |
|
283 | 284 | text_file = opts.T[0] |
|
284 | 285 | if dump_file: |
|
285 | 286 | dump_file = unquote_filename(dump_file) |
|
286 | 287 | prof.dump_stats(dump_file) |
|
287 |
print |
|
|
288 | repr(dump_file)+'.',sys_exit | |
|
288 | print('\n*** Profile stats marshalled to file',\ | |
|
289 | repr(dump_file)+'.',sys_exit) | |
|
289 | 290 | if text_file: |
|
290 | 291 | text_file = unquote_filename(text_file) |
|
291 | 292 | pfile = open(text_file,'w') |
|
292 | 293 | pfile.write(output) |
|
293 | 294 | pfile.close() |
|
294 |
print |
|
|
295 | repr(text_file)+'.',sys_exit | |
|
295 | print('\n*** Profile printout saved to text file',\ | |
|
296 | repr(text_file)+'.',sys_exit) | |
|
296 | 297 | |
|
297 | 298 | if 'r' in opts: |
|
298 | 299 | return stats |
@@ -332,7 +333,7 b' python-profiler package from non-free.""")' | |||
|
332 | 333 | |
|
333 | 334 | # set on the shell |
|
334 | 335 | self.shell.call_pdb = new_pdb |
|
335 |
print |
|
|
336 | print('Automatic pdb calling has been turned',on_off(new_pdb)) | |
|
336 | 337 | |
|
337 | 338 | @skip_doctest |
|
338 | 339 | @magic_arguments.magic_arguments() |
@@ -558,7 +559,7 b' python-profiler package from non-free.""")' | |||
|
558 | 559 | filename = file_finder(arg_lst[0]) |
|
559 | 560 | except IndexError: |
|
560 | 561 | warn('you must provide at least a filename.') |
|
561 |
print |
|
|
562 | print('\n%run:\n', oinspect.getdoc(self.run)) | |
|
562 | 563 | return |
|
563 | 564 | except IOError as e: |
|
564 | 565 | try: |
@@ -775,7 +776,7 b' python-profiler package from non-free.""")' | |||
|
775 | 776 | deb.mainpyfile = deb.canonic(filename) |
|
776 | 777 | |
|
777 | 778 | # Start file run |
|
778 |
print |
|
|
779 | print("NOTE: Enter 'c' at the %s prompt to continue execution." % deb.prompt) | |
|
779 | 780 | try: |
|
780 | 781 | if filename: |
|
781 | 782 | # save filename so it can be used by methods on the deb object |
@@ -809,9 +810,9 b' python-profiler package from non-free.""")' | |||
|
809 | 810 | t1 = clock2() |
|
810 | 811 | t_usr = t1[0] - t0[0] |
|
811 | 812 | t_sys = t1[1] - t0[1] |
|
812 |
print |
|
|
813 |
print |
|
|
814 |
print |
|
|
813 | print("\nIPython CPU timings (estimated):") | |
|
814 | print(" User : %10.2f s." % t_usr) | |
|
815 | print(" System : %10.2f s." % t_sys) | |
|
815 | 816 | else: |
|
816 | 817 | runs = range(nruns) |
|
817 | 818 | t0 = clock2() |
@@ -820,13 +821,13 b' python-profiler package from non-free.""")' | |||
|
820 | 821 | t1 = clock2() |
|
821 | 822 | t_usr = t1[0] - t0[0] |
|
822 | 823 | t_sys = t1[1] - t0[1] |
|
823 |
print |
|
|
824 |
print |
|
|
825 |
print |
|
|
826 |
print |
|
|
827 |
print |
|
|
824 | print("\nIPython CPU timings (estimated):") | |
|
825 | print("Total runs performed:", nruns) | |
|
826 | print(" Times : %10s %10s" % ('Total', 'Per run')) | |
|
827 | print(" User : %10.2f s, %10.2f s." % (t_usr, t_usr / nruns)) | |
|
828 | print(" System : %10.2f s, %10.2f s." % (t_sys, t_sys / nruns)) | |
|
828 | 829 | twall1 = time.time() |
|
829 |
print |
|
|
830 | print("Wall time: %10.2f s." % (twall1 - twall0)) | |
|
830 | 831 | |
|
831 | 832 | @skip_doctest |
|
832 | 833 | @line_cell_magic |
@@ -989,10 +990,10 b' python-profiler package from non-free.""")' | |||
|
989 | 990 | all_runs = timer.repeat(repeat, number) |
|
990 | 991 | best = min(all_runs) / number |
|
991 | 992 | if not quiet : |
|
992 |
print |
|
|
993 | _format_time(best, precision)) | |
|
993 | print(u"%d loops, best of %d: %s per loop" % (number, repeat, | |
|
994 | _format_time(best, precision))) | |
|
994 | 995 | if tc > tc_min: |
|
995 |
print |
|
|
996 | print("Compiler time: %.2f s" % tc) | |
|
996 | 997 | if return_result: |
|
997 | 998 | return TimeitResult(number, repeat, best, all_runs, tc, precision) |
|
998 | 999 | |
@@ -1110,13 +1111,13 b' python-profiler package from non-free.""")' | |||
|
1110 | 1111 | cpu_tot = cpu_user+cpu_sys |
|
1111 | 1112 | # On windows cpu_sys is always zero, so no new information to the next print |
|
1112 | 1113 | if sys.platform != 'win32': |
|
1113 |
print |
|
|
1114 | (_format_time(cpu_user),_format_time(cpu_sys),_format_time(cpu_tot)) | |
|
1115 |
print |
|
|
1114 | print("CPU times: user %s, sys: %s, total: %s" % \ | |
|
1115 | (_format_time(cpu_user),_format_time(cpu_sys),_format_time(cpu_tot))) | |
|
1116 | print("Wall time: %s" % _format_time(wall_time)) | |
|
1116 | 1117 | if tc > tc_min: |
|
1117 |
print |
|
|
1118 | print("Compiler : %s" % _format_time(tc)) | |
|
1118 | 1119 | if tp > tp_min: |
|
1119 |
print |
|
|
1120 | print("Parser : %s" % _format_time(tp)) | |
|
1120 | 1121 | return out |
|
1121 | 1122 | |
|
1122 | 1123 | @skip_doctest |
@@ -1195,14 +1196,14 b' python-profiler package from non-free.""")' | |||
|
1195 | 1196 | try: |
|
1196 | 1197 | lines = self.shell.find_user_code(codefrom, 'r' in opts) |
|
1197 | 1198 | except (ValueError, TypeError) as e: |
|
1198 |
print |
|
|
1199 | print(e.args[0]) | |
|
1199 | 1200 | return |
|
1200 | 1201 | macro = Macro(lines) |
|
1201 | 1202 | self.shell.define_macro(name, macro) |
|
1202 | 1203 | if not ( 'q' in opts) : |
|
1203 |
print |
|
|
1204 |
print |
|
|
1205 |
print |
|
|
1204 | print('Macro `%s` created. To execute, type its name (without quotes).' % name) | |
|
1205 | print('=== Macro contents: ===') | |
|
1206 | print(macro, end=' ') | |
|
1206 | 1207 | |
|
1207 | 1208 | @magic_arguments.magic_arguments() |
|
1208 | 1209 | @magic_arguments.argument('output', type=str, default='', nargs='?', |
@@ -1,5 +1,6 b'' | |||
|
1 | 1 | """Implementation of magic functions for the extension machinery. |
|
2 | 2 | """ |
|
3 | from __future__ import print_function | |
|
3 | 4 | #----------------------------------------------------------------------------- |
|
4 | 5 | # Copyright (c) 2012 The IPython Development Team. |
|
5 | 6 | # |
@@ -46,12 +47,12 b' class ExtensionMagics(Magics):' | |||
|
46 | 47 | filename = self.shell.extension_manager.install_extension(args, |
|
47 | 48 | opts.get('n')) |
|
48 | 49 | except ValueError as e: |
|
49 |
print |
|
|
50 | print(e) | |
|
50 | 51 | return |
|
51 | 52 | |
|
52 | 53 | filename = os.path.basename(filename) |
|
53 |
print |
|
|
54 |
print |
|
|
54 | print("Installed %s. To use it, type:" % filename) | |
|
55 | print(" %%load_ext %s" % os.path.splitext(filename)[0]) | |
|
55 | 56 | |
|
56 | 57 | |
|
57 | 58 | @line_magic |
@@ -62,10 +63,10 b' class ExtensionMagics(Magics):' | |||
|
62 | 63 | res = self.shell.extension_manager.load_extension(module_str) |
|
63 | 64 | |
|
64 | 65 | if res == 'already loaded': |
|
65 |
print |
|
|
66 |
print |
|
|
66 | print("The %s extension is already loaded. To reload it, use:" % module_str) | |
|
67 | print(" %reload_ext", module_str) | |
|
67 | 68 | elif res == 'no load function': |
|
68 |
print |
|
|
69 | print("The %s module is not an IPython extension." % module_str) | |
|
69 | 70 | |
|
70 | 71 | @line_magic |
|
71 | 72 | def unload_ext(self, module_str): |
@@ -80,9 +81,9 b' class ExtensionMagics(Magics):' | |||
|
80 | 81 | res = self.shell.extension_manager.unload_extension(module_str) |
|
81 | 82 | |
|
82 | 83 | if res == 'no unload function': |
|
83 |
print |
|
|
84 | print("The %s extension doesn't define how to unload it." % module_str) | |
|
84 | 85 | elif res == "not loaded": |
|
85 |
print |
|
|
86 | print("The %s extension is not loaded." % module_str) | |
|
86 | 87 | |
|
87 | 88 | @line_magic |
|
88 | 89 | def reload_ext(self, module_str): |
@@ -1,5 +1,6 b'' | |||
|
1 | 1 | """Implementation of namespace-related magic functions. |
|
2 | 2 | """ |
|
3 | from __future__ import print_function | |
|
3 | 4 | #----------------------------------------------------------------------------- |
|
4 | 5 | # Copyright (c) 2012 The IPython Development Team. |
|
5 | 6 | # |
@@ -117,7 +118,7 b' class NamespaceMagics(Magics):' | |||
|
117 | 118 | try: |
|
118 | 119 | filename = get_py_filename(parameter_s) |
|
119 | 120 | except IOError as msg: |
|
120 |
print |
|
|
121 | print(msg) | |
|
121 | 122 | return |
|
122 | 123 | page.page(self.shell.pycolorize(read_py_file(filename, skip_encoding_cookie=False))) |
|
123 | 124 | |
@@ -204,7 +205,7 b' class NamespaceMagics(Magics):' | |||
|
204 | 205 | try: |
|
205 | 206 | parameter_s.encode('ascii') |
|
206 | 207 | except UnicodeEncodeError: |
|
207 |
print |
|
|
208 | print('Python identifiers can only contain ascii characters.') | |
|
208 | 209 | return |
|
209 | 210 | |
|
210 | 211 | # default namespaces to be searched |
@@ -327,20 +328,20 b' class NamespaceMagics(Magics):' | |||
|
327 | 328 | varlist = self.who_ls(parameter_s) |
|
328 | 329 | if not varlist: |
|
329 | 330 | if parameter_s: |
|
330 |
print |
|
|
331 | print('No variables match your requested type.') | |
|
331 | 332 | else: |
|
332 |
print |
|
|
333 | print('Interactive namespace is empty.') | |
|
333 | 334 | return |
|
334 | 335 | |
|
335 | 336 | # if we have variables, move on... |
|
336 | 337 | count = 0 |
|
337 | 338 | for i in varlist: |
|
338 |
print |
|
|
339 | print(i+'\t', end=' ') | |
|
339 | 340 | count += 1 |
|
340 | 341 | if count > 8: |
|
341 | 342 | count = 0 |
|
342 | ||
|
343 | ||
|
343 | print() | |
|
344 | print() | |
|
344 | 345 | |
|
345 | 346 | @skip_doctest |
|
346 | 347 | @line_magic |
@@ -378,9 +379,9 b' class NamespaceMagics(Magics):' | |||
|
378 | 379 | varnames = self.who_ls(parameter_s) |
|
379 | 380 | if not varnames: |
|
380 | 381 | if parameter_s: |
|
381 |
print |
|
|
382 | print('No variables match your requested type.') | |
|
382 | 383 | else: |
|
383 |
print |
|
|
384 | print('Interactive namespace is empty.') | |
|
384 | 385 | return |
|
385 | 386 | |
|
386 | 387 | # if we have variables, move on... |
@@ -432,15 +433,15 b' class NamespaceMagics(Magics):' | |||
|
432 | 433 | varwidth = max(max(map(len,varnames)), len(varlabel)) + colsep |
|
433 | 434 | typewidth = max(max(map(len,typelist)), len(typelabel)) + colsep |
|
434 | 435 | # table header |
|
435 |
print |
|
|
436 | ' '+datalabel+'\n' + '-'*(varwidth+typewidth+len(datalabel)+1) | |
|
436 | print(varlabel.ljust(varwidth) + typelabel.ljust(typewidth) + \ | |
|
437 | ' '+datalabel+'\n' + '-'*(varwidth+typewidth+len(datalabel)+1)) | |
|
437 | 438 | # and the table itself |
|
438 | 439 | kb = 1024 |
|
439 | 440 | Mb = 1048576 # kb**2 |
|
440 | 441 | for vname,var,vtype in zip(varnames,varlist,typelist): |
|
441 |
print |
|
|
442 | print(vformat.format(vname, vtype, varwidth=varwidth, typewidth=typewidth), end=' ') | |
|
442 | 443 | if vtype in seq_types: |
|
443 |
print |
|
|
444 | print("n="+str(len(var))) | |
|
444 | 445 | elif vtype == ndarray_type: |
|
445 | 446 | vshape = str(var.shape).replace(',','').replace(' ','x')[1:-1] |
|
446 | 447 | if vtype==ndarray_type: |
@@ -450,13 +451,13 b' class NamespaceMagics(Magics):' | |||
|
450 | 451 | vdtype = var.dtype |
|
451 | 452 | |
|
452 | 453 | if vbytes < 100000: |
|
453 |
print |
|
|
454 | print(aformat % (vshape, vsize, vdtype, vbytes)) | |
|
454 | 455 | else: |
|
455 |
print |
|
|
456 | print(aformat % (vshape, vsize, vdtype, vbytes), end=' ') | |
|
456 | 457 | if vbytes < Mb: |
|
457 |
print |
|
|
458 | print('(%s kb)' % (vbytes/kb,)) | |
|
458 | 459 | else: |
|
459 |
print |
|
|
460 | print('(%s Mb)' % (vbytes/Mb,)) | |
|
460 | 461 | else: |
|
461 | 462 | try: |
|
462 | 463 | vstr = str(var) |
@@ -467,9 +468,9 b' class NamespaceMagics(Magics):' | |||
|
467 | 468 | vstr = "<object with id %d (str() failed)>" % id(var) |
|
468 | 469 | vstr = vstr.replace('\n', '\\n') |
|
469 | 470 | if len(vstr) < 50: |
|
470 |
print |
|
|
471 | print(vstr) | |
|
471 | 472 | else: |
|
472 |
print |
|
|
473 | print(vstr[:25] + "<...>" + vstr[-25:]) | |
|
473 | 474 | |
|
474 | 475 | @line_magic |
|
475 | 476 | def reset(self, parameter_s=''): |
@@ -540,7 +541,7 b' class NamespaceMagics(Magics):' | |||
|
540 | 541 | except StdinNotImplementedError: |
|
541 | 542 | ans = True |
|
542 | 543 | if not ans: |
|
543 |
print |
|
|
544 | print('Nothing done.') | |
|
544 | 545 | return |
|
545 | 546 | |
|
546 | 547 | if 's' in opts: # Soft reset |
@@ -557,11 +558,11 b' class NamespaceMagics(Magics):' | |||
|
557 | 558 | for target in args: |
|
558 | 559 | target = target.lower() # make matches case insensitive |
|
559 | 560 | if target == 'out': |
|
560 |
print |
|
|
561 | print("Flushing output cache (%d entries)" % len(user_ns['_oh'])) | |
|
561 | 562 | self.shell.displayhook.flush() |
|
562 | 563 | |
|
563 | 564 | elif target == 'in': |
|
564 |
print |
|
|
565 | print("Flushing input history") | |
|
565 | 566 | pc = self.shell.displayhook.prompt_count + 1 |
|
566 | 567 | for n in range(1, pc): |
|
567 | 568 | key = '_i'+repr(n) |
@@ -585,15 +586,15 b' class NamespaceMagics(Magics):' | |||
|
585 | 586 | if isinstance(val,ndarray): |
|
586 | 587 | del user_ns[x] |
|
587 | 588 | except ImportError: |
|
588 |
print |
|
|
589 | print("reset array only works if Numpy is available.") | |
|
589 | 590 | |
|
590 | 591 | elif target == 'dhist': |
|
591 |
print |
|
|
592 | print("Flushing directory history") | |
|
592 | 593 | del user_ns['_dh'][:] |
|
593 | 594 | |
|
594 | 595 | else: |
|
595 |
print |
|
|
596 |
print |
|
|
596 | print("Don't know how to reset ", end=' ') | |
|
597 | print(target + ", please run `%reset?` for details") | |
|
597 | 598 | |
|
598 | 599 | gc.collect() |
|
599 | 600 | |
@@ -670,11 +671,11 b' class NamespaceMagics(Magics):' | |||
|
670 | 671 | except StdinNotImplementedError: |
|
671 | 672 | ans = True |
|
672 | 673 | if not ans: |
|
673 |
print |
|
|
674 | print('Nothing done.') | |
|
674 | 675 | return |
|
675 | 676 | user_ns = self.shell.user_ns |
|
676 | 677 | if not regex: |
|
677 |
print |
|
|
678 | print('No regex pattern specified. Nothing done.') | |
|
678 | 679 | return |
|
679 | 680 | else: |
|
680 | 681 | try: |
@@ -701,4 +702,4 b' class NamespaceMagics(Magics):' | |||
|
701 | 702 | try: |
|
702 | 703 | self.shell.del_var(varname, ('n' in opts)) |
|
703 | 704 | except (NameError, ValueError) as e: |
|
704 |
print |
|
|
705 | print(type(e).__name__ +": "+ str(e)) |
@@ -3,6 +3,7 b'' | |||
|
3 | 3 | Note: this module is named 'osm' instead of 'os' to avoid a collision with the |
|
4 | 4 | builtin. |
|
5 | 5 | """ |
|
6 | from __future__ import print_function | |
|
6 | 7 | #----------------------------------------------------------------------------- |
|
7 | 8 | # Copyright (c) 2012 The IPython Development Team. |
|
8 | 9 | # |
@@ -107,7 +108,7 b' class OSMagics(Magics):' | |||
|
107 | 108 | # for k, v in stored: |
|
108 | 109 | # atab.append(k, v[0]) |
|
109 | 110 | |
|
110 |
print |
|
|
111 | print("Total number of aliases:", len(aliases)) | |
|
111 | 112 | sys.stdout.flush() |
|
112 | 113 | return aliases |
|
113 | 114 | |
@@ -115,7 +116,7 b' class OSMagics(Magics):' | |||
|
115 | 116 | try: |
|
116 | 117 | alias,cmd = par.split(None, 1) |
|
117 | 118 | except TypeError: |
|
118 | print(oinspect.getdoc(self.alias)) | |
|
119 | print((oinspect.getdoc(self.alias))) | |
|
119 | 120 | return |
|
120 | 121 | |
|
121 | 122 | try: |
@@ -137,7 +138,7 b' class OSMagics(Magics):' | |||
|
137 | 138 | |
|
138 | 139 | stored = self.shell.db.get('stored_aliases', {} ) |
|
139 | 140 | if aname in stored: |
|
140 |
print |
|
|
141 | print("Removing %stored alias",aname) | |
|
141 | 142 | del stored[aname] |
|
142 | 143 | self.shell.db['stored_aliases'] = stored |
|
143 | 144 | |
@@ -284,7 +285,7 b' class OSMagics(Magics):' | |||
|
284 | 285 | try: |
|
285 | 286 | ps = self.shell.user_ns['_dh'][nn] |
|
286 | 287 | except IndexError: |
|
287 |
print |
|
|
288 | print('The requested directory does not exist in history.') | |
|
288 | 289 | return |
|
289 | 290 | else: |
|
290 | 291 | opts = {} |
@@ -307,7 +308,7 b' class OSMagics(Magics):' | |||
|
307 | 308 | ps = fallback |
|
308 | 309 | |
|
309 | 310 | if ps is None: |
|
310 |
print |
|
|
311 | print("No matching entry in directory history") | |
|
311 | 312 | return |
|
312 | 313 | else: |
|
313 | 314 | opts = {} |
@@ -331,7 +332,7 b' class OSMagics(Magics):' | |||
|
331 | 332 | |
|
332 | 333 | if ps in bkms: |
|
333 | 334 | target = bkms[ps] |
|
334 |
print |
|
|
335 | print('(bookmark:%s) -> %s' % (ps, target)) | |
|
335 | 336 | ps = target |
|
336 | 337 | else: |
|
337 | 338 | if 'b' in opts: |
@@ -347,7 +348,7 b' class OSMagics(Magics):' | |||
|
347 | 348 | if hasattr(self.shell, 'term_title') and self.shell.term_title: |
|
348 | 349 | set_term_title('IPython: ' + abbrev_cwd()) |
|
349 | 350 | except OSError: |
|
350 |
print |
|
|
351 | print(sys.exc_info()[1]) | |
|
351 | 352 | else: |
|
352 | 353 | cwd = os.getcwdu() |
|
353 | 354 | dhist = self.shell.user_ns['_dh'] |
@@ -366,7 +367,7 b' class OSMagics(Magics):' | |||
|
366 | 367 | dhist.append(cwd) |
|
367 | 368 | self.shell.db['dhist'] = compress_dhist(dhist)[-100:] |
|
368 | 369 | if not 'q' in opts and self.shell.user_ns['_dh']: |
|
369 |
print |
|
|
370 | print(self.shell.user_ns['_dh'][-1]) | |
|
370 | 371 | |
|
371 | 372 | |
|
372 | 373 | @line_magic |
@@ -399,7 +400,7 b' class OSMagics(Magics):' | |||
|
399 | 400 | raise UsageError("%popd on empty stack") |
|
400 | 401 | top = self.shell.dir_stack.pop(0) |
|
401 | 402 | self.cd(top) |
|
402 |
print |
|
|
403 | print("popd ->",top) | |
|
403 | 404 | |
|
404 | 405 | @line_magic |
|
405 | 406 | def dirs(self, parameter_s=''): |
@@ -441,9 +442,9 b' class OSMagics(Magics):' | |||
|
441 | 442 | return |
|
442 | 443 | else: |
|
443 | 444 | ini,fin = 0,len(dh) |
|
444 |
print |
|
|
445 | print('Directory history (kept in _dh)') | |
|
445 | 446 | for i in range(ini, fin): |
|
446 |
print |
|
|
447 | print("%d: %s" % (i, dh[i])) | |
|
447 | 448 | |
|
448 | 449 | @skip_doctest |
|
449 | 450 | @line_magic |
@@ -555,7 +556,7 b' class OSMagics(Magics):' | |||
|
555 | 556 | split = 'l' in opts |
|
556 | 557 | out = self.shell.getoutput(cmd, split=split) |
|
557 | 558 | if 'v' in opts: |
|
558 |
print |
|
|
559 | print('%s ==\n%s' % (var, pformat(out))) | |
|
559 | 560 | if var: |
|
560 | 561 | self.shell.user_ns.update({var:out}) |
|
561 | 562 | else: |
@@ -667,9 +668,9 b' class OSMagics(Magics):' | |||
|
667 | 668 | else: |
|
668 | 669 | size = 0 |
|
669 | 670 | fmt = '%-'+str(size)+'s -> %s' |
|
670 |
print |
|
|
671 | print('Current bookmarks:') | |
|
671 | 672 | for bk in bks: |
|
672 |
print |
|
|
673 | print(fmt % (bk, bkms[bk])) | |
|
673 | 674 | else: |
|
674 | 675 | if not args: |
|
675 | 676 | raise UsageError("%bookmark: You must specify the bookmark name") |
@@ -701,7 +702,7 b' class OSMagics(Magics):' | |||
|
701 | 702 | try : |
|
702 | 703 | cont = self.shell.find_user_code(parameter_s, skip_encoding_cookie=False) |
|
703 | 704 | except (ValueError, IOError): |
|
704 |
print |
|
|
705 | print("Error: no such file, variable, URL, history range or macro") | |
|
705 | 706 | return |
|
706 | 707 | |
|
707 | 708 | page.page(self.shell.pycolorize(source_to_unicode(cont))) |
@@ -727,11 +728,11 b' class OSMagics(Magics):' | |||
|
727 | 728 | |
|
728 | 729 | if os.path.exists(filename): |
|
729 | 730 | if args.append: |
|
730 |
print |
|
|
731 | print("Appending to %s" % filename) | |
|
731 | 732 | else: |
|
732 |
print |
|
|
733 | print("Overwriting %s" % filename) | |
|
733 | 734 | else: |
|
734 |
print |
|
|
735 | print("Writing %s" % filename) | |
|
735 | 736 | |
|
736 | 737 | mode = 'a' if args.append else 'w' |
|
737 | 738 | with io.open(filename, mode, encoding='utf-8') as f: |
@@ -1,5 +1,6 b'' | |||
|
1 | 1 | """Implementation of magic functions for matplotlib/pylab support. |
|
2 | 2 | """ |
|
3 | from __future__ import print_function | |
|
3 | 4 | #----------------------------------------------------------------------------- |
|
4 | 5 | # Copyright (c) 2012 The IPython Development Team. |
|
5 | 6 | # |
@@ -139,5 +140,5 b' class PylabMagics(Magics):' | |||
|
139 | 140 | def _show_matplotlib_backend(self, gui, backend): |
|
140 | 141 | """show matplotlib message backend message""" |
|
141 | 142 | if not gui or gui == 'auto': |
|
142 |
print |
|
|
143 | print(("Using matplotlib backend: %s" % backend)) | |
|
143 | 144 |
@@ -1,4 +1,5 b'' | |||
|
1 | 1 | """Magic functions for running cells in various scripts.""" |
|
2 | from __future__ import print_function | |
|
2 | 3 | #----------------------------------------------------------------------------- |
|
3 | 4 | # Copyright (c) 2012 The IPython Development Team. |
|
4 | 5 | # |
@@ -186,7 +187,7 b' class ScriptMagics(Magics):' | |||
|
186 | 187 | p = Popen(cmd, stdout=PIPE, stderr=PIPE, stdin=PIPE) |
|
187 | 188 | except OSError as e: |
|
188 | 189 | if e.errno == errno.ENOENT: |
|
189 |
print |
|
|
190 | print("Couldn't find program: %r" % cmd[0]) | |
|
190 | 191 | return |
|
191 | 192 | else: |
|
192 | 193 | raise |
@@ -211,20 +212,20 b' class ScriptMagics(Magics):' | |||
|
211 | 212 | p.send_signal(signal.SIGINT) |
|
212 | 213 | time.sleep(0.1) |
|
213 | 214 | if p.poll() is not None: |
|
214 |
print |
|
|
215 | print("Process is interrupted.") | |
|
215 | 216 | return |
|
216 | 217 | p.terminate() |
|
217 | 218 | time.sleep(0.1) |
|
218 | 219 | if p.poll() is not None: |
|
219 |
print |
|
|
220 | print("Process is terminated.") | |
|
220 | 221 | return |
|
221 | 222 | p.kill() |
|
222 |
print |
|
|
223 | print("Process is killed.") | |
|
223 | 224 | except OSError: |
|
224 | 225 | pass |
|
225 | 226 | except Exception as e: |
|
226 |
print |
|
|
227 | % (p.pid, e) | |
|
227 | print("Error while terminating subprocess (pid=%i): %s" \ | |
|
228 | % (p.pid, e)) | |
|
228 | 229 | return |
|
229 | 230 | out = py3compat.bytes_to_str(out) |
|
230 | 231 | err = py3compat.bytes_to_str(err) |
@@ -249,7 +250,7 b' class ScriptMagics(Magics):' | |||
|
249 | 250 | def killbgscripts(self, _nouse_=''): |
|
250 | 251 | """Kill all BG processes started by %%script and its family.""" |
|
251 | 252 | self.kill_bg_processes() |
|
252 |
print |
|
|
253 | print("All background processes were killed.") | |
|
253 | 254 | |
|
254 | 255 | def kill_bg_processes(self): |
|
255 | 256 | """Kill all BG processes which are still running.""" |
@@ -9,6 +9,7 b' Authors:' | |||
|
9 | 9 | * Min RK |
|
10 | 10 | |
|
11 | 11 | """ |
|
12 | from __future__ import print_function | |
|
12 | 13 | |
|
13 | 14 | #----------------------------------------------------------------------------- |
|
14 | 15 | # Copyright (C) 2008 The IPython Development Team |
@@ -129,7 +130,7 b' class ProfileLocate(BaseIPythonApplication):' | |||
|
129 | 130 | self.profile = self.extra_args[0] |
|
130 | 131 | |
|
131 | 132 | def start(self): |
|
132 |
print |
|
|
133 | print(self.profile_dir.location) | |
|
133 | 134 | |
|
134 | 135 | |
|
135 | 136 | class ProfileList(Application): |
@@ -160,35 +161,35 b' class ProfileList(Application):' | |||
|
160 | 161 | def _print_profiles(self, profiles): |
|
161 | 162 | """print list of profiles, indented.""" |
|
162 | 163 | for profile in profiles: |
|
163 |
print |
|
|
164 | print(' %s' % profile) | |
|
164 | 165 | |
|
165 | 166 | def list_profile_dirs(self): |
|
166 | 167 | profiles = list_bundled_profiles() |
|
167 | 168 | if profiles: |
|
168 | ||
|
169 |
print |
|
|
169 | print() | |
|
170 | print("Available profiles in IPython:") | |
|
170 | 171 | self._print_profiles(profiles) |
|
171 | ||
|
172 |
print |
|
|
173 |
print |
|
|
174 |
print |
|
|
172 | print() | |
|
173 | print(" The first request for a bundled profile will copy it") | |
|
174 | print(" into your IPython directory (%s)," % self.ipython_dir) | |
|
175 | print(" where you can customize it.") | |
|
175 | 176 | |
|
176 | 177 | profiles = list_profiles_in(self.ipython_dir) |
|
177 | 178 | if profiles: |
|
178 | ||
|
179 |
print |
|
|
179 | print() | |
|
180 | print("Available profiles in %s:" % self.ipython_dir) | |
|
180 | 181 | self._print_profiles(profiles) |
|
181 | 182 | |
|
182 | 183 | profiles = list_profiles_in(os.getcwdu()) |
|
183 | 184 | if profiles: |
|
184 | ||
|
185 |
print |
|
|
185 | print() | |
|
186 | print("Available profiles in current directory (%s):" % os.getcwdu()) | |
|
186 | 187 | self._print_profiles(profiles) |
|
187 | 188 | |
|
188 | ||
|
189 |
print |
|
|
190 |
print |
|
|
191 | ||
|
189 | print() | |
|
190 | print("To use any of the above profiles, start IPython with:") | |
|
191 | print(" ipython --profile=<name>") | |
|
192 | print() | |
|
192 | 193 | |
|
193 | 194 | def start(self): |
|
194 | 195 | self.list_profile_dirs() |
@@ -304,8 +305,8 b' class ProfileApp(Application):' | |||
|
304 | 305 | |
|
305 | 306 | def start(self): |
|
306 | 307 | if self.subapp is None: |
|
307 |
print |
|
|
308 | ||
|
308 | print("No subcommand specified. Must specify one of: %s"%(self.subcommands.keys())) | |
|
309 | print() | |
|
309 | 310 | self.print_description() |
|
310 | 311 | self.print_subcommands() |
|
311 | 312 | self.exit(1) |
@@ -7,6 +7,7 b' Authors' | |||
|
7 | 7 | * Fernando Perez. |
|
8 | 8 | * Brian Granger |
|
9 | 9 | """ |
|
10 | from __future__ import print_function | |
|
10 | 11 | |
|
11 | 12 | #----------------------------------------------------------------------------- |
|
12 | 13 | # Copyright (C) 2009 The IPython Development Team |
@@ -74,7 +75,7 b' def getfigs(*fig_nums):' | |||
|
74 | 75 | for num in fig_nums: |
|
75 | 76 | f = Gcf.figs.get(num) |
|
76 | 77 | if f is None: |
|
77 | print('Warning: figure %s not available.' % num) | |
|
78 | print(('Warning: figure %s not available.' % num)) | |
|
78 | 79 | else: |
|
79 | 80 | figs.append(f.canvas.figure) |
|
80 | 81 | return figs |
@@ -21,6 +21,7 b' Authors' | |||
|
21 | 21 | #----------------------------------------------------------------------------- |
|
22 | 22 | |
|
23 | 23 | from __future__ import absolute_import |
|
24 | from __future__ import print_function | |
|
24 | 25 | |
|
25 | 26 | import glob |
|
26 | 27 | import os |
@@ -248,7 +249,7 b' class InteractiveShellApp(Configurable):' | |||
|
248 | 249 | self.log.info("Enabling GUI event loop integration, " |
|
249 | 250 | "eventloop=%s, matplotlib=%s", gui, backend) |
|
250 | 251 | if key == "auto": |
|
251 |
print |
|
|
252 | print(("Using matplotlib backend: %s" % backend)) | |
|
252 | 253 | else: |
|
253 | 254 | gui = r |
|
254 | 255 | self.log.info("Enabling GUI event loop integration, " |
@@ -1,2 +1,3 b'' | |||
|
1 | from __future__ import print_function | |
|
1 | 2 | import sys |
|
2 |
print |
|
|
3 | print(sys.argv[1:]) |
@@ -12,6 +12,7 b' This script is meant to be called by other parts of the test suite that call it' | |||
|
12 | 12 | via %run as if it were executed interactively by the user. As of 2011-05-29, |
|
13 | 13 | test_run.py calls it. |
|
14 | 14 | """ |
|
15 | from __future__ import print_function | |
|
15 | 16 | |
|
16 | 17 | #----------------------------------------------------------------------------- |
|
17 | 18 | # Module imports |
@@ -44,4 +45,4 b" if __name__ == '__main__':" | |||
|
44 | 45 | |
|
45 | 46 | def call_f(): |
|
46 | 47 | for func in cache: |
|
47 |
print |
|
|
48 | print('lowercased:',func().lower()) |
@@ -1,5 +1,6 b'' | |||
|
1 | 1 | """Tests for debugging machinery. |
|
2 | 2 | """ |
|
3 | from __future__ import print_function | |
|
3 | 4 | #----------------------------------------------------------------------------- |
|
4 | 5 | # Copyright (c) 2012, The IPython Development Team. |
|
5 | 6 | # |
@@ -36,7 +37,7 b' class _FakeInput(object):' | |||
|
36 | 37 | |
|
37 | 38 | def readline(self): |
|
38 | 39 | line = next(self.lines) |
|
39 |
print |
|
|
40 | print(line) | |
|
40 | 41 | return line+'\n' |
|
41 | 42 | |
|
42 | 43 | class PdbTestInput(object): |
@@ -6,6 +6,7 b' Authors' | |||
|
6 | 6 | * Fernando Perez |
|
7 | 7 | * Robert Kern |
|
8 | 8 | """ |
|
9 | from __future__ import print_function | |
|
9 | 10 | #----------------------------------------------------------------------------- |
|
10 | 11 | # Copyright (C) 2010-2011 The IPython Development Team |
|
11 | 12 | # |
@@ -497,10 +498,10 b" if __name__ == '__main__':" | |||
|
497 | 498 | # real interpreter would instead send it for execution somewhere. |
|
498 | 499 | #src = isp.source; raise EOFError # dbg |
|
499 | 500 | src, raw = isp.source_raw_reset() |
|
500 |
print |
|
|
501 |
print |
|
|
501 | print('Input source was:\n', src) | |
|
502 | print('Raw source was:\n', raw) | |
|
502 | 503 | except EOFError: |
|
503 |
print |
|
|
504 | print('Bye') | |
|
504 | 505 | |
|
505 | 506 | # Tests for cell magics support |
|
506 | 507 |
@@ -79,6 +79,7 b' Inheritance diagram:' | |||
|
79 | 79 | #***************************************************************************** |
|
80 | 80 | |
|
81 | 81 | from __future__ import unicode_literals |
|
82 | from __future__ import print_function | |
|
82 | 83 | |
|
83 | 84 | import inspect |
|
84 | 85 | import keyword |
@@ -1035,7 +1036,7 b' class VerboseTB(TBTools):' | |||
|
1035 | 1036 | try: |
|
1036 | 1037 | self.debugger() |
|
1037 | 1038 | except KeyboardInterrupt: |
|
1038 |
print |
|
|
1039 | print("\nKeyboardInterrupt") | |
|
1039 | 1040 | |
|
1040 | 1041 | #---------------------------------------------------------------------------- |
|
1041 | 1042 | class FormattedTB(VerboseTB, ListTB): |
@@ -1166,7 +1167,7 b' class AutoFormattedTB(FormattedTB):' | |||
|
1166 | 1167 | try: |
|
1167 | 1168 | self.debugger() |
|
1168 | 1169 | except KeyboardInterrupt: |
|
1169 |
print |
|
|
1170 | print("\nKeyboardInterrupt") | |
|
1170 | 1171 | |
|
1171 | 1172 | def structured_traceback(self, etype=None, value=None, tb=None, |
|
1172 | 1173 | tb_offset=None, context=5): |
@@ -1240,27 +1241,27 b' if __name__ == "__main__":' | |||
|
1240 | 1241 | i = f - g |
|
1241 | 1242 | return h / i |
|
1242 | 1243 | |
|
1243 |
print |
|
|
1244 |
print |
|
|
1244 | print('') | |
|
1245 | print('*** Before ***') | |
|
1245 | 1246 | try: |
|
1246 |
print |
|
|
1247 | print(spam(1, (2, 3))) | |
|
1247 | 1248 | except: |
|
1248 | 1249 | traceback.print_exc() |
|
1249 |
print |
|
|
1250 | print('') | |
|
1250 | 1251 | |
|
1251 | 1252 | handler = ColorTB() |
|
1252 |
print |
|
|
1253 | print('*** ColorTB ***') | |
|
1253 | 1254 | try: |
|
1254 |
print |
|
|
1255 | print(spam(1, (2, 3))) | |
|
1255 | 1256 | except: |
|
1256 | 1257 | handler(*sys.exc_info()) |
|
1257 |
print |
|
|
1258 | print('') | |
|
1258 | 1259 | |
|
1259 | 1260 | handler = VerboseTB() |
|
1260 |
print |
|
|
1261 | print('*** VerboseTB ***') | |
|
1261 | 1262 | try: |
|
1262 |
print |
|
|
1263 | print(spam(1, (2, 3))) | |
|
1263 | 1264 | except: |
|
1264 | 1265 | handler(*sys.exc_info()) |
|
1265 |
print |
|
|
1266 | print('') | |
|
1266 | 1267 |
@@ -35,6 +35,7 b' To enable the magics below, execute ``%load_ext rmagic``.' | |||
|
35 | 35 | {RGET_DOC} |
|
36 | 36 | |
|
37 | 37 | """ |
|
38 | from __future__ import print_function | |
|
38 | 39 | |
|
39 | 40 | #----------------------------------------------------------------------------- |
|
40 | 41 | # Copyright (C) 2012 The IPython Development Team |
@@ -617,9 +618,9 b' class RMagics(Magics):' | |||
|
617 | 618 | ri.set_writeconsole(old_writeconsole) |
|
618 | 619 | |
|
619 | 620 | except RInterpreterError as e: |
|
620 | print(e.stdout) | |
|
621 | print((e.stdout)) | |
|
621 | 622 | if not e.stdout.endswith(e.err): |
|
622 | print(e.err) | |
|
623 | print((e.err)) | |
|
623 | 624 | rmtree(tmpd) |
|
624 | 625 | return |
|
625 | 626 |
@@ -9,6 +9,7 b' To automatically restore stored variables at startup, add this to your' | |||
|
9 | 9 | |
|
10 | 10 | c.StoreMagic.autorestore = True |
|
11 | 11 | """ |
|
12 | from __future__ import print_function | |
|
12 | 13 | #----------------------------------------------------------------------------- |
|
13 | 14 | # Copyright (c) 2012, The IPython Development Team. |
|
14 | 15 | # |
@@ -50,8 +51,8 b' def refresh_variables(ip):' | |||
|
50 | 51 | try: |
|
51 | 52 | obj = db[key] |
|
52 | 53 | except KeyError: |
|
53 |
print |
|
|
54 |
print |
|
|
54 | print("Unable to restore variable '%s', ignoring (use %%store -d to forget!)" % justkey) | |
|
55 | print("The error was:", sys.exc_info()[0]) | |
|
55 | 56 | else: |
|
56 | 57 | #print "restored",justkey,"=",obj #dbg |
|
57 | 58 | ip.user_ns[justkey] = obj |
@@ -155,7 +156,7 b' class StoreMagics(Magics):' | |||
|
155 | 156 | try: |
|
156 | 157 | obj = db['autorestore/' + arg] |
|
157 | 158 | except KeyError: |
|
158 |
print |
|
|
159 | print("no stored variable %s" % arg) | |
|
159 | 160 | else: |
|
160 | 161 | ip.user_ns[arg] = obj |
|
161 | 162 | else: |
@@ -170,13 +171,13 b' class StoreMagics(Magics):' | |||
|
170 | 171 | else: |
|
171 | 172 | size = 0 |
|
172 | 173 | |
|
173 |
print |
|
|
174 | print('Stored variables and their in-db values:') | |
|
174 | 175 | fmt = '%-'+str(size)+'s -> %s' |
|
175 | 176 | get = db.get |
|
176 | 177 | for var in vars: |
|
177 | 178 | justkey = os.path.basename(var) |
|
178 | 179 | # print 30 first characters from every var |
|
179 |
print |
|
|
180 | print(fmt % (justkey, repr(get(var, '<unavailable>'))[:50])) | |
|
180 | 181 | |
|
181 | 182 | # default action - store the variable |
|
182 | 183 | else: |
@@ -188,8 +189,8 b' class StoreMagics(Magics):' | |||
|
188 | 189 | else: |
|
189 | 190 | fil = open(fnam, 'w') |
|
190 | 191 | obj = ip.ev(args[0]) |
|
191 |
print |
|
|
192 | obj.__class__.__name__, fnam) | |
|
192 | print("Writing '%s' (%s) to file '%s'." % (args[0], | |
|
193 | obj.__class__.__name__, fnam)) | |
|
193 | 194 | |
|
194 | 195 | |
|
195 | 196 | if not isinstance (obj, basestring): |
@@ -217,22 +218,22 b' class StoreMagics(Magics):' | |||
|
217 | 218 | staliases = db.get('stored_aliases',{}) |
|
218 | 219 | staliases[name] = cmd |
|
219 | 220 | db['stored_aliases'] = staliases |
|
220 |
print |
|
|
221 | print("Alias stored: %s (%s)" % (name, cmd)) | |
|
221 | 222 | return |
|
222 | 223 | |
|
223 | 224 | else: |
|
224 | 225 | modname = getattr(inspect.getmodule(obj), '__name__', '') |
|
225 | 226 | if modname == '__main__': |
|
226 |
print |
|
|
227 | print(textwrap.dedent("""\ | |
|
227 | 228 | Warning:%s is %s |
|
228 | 229 | Proper storage of interactively declared classes (or instances |
|
229 | 230 | of those classes) is not possible! Only instances |
|
230 | 231 | of classes in real modules on file system can be %%store'd. |
|
231 | """ % (args[0], obj) ) | |
|
232 | """ % (args[0], obj) )) | |
|
232 | 233 | return |
|
233 | 234 | #pickled = pickle.dumps(obj) |
|
234 | 235 | db[ 'autorestore/' + args[0] ] = obj |
|
235 |
print |
|
|
236 | print("Stored '%s' (%s)" % (args[0], obj.__class__.__name__)) | |
|
236 | 237 | |
|
237 | 238 | |
|
238 | 239 | def load_ipython_extension(ip): |
@@ -31,6 +31,7 b'' | |||
|
31 | 31 | Decorator module, see http://pypi.python.org/pypi/decorator |
|
32 | 32 | for the documentation. |
|
33 | 33 | """ |
|
34 | from __future__ import print_function | |
|
34 | 35 | |
|
35 | 36 | __version__ = '3.3.3' |
|
36 | 37 | |
@@ -162,8 +163,8 b' class FunctionMaker(object):' | |||
|
162 | 163 | # print >> sys.stderr, 'Compiling %s' % src |
|
163 | 164 | exec code in evaldict |
|
164 | 165 | except: |
|
165 |
print |
|
|
166 |
print |
|
|
166 | print('Error in generated code:', file=sys.stderr) | |
|
167 | print(src, file=sys.stderr) | |
|
167 | 168 | raise |
|
168 | 169 | func = evaldict[name] |
|
169 | 170 | if addsource: |
@@ -38,6 +38,7 b' To find the directory where IPython would like MathJax installed:' | |||
|
38 | 38 | $ python -m IPython.external.mathjax -d |
|
39 | 39 | |
|
40 | 40 | """ |
|
41 | from __future__ import print_function | |
|
41 | 42 | |
|
42 | 43 | |
|
43 | 44 | #----------------------------------------------------------------------------- |
@@ -86,14 +87,14 b' def prepare_dest(dest, replace=False):' | |||
|
86 | 87 | |
|
87 | 88 | if os.path.exists(dest): |
|
88 | 89 | if replace: |
|
89 |
print |
|
|
90 | print("removing existing MathJax at %s" % dest) | |
|
90 | 91 | shutil.rmtree(dest) |
|
91 | 92 | return True |
|
92 | 93 | else: |
|
93 | 94 | mathjax_js = os.path.join(dest, 'MathJax.js') |
|
94 | 95 | if not os.path.exists(mathjax_js): |
|
95 | 96 | raise IOError("%s exists, but does not contain MathJax.js" % dest) |
|
96 |
print |
|
|
97 | print("%s already exists" % mathjax_js) | |
|
97 | 98 | return False |
|
98 | 99 | else: |
|
99 | 100 | return True |
@@ -156,7 +157,7 b" def install_mathjax(tag='v2.2', dest=default_dest, replace=False, file=None, ext" | |||
|
156 | 157 | try: |
|
157 | 158 | anything_to_do = prepare_dest(dest, replace) |
|
158 | 159 | except OSError as e: |
|
159 | print("ERROR %s, require write access to %s" % (e, dest)) | |
|
160 | print(("ERROR %s, require write access to %s" % (e, dest))) | |
|
160 | 161 | return 1 |
|
161 | 162 | else: |
|
162 | 163 | if not anything_to_do: |
@@ -165,11 +166,11 b" def install_mathjax(tag='v2.2', dest=default_dest, replace=False, file=None, ext" | |||
|
165 | 166 | if file is None: |
|
166 | 167 | # download mathjax |
|
167 | 168 | mathjax_url = "https://github.com/mathjax/MathJax/archive/%s.tar.gz" %tag |
|
168 |
print |
|
|
169 | print("Downloading mathjax source from %s" % mathjax_url) | |
|
169 | 170 | response = urllib2.urlopen(mathjax_url) |
|
170 | 171 | file = response.fp |
|
171 | 172 | |
|
172 |
print |
|
|
173 | print("Extracting to %s" % dest) | |
|
173 | 174 | extractor(file, dest) |
|
174 | 175 | return 0 |
|
175 | 176 | |
@@ -205,7 +206,7 b' def main():' | |||
|
205 | 206 | dest = os.path.join(pargs.install_dir, 'mathjax') |
|
206 | 207 | |
|
207 | 208 | if pargs.print_dest: |
|
208 |
print |
|
|
209 | print(dest) | |
|
209 | 210 | return |
|
210 | 211 | |
|
211 | 212 | # remove/replace existing mathjax? |
@@ -5,6 +5,7 b' Authors:' | |||
|
5 | 5 | |
|
6 | 6 | * Brian Granger |
|
7 | 7 | """ |
|
8 | from __future__ import print_function | |
|
8 | 9 | #----------------------------------------------------------------------------- |
|
9 | 10 | # Copyright (C) 2013 The IPython Development Team |
|
10 | 11 | # |
@@ -628,7 +629,7 b' class NotebookApp(BaseIPythonApplication):' | |||
|
628 | 629 | time.sleep(0.1) |
|
629 | 630 | info = self.log.info |
|
630 | 631 | info('interrupted') |
|
631 |
print |
|
|
632 | print(self.notebook_info()) | |
|
632 | 633 | sys.stdout.write("Shutdown this notebook server (y/[n])? ") |
|
633 | 634 | sys.stdout.flush() |
|
634 | 635 | r,w,x = select.select([sys.stdin], [], [], 5) |
@@ -639,8 +640,8 b' class NotebookApp(BaseIPythonApplication):' | |||
|
639 | 640 | ioloop.IOLoop.instance().stop() |
|
640 | 641 | return |
|
641 | 642 | else: |
|
642 |
print |
|
|
643 |
print |
|
|
643 | print("No answer for 5s:", end=' ') | |
|
644 | print("resuming operation...") | |
|
644 | 645 | # no answer, or answer is no: |
|
645 | 646 | # set it back to original SIGINT handler |
|
646 | 647 | # use IOLoop.add_callback because signal.signal must be called |
@@ -652,7 +653,7 b' class NotebookApp(BaseIPythonApplication):' | |||
|
652 | 653 | ioloop.IOLoop.instance().stop() |
|
653 | 654 | |
|
654 | 655 | def _signal_info(self, sig, frame): |
|
655 |
print |
|
|
656 | print(self.notebook_info()) | |
|
656 | 657 | |
|
657 | 658 | def init_components(self): |
|
658 | 659 | """Check the components submodule, and warn if it's unclean""" |
@@ -1,5 +1,6 b'' | |||
|
1 | 1 | # coding: utf-8 |
|
2 | 2 | """Tests for the notebook manager.""" |
|
3 | from __future__ import print_function | |
|
3 | 4 | |
|
4 | 5 | import os |
|
5 | 6 | |
@@ -66,7 +67,7 b' class TestNotebookManager(TestCase):' | |||
|
66 | 67 | try: |
|
67 | 68 | os.makedirs(os_path) |
|
68 | 69 | except OSError: |
|
69 |
print |
|
|
70 | print("Directory already exists.") | |
|
70 | 71 | |
|
71 | 72 | def test_create_notebook_model(self): |
|
72 | 73 | with TemporaryDirectory() as td: |
@@ -21,6 +21,7 b' separate implementation).' | |||
|
21 | 21 | An example notebook is provided in our documentation illustrating interactive |
|
22 | 22 | use of the system. |
|
23 | 23 | """ |
|
24 | from __future__ import print_function | |
|
24 | 25 | |
|
25 | 26 | #***************************************************************************** |
|
26 | 27 | # Copyright (C) 2005-2006 Fernando Perez <fperez@colorado.edu> |
@@ -190,7 +191,7 b' class BackgroundJobManager(object):' | |||
|
190 | 191 | job.num = len(self.all)+1 if self.all else 0 |
|
191 | 192 | self.running.append(job) |
|
192 | 193 | self.all[job.num] = job |
|
193 |
print |
|
|
194 | print('Starting job # %s in a separate thread.' % job.num) | |
|
194 | 195 | job.start() |
|
195 | 196 | return job |
|
196 | 197 | |
@@ -245,10 +246,10 b' class BackgroundJobManager(object):' | |||
|
245 | 246 | Return True if the group had any elements.""" |
|
246 | 247 | |
|
247 | 248 | if group: |
|
248 |
print |
|
|
249 | print('%s jobs:' % name) | |
|
249 | 250 | for job in group: |
|
250 |
print |
|
|
251 | ||
|
251 | print('%s : %s' % (job.num,job)) | |
|
252 | print() | |
|
252 | 253 | return True |
|
253 | 254 | |
|
254 | 255 | def _group_flush(self,group,name): |
@@ -259,7 +260,7 b' class BackgroundJobManager(object):' | |||
|
259 | 260 | njobs = len(group) |
|
260 | 261 | if njobs: |
|
261 | 262 | plural = {1:''}.setdefault(njobs,'s') |
|
262 |
print |
|
|
263 | print('Flushing %s %s job%s.' % (njobs,name,plural)) | |
|
263 | 264 | group[:] = [] |
|
264 | 265 | return True |
|
265 | 266 | |
@@ -325,7 +326,7 b' class BackgroundJobManager(object):' | |||
|
325 | 326 | fl_comp = self._group_flush(self.completed, 'Completed') |
|
326 | 327 | fl_dead = self._group_flush(self.dead, 'Dead') |
|
327 | 328 | if not (fl_comp or fl_dead): |
|
328 |
print |
|
|
329 | print('No jobs to flush.') | |
|
329 | 330 | |
|
330 | 331 | def result(self,num): |
|
331 | 332 | """result(N) -> return the result of job N.""" |
@@ -345,9 +346,9 b' class BackgroundJobManager(object):' | |||
|
345 | 346 | if job is None: |
|
346 | 347 | self._update_status() |
|
347 | 348 | for deadjob in self.dead: |
|
348 |
print |
|
|
349 | print("Traceback for: %r" % deadjob) | |
|
349 | 350 | self._traceback(deadjob) |
|
350 | ||
|
351 | print() | |
|
351 | 352 | else: |
|
352 | 353 | self._traceback(job) |
|
353 | 354 | |
@@ -416,7 +417,7 b' class BackgroundJobBase(threading.Thread):' | |||
|
416 | 417 | return '<BackgroundJob #%d: %s>' % (self.num, self.strform) |
|
417 | 418 | |
|
418 | 419 | def traceback(self): |
|
419 |
print |
|
|
420 | print(self._tb) | |
|
420 | 421 | |
|
421 | 422 | def run(self): |
|
422 | 423 | try: |
@@ -17,6 +17,7 b' Alternatively, you can add a dreload builtin alongside normal reload with::' | |||
|
17 | 17 | This code is almost entirely based on knee.py, which is a Python |
|
18 | 18 | re-implementation of hierarchical module import. |
|
19 | 19 | """ |
|
20 | from __future__ import print_function | |
|
20 | 21 | #***************************************************************************** |
|
21 | 22 | # Copyright (C) 2001 Nathaniel Gray <n8gray@caltech.edu> |
|
22 | 23 | # |
@@ -167,7 +168,7 b' def import_submodule(mod, subname, fullname):' | |||
|
167 | 168 | if fullname in found_now and fullname in sys.modules: |
|
168 | 169 | m = sys.modules[fullname] |
|
169 | 170 | else: |
|
170 |
print |
|
|
171 | print('Reloading', fullname) | |
|
171 | 172 | found_now[fullname] = 1 |
|
172 | 173 | oldm = sys.modules.get(fullname, None) |
|
173 | 174 |
@@ -4,6 +4,7 b' They should honor the line number argument, at least.' | |||
|
4 | 4 | |
|
5 | 5 | Contributions are *very* welcome. |
|
6 | 6 | """ |
|
7 | from __future__ import print_function | |
|
7 | 8 | |
|
8 | 9 | import os |
|
9 | 10 | import pipes |
@@ -45,7 +46,7 b' def install_editor(template, wait=False):' | |||
|
45 | 46 | if line is None: |
|
46 | 47 | line = 0 |
|
47 | 48 | cmd = template.format(filename=pipes.quote(filename), line=line) |
|
48 |
print |
|
|
49 | print(">", cmd) | |
|
49 | 50 | proc = subprocess.Popen(cmd, shell=True) |
|
50 | 51 | if wait and proc.wait() != 0: |
|
51 | 52 | raise TryNext() |
@@ -2,6 +2,7 b'' | |||
|
2 | 2 | """ |
|
3 | 3 | GLUT Inputhook support functions |
|
4 | 4 | """ |
|
5 | from __future__ import print_function | |
|
5 | 6 | |
|
6 | 7 | #----------------------------------------------------------------------------- |
|
7 | 8 | # Copyright (C) 2008-2011 The IPython Development Team |
@@ -114,7 +115,7 b' def glut_close():' | |||
|
114 | 115 | def glut_int_handler(signum, frame): |
|
115 | 116 | # Catch sigint and print the defautl message |
|
116 | 117 | signal.signal(signal.SIGINT, signal.default_int_handler) |
|
117 |
print |
|
|
118 | print('\nKeyboardInterrupt') | |
|
118 | 119 | # Need to reprint the prompt at this stage |
|
119 | 120 | |
|
120 | 121 |
@@ -103,6 +103,7 b' Inheritance diagram:' | |||
|
103 | 103 | Portions (c) 2009 by Robert Kern. |
|
104 | 104 | :license: BSD License. |
|
105 | 105 | """ |
|
106 | from __future__ import print_function | |
|
106 | 107 | from contextlib import contextmanager |
|
107 | 108 | import sys |
|
108 | 109 | import types |
@@ -784,6 +785,6 b" if __name__ == '__main__':" | |||
|
784 | 785 | self.list = ["blub", "blah", self] |
|
785 | 786 | |
|
786 | 787 | def get_foo(self): |
|
787 |
print |
|
|
788 | print("foo") | |
|
788 | 789 | |
|
789 | 790 | pprint(Foo(), verbose=True) |
@@ -1,4 +1,5 b'' | |||
|
1 | 1 | """PostProcessor for serving reveal.js HTML slideshows.""" |
|
2 | from __future__ import print_function | |
|
2 | 3 | #----------------------------------------------------------------------------- |
|
3 | 4 | #Copyright (c) 2013, the IPython Development Team. |
|
4 | 5 | # |
@@ -92,7 +93,7 b' class ServePostProcessor(PostProcessorBase):' | |||
|
92 | 93 | http_server = httpserver.HTTPServer(app) |
|
93 | 94 | http_server.listen(self.port, address=self.ip) |
|
94 | 95 | url = "http://%s:%i/%s" % (self.ip, self.port, filename) |
|
95 | print("Serving your slides at %s" % url) | |
|
96 | print(("Serving your slides at %s" % url)) | |
|
96 | 97 | print("Use Control-C to stop this server") |
|
97 | 98 | if self.open_in_browser: |
|
98 | 99 | webbrowser.open(url, new=2) |
@@ -1,6 +1,7 b'' | |||
|
1 | 1 | """ |
|
2 | 2 | Contains debug writer. |
|
3 | 3 | """ |
|
4 | from __future__ import print_function | |
|
4 | 5 | #----------------------------------------------------------------------------- |
|
5 | 6 | #Copyright (c) 2013, the IPython Development Team. |
|
6 | 7 | # |
@@ -34,9 +35,9 b' class DebugWriter(WriterBase):' | |||
|
34 | 35 | """ |
|
35 | 36 | |
|
36 | 37 | if isinstance(resources['outputs'], dict): |
|
37 | print("outputs extracted from %s" % notebook_name) | |
|
38 | print('-' * 80) | |
|
38 | print(("outputs extracted from %s" % notebook_name)) | |
|
39 | print(('-' * 80)) | |
|
39 | 40 | pprint(resources['outputs'], indent=2, width=70) |
|
40 | 41 | else: |
|
41 | print("no outputs extracted from %s" % notebook_name) | |
|
42 | print('=' * 80) | |
|
42 | print(("no outputs extracted from %s" % notebook_name)) | |
|
43 | print(('=' * 80)) |
@@ -1,3 +1,4 b'' | |||
|
1 | from __future__ import print_function | |
|
1 | 2 | #!/usr/bin/env python |
|
2 | 3 | # -*- coding: utf8 -*- |
|
3 | 4 | import argparse |
@@ -79,10 +80,10 b" if __name__ == '__main__':" | |||
|
79 | 80 | key=args.key, |
|
80 | 81 | verbose=args.verbose) |
|
81 | 82 | if nerror is 0: |
|
82 |
print |
|
|
83 | print(u"[Pass]",name) | |
|
83 | 84 | else : |
|
84 |
print |
|
|
85 | print(u"[ ]",name,'(%d)'%(nerror)) | |
|
85 | 86 | if args.verbose : |
|
86 |
print |
|
|
87 | print('==================================================') | |
|
87 | 88 | |
|
88 | 89 |
@@ -9,6 +9,7 b' Authors:' | |||
|
9 | 9 | * MinRK |
|
10 | 10 | |
|
11 | 11 | """ |
|
12 | from __future__ import print_function | |
|
12 | 13 | |
|
13 | 14 | #----------------------------------------------------------------------------- |
|
14 | 15 | # Copyright (C) 2008-2011 The IPython Development Team |
@@ -595,8 +596,8 b' class IPClusterApp(BaseIPythonApplication):' | |||
|
595 | 596 | |
|
596 | 597 | def start(self): |
|
597 | 598 | if self.subapp is None: |
|
598 |
print |
|
|
599 | ||
|
599 | print("No subcommand specified. Must specify one of: %s"%(self.subcommands.keys())) | |
|
600 | print() | |
|
600 | 601 | self.print_description() |
|
601 | 602 | self.print_subcommands() |
|
602 | 603 | self.exit(1) |
@@ -4,6 +4,7 b' Authors:' | |||
|
4 | 4 | |
|
5 | 5 | * MinRK |
|
6 | 6 | """ |
|
7 | from __future__ import print_function | |
|
7 | 8 | #----------------------------------------------------------------------------- |
|
8 | 9 | # Copyright (C) 2010-2011 The IPython Development Team |
|
9 | 10 | # |
@@ -738,9 +739,9 b' class Client(HasTraits):' | |||
|
738 | 739 | msg_id = parent['msg_id'] |
|
739 | 740 | if msg_id not in self.outstanding: |
|
740 | 741 | if msg_id in self.history: |
|
741 |
print |
|
|
742 | print(("got stale result: %s"%msg_id)) | |
|
742 | 743 | else: |
|
743 |
print |
|
|
744 | print(("got unknown result: %s"%msg_id)) | |
|
744 | 745 | else: |
|
745 | 746 | self.outstanding.remove(msg_id) |
|
746 | 747 | |
@@ -774,11 +775,11 b' class Client(HasTraits):' | |||
|
774 | 775 | msg_id = parent['msg_id'] |
|
775 | 776 | if msg_id not in self.outstanding: |
|
776 | 777 | if msg_id in self.history: |
|
777 |
print |
|
|
778 |
print |
|
|
779 |
print |
|
|
778 | print(("got stale result: %s"%msg_id)) | |
|
779 | print(self.results[msg_id]) | |
|
780 | print(msg) | |
|
780 | 781 | else: |
|
781 |
print |
|
|
782 | print(("got unknown result: %s"%msg_id)) | |
|
782 | 783 | else: |
|
783 | 784 | self.outstanding.remove(msg_id) |
|
784 | 785 | content = msg['content'] |
@@ -26,6 +26,7 b' Usage' | |||
|
26 | 26 | {CONFIG_DOC} |
|
27 | 27 | |
|
28 | 28 | """ |
|
29 | from __future__ import print_function | |
|
29 | 30 | |
|
30 | 31 | #----------------------------------------------------------------------------- |
|
31 | 32 | # Copyright (C) 2008 The IPython Development Team |
@@ -251,7 +252,7 b' class ParallelMagics(Magics):' | |||
|
251 | 252 | else: |
|
252 | 253 | str_targets = str(targets) |
|
253 | 254 | if self.verbose: |
|
254 |
print |
|
|
255 | print(base + " execution on engine(s): %s" % str_targets) | |
|
255 | 256 | |
|
256 | 257 | result = self.view.execute(cell, silent=False, block=False) |
|
257 | 258 | self.last_result = result |
@@ -358,7 +359,7 b' class ParallelMagics(Magics):' | |||
|
358 | 359 | self.shell.run_cell = self.pxrun_cell |
|
359 | 360 | |
|
360 | 361 | self._autopx = True |
|
361 |
print |
|
|
362 | print("%autopx enabled") | |
|
362 | 363 | |
|
363 | 364 | def _disable_autopx(self): |
|
364 | 365 | """Disable %autopx by restoring the original InteractiveShell.run_cell. |
@@ -366,7 +367,7 b' class ParallelMagics(Magics):' | |||
|
366 | 367 | if self._autopx: |
|
367 | 368 | self.shell.run_cell = self._original_run_cell |
|
368 | 369 | self._autopx = False |
|
369 |
print |
|
|
370 | print("%autopx disabled") | |
|
370 | 371 | |
|
371 | 372 | def pxrun_cell(self, raw_cell, store_history=False, silent=False): |
|
372 | 373 | """drop-in replacement for InteractiveShell.run_cell. |
@@ -4,6 +4,7 b' Authors:' | |||
|
4 | 4 | |
|
5 | 5 | * Min RK |
|
6 | 6 | """ |
|
7 | from __future__ import print_function | |
|
7 | 8 | #----------------------------------------------------------------------------- |
|
8 | 9 | # Copyright (C) 2010-2011 The IPython Development Team |
|
9 | 10 | # |
@@ -482,9 +483,9 b' class DirectView(View):' | |||
|
482 | 483 | modules.add(key) |
|
483 | 484 | if not quiet: |
|
484 | 485 | if fromlist: |
|
485 |
print |
|
|
486 | print("importing %s from %s on engine(s)"%(','.join(fromlist), name)) | |
|
486 | 487 | else: |
|
487 |
print |
|
|
488 | print("importing %s on engine(s)"%name) | |
|
488 | 489 | results.append(self.apply_async(remote_import, name, fromlist, level)) |
|
489 | 490 | # restore override |
|
490 | 491 | __builtin__.__import__ = save_import |
@@ -830,7 +831,7 b' class DirectView(View):' | |||
|
830 | 831 | # This is injected into __builtins__. |
|
831 | 832 | ip = get_ipython() |
|
832 | 833 | except NameError: |
|
833 |
print |
|
|
834 | print("The IPython parallel magics (%px, etc.) only work within IPython.") | |
|
834 | 835 | return |
|
835 | 836 | |
|
836 | 837 | M = ParallelMagics(ip, self, suffix) |
@@ -1,4 +1,5 b'' | |||
|
1 | 1 | """toplevel setup/teardown for parallel tests.""" |
|
2 | from __future__ import print_function | |
|
2 | 3 | |
|
3 | 4 | #------------------------------------------------------------------------------- |
|
4 | 5 | # Copyright (C) 2011 The IPython Development Team |
@@ -118,15 +119,15 b' def teardown():' | |||
|
118 | 119 | try: |
|
119 | 120 | p.stop() |
|
120 | 121 | except Exception as e: |
|
121 |
print |
|
|
122 | print(e) | |
|
122 | 123 | pass |
|
123 | 124 | if p.poll() is None: |
|
124 | 125 | time.sleep(.25) |
|
125 | 126 | if p.poll() is None: |
|
126 | 127 | try: |
|
127 |
print |
|
|
128 | print('cleaning up test process...') | |
|
128 | 129 | p.signal(SIGKILL) |
|
129 | 130 | except: |
|
130 |
print |
|
|
131 | print("couldn't shutdown process: ", p) | |
|
131 | 132 | blackhole.close() |
|
132 | 133 |
@@ -51,6 +51,7 b' Authors' | |||
|
51 | 51 | - VΓ‘clavΕ milauer <eudoxos-AT-arcig.cz>: Prompt generalizations. |
|
52 | 52 | - Skipper Seabold, refactoring, cleanups, pure python addition |
|
53 | 53 | """ |
|
54 | from __future__ import print_function | |
|
54 | 55 | |
|
55 | 56 | #----------------------------------------------------------------------------- |
|
56 | 57 | # Imports |
@@ -649,7 +650,7 b' class IPythonDirective(Directive):' | |||
|
649 | 650 | #print lines |
|
650 | 651 | if len(lines)>2: |
|
651 | 652 | if debug: |
|
652 |
print |
|
|
653 | print('\n'.join(lines)) | |
|
653 | 654 | else: #NOTE: this raises some errors, what's it for? |
|
654 | 655 | #print 'INSERTING %d lines'%len(lines) |
|
655 | 656 | self.state_machine.insert_input( |
@@ -826,4 +827,4 b" if __name__=='__main__':" | |||
|
826 | 827 | if not os.path.isdir('_static'): |
|
827 | 828 | os.mkdir('_static') |
|
828 | 829 | test() |
|
829 |
print |
|
|
830 | print('All OK? Check figures in _static/') |
@@ -23,6 +23,7 b' Notes' | |||
|
23 | 23 | #----------------------------------------------------------------------------- |
|
24 | 24 | |
|
25 | 25 | from __future__ import with_statement |
|
26 | from __future__ import print_function | |
|
26 | 27 | |
|
27 | 28 | import sys |
|
28 | 29 | import warnings |
@@ -154,7 +155,7 b' class InteractiveShellEmbed(TerminalInteractiveShell):' | |||
|
154 | 155 | self.banner2 = self.old_banner2 |
|
155 | 156 | |
|
156 | 157 | if self.exit_msg is not None: |
|
157 |
print |
|
|
158 | print(self.exit_msg) | |
|
158 | 159 | |
|
159 | 160 | def mainloop(self, local_ns=None, module=None, stack_depth=0, |
|
160 | 161 | display_banner=None, global_ns=None, compile_flags=None): |
@@ -24,6 +24,7 b' Authors' | |||
|
24 | 24 | #----------------------------------------------------------------------------- |
|
25 | 25 | |
|
26 | 26 | from __future__ import absolute_import |
|
27 | from __future__ import print_function | |
|
27 | 28 | |
|
28 | 29 | import logging |
|
29 | 30 | import os |
@@ -196,7 +197,7 b' class LocateIPythonApp(BaseIPythonApplication):' | |||
|
196 | 197 | if self.subapp is not None: |
|
197 | 198 | return self.subapp.start() |
|
198 | 199 | else: |
|
199 |
print |
|
|
200 | print(self.ipython_dir) | |
|
200 | 201 | |
|
201 | 202 | |
|
202 | 203 | class TerminalIPythonApp(BaseIPythonApplication, InteractiveShellApp): |
@@ -344,7 +345,7 b' class TerminalIPythonApp(BaseIPythonApplication, InteractiveShellApp):' | |||
|
344 | 345 | if self.display_banner and self.interact: |
|
345 | 346 | self.shell.show_banner() |
|
346 | 347 | # Make sure there is a space below the banner. |
|
347 | if self.log_level <= logging.INFO: print | |
|
348 | if self.log_level <= logging.INFO: print() | |
|
348 | 349 | |
|
349 | 350 | def _pylab_changed(self, name, old, new): |
|
350 | 351 | """Replace --pylab='inline' with --pylab='auto'""" |
@@ -1,6 +1,7 b'' | |||
|
1 | 1 | #!/usr/bin/env python |
|
2 | 2 | """Nose-based test runner. |
|
3 | 3 | """ |
|
4 | from __future__ import print_function | |
|
4 | 5 | |
|
5 | 6 | from nose.core import main |
|
6 | 7 | from nose.plugins.builtin import plugins |
@@ -10,8 +11,8 b' from . import ipdoctest' | |||
|
10 | 11 | from .ipdoctest import IPDocTestRunner |
|
11 | 12 | |
|
12 | 13 | if __name__ == '__main__': |
|
13 |
print |
|
|
14 | ||
|
14 | print('WARNING: this code is incomplete!') | |
|
15 | print() | |
|
15 | 16 | |
|
16 | 17 | pp = [x() for x in plugins] # activate all builtin plugins first |
|
17 | 18 | main(testRunner=IPDocTestRunner(), |
@@ -2,6 +2,7 b'' | |||
|
2 | 2 | |
|
3 | 3 | This is used by a companion test case. |
|
4 | 4 | """ |
|
5 | from __future__ import print_function | |
|
5 | 6 | |
|
6 | 7 | import gc |
|
7 | 8 | |
@@ -16,4 +17,4 b" if __name__ == '__main__':" | |||
|
16 | 17 | c_refs = gc.get_referrers(c) |
|
17 | 18 | ref_ids = map(id,c_refs) |
|
18 | 19 | |
|
19 |
print |
|
|
20 | print('c referrers:',map(type,c_refs)) |
@@ -1,2 +1,3 b'' | |||
|
1 | from __future__ import print_function | |
|
1 | 2 | x = 1 |
|
2 |
print |
|
|
3 | print('x is:',x) |
@@ -1,5 +1,6 b'' | |||
|
1 | 1 | """Tests for the decorators we've created for IPython. |
|
2 | 2 | """ |
|
3 | from __future__ import print_function | |
|
3 | 4 | |
|
4 | 5 | # Module imports |
|
5 | 6 | # Std lib |
@@ -67,9 +68,9 b' def doctest_bad(x,y=1,**k):' | |||
|
67 | 68 | >>> 1+1 |
|
68 | 69 | 3 |
|
69 | 70 | """ |
|
70 |
print |
|
|
71 |
print |
|
|
72 |
print |
|
|
71 | print('x:',x) | |
|
72 | print('y:',y) | |
|
73 | print('k:',k) | |
|
73 | 74 | |
|
74 | 75 | |
|
75 | 76 | def call_doctest_bad(): |
@@ -117,7 +118,7 b' class FooClass(object):' | |||
|
117 | 118 | >>> f = FooClass(3) |
|
118 | 119 | junk |
|
119 | 120 | """ |
|
120 |
print |
|
|
121 | print('Making a FooClass.') | |
|
121 | 122 | self.x = x |
|
122 | 123 | |
|
123 | 124 | @skip_doctest |
@@ -14,6 +14,7 b' Tests for testing.tools' | |||
|
14 | 14 | # Imports |
|
15 | 15 | #----------------------------------------------------------------------------- |
|
16 | 16 | from __future__ import with_statement |
|
17 | from __future__ import print_function | |
|
17 | 18 | |
|
18 | 19 | import os |
|
19 | 20 | import unittest |
@@ -73,16 +74,16 b' def test_temp_pyfile():' | |||
|
73 | 74 | class TestAssertPrints(unittest.TestCase): |
|
74 | 75 | def test_passing(self): |
|
75 | 76 | with tt.AssertPrints("abc"): |
|
76 |
print |
|
|
77 |
print |
|
|
78 |
print |
|
|
77 | print("abcd") | |
|
78 | print("def") | |
|
79 | print(b"ghi") | |
|
79 | 80 | |
|
80 | 81 | def test_failing(self): |
|
81 | 82 | def func(): |
|
82 | 83 | with tt.AssertPrints("abc"): |
|
83 |
print |
|
|
84 |
print |
|
|
85 |
print |
|
|
84 | print("acd") | |
|
85 | print("def") | |
|
86 | print(b"ghi") | |
|
86 | 87 | |
|
87 | 88 | self.assertRaises(AssertionError, func) |
|
88 | 89 |
@@ -31,6 +31,7 b' Older entry points' | |||
|
31 | 31 | are the same, except instead of generating tokens, tokeneater is a callback |
|
32 | 32 | function to which the 5 fields described above are passed as 5 arguments, |
|
33 | 33 | each time a new token is found.""" |
|
34 | from __future__ import print_function | |
|
34 | 35 | |
|
35 | 36 | __author__ = 'Ka-Ping Yee <ping@lfw.org>' |
|
36 | 37 | __credits__ = ('GvR, ESR, Tim Peters, Thomas Wouters, Fred Drake, ' |
@@ -161,8 +162,8 b' class StopTokenizing(Exception): pass' | |||
|
161 | 162 | def printtoken(type, token, srow_scol, erow_ecol, line): # for testing |
|
162 | 163 | srow, scol = srow_scol |
|
163 | 164 | erow, ecol = erow_ecol |
|
164 |
print |
|
|
165 | (srow, scol, erow, ecol, tok_name[type], repr(token)) | |
|
165 | print("%d,%d-%d,%d:\t%s\t%s" % \ | |
|
166 | (srow, scol, erow, ecol, tok_name[type], repr(token))) | |
|
166 | 167 | |
|
167 | 168 | def tokenize(readline, tokeneater=printtoken): |
|
168 | 169 | """ |
@@ -2,6 +2,7 b'' | |||
|
2 | 2 | """ |
|
3 | 3 | Utilities for working with stack frames. |
|
4 | 4 | """ |
|
5 | from __future__ import print_function | |
|
5 | 6 | |
|
6 | 7 | #----------------------------------------------------------------------------- |
|
7 | 8 | # Copyright (C) 2008-2011 The IPython Development Team |
@@ -78,8 +79,8 b" def debugx(expr,pre_msg=''):" | |||
|
78 | 79 | expr->value pair.""" |
|
79 | 80 | |
|
80 | 81 | cf = sys._getframe(1) |
|
81 |
print |
|
|
82 | eval(expr,cf.f_globals,cf.f_locals)) | |
|
82 | print('[DBG:%s] %s%s -> %r' % (cf.f_code.co_name,pre_msg,expr, | |
|
83 | eval(expr,cf.f_globals,cf.f_locals))) | |
|
83 | 84 | |
|
84 | 85 | |
|
85 | 86 | # deactivate it by uncommenting the following line, which makes it a no-op |
@@ -32,6 +32,7 b' Author: Ville Vainio <vivainio@gmail.com>' | |||
|
32 | 32 | License: MIT open source license. |
|
33 | 33 | |
|
34 | 34 | """ |
|
35 | from __future__ import print_function | |
|
35 | 36 | |
|
36 | 37 | from IPython.external.path import path as Path |
|
37 | 38 | import os,stat,time |
@@ -138,7 +139,7 b' class PickleShareDB(collections.MutableMapping):' | |||
|
138 | 139 | try: |
|
139 | 140 | all.update(self[f]) |
|
140 | 141 | except KeyError: |
|
141 |
print |
|
|
142 | print("Corrupt",f,"deleted - hset is not threadsafe!") | |
|
142 | 143 | del self[f] |
|
143 | 144 | |
|
144 | 145 | self.uncache(f) |
@@ -280,25 +281,25 b' class PickleShareLink:' | |||
|
280 | 281 | def test(): |
|
281 | 282 | db = PickleShareDB('~/testpickleshare') |
|
282 | 283 | db.clear() |
|
283 |
print |
|
|
284 | print("Should be empty:",db.items()) | |
|
284 | 285 | db['hello'] = 15 |
|
285 | 286 | db['aku ankka'] = [1,2,313] |
|
286 | 287 | db['paths/nest/ok/keyname'] = [1,(5,46)] |
|
287 | 288 | db.hset('hash', 'aku', 12) |
|
288 | 289 | db.hset('hash', 'ankka', 313) |
|
289 |
print |
|
|
290 |
print |
|
|
291 |
print |
|
|
292 |
print |
|
|
293 |
print |
|
|
294 |
print |
|
|
290 | print("12 =",db.hget('hash','aku')) | |
|
291 | print("313 =",db.hget('hash','ankka')) | |
|
292 | print("all hashed",db.hdict('hash')) | |
|
293 | print(db.keys()) | |
|
294 | print(db.keys('paths/nest/ok/k*')) | |
|
295 | print(dict(db)) # snapsot of whole db | |
|
295 | 296 | db.uncache() # frees memory, causes re-reads later |
|
296 | 297 | |
|
297 | 298 | # shorthand for accessing deeply nested files |
|
298 | 299 | lnk = db.getlink('myobjects/test') |
|
299 | 300 | lnk.foo = 2 |
|
300 | 301 | lnk.bar = lnk.foo + 5 |
|
301 |
print |
|
|
302 | print(lnk.bar) # 7 | |
|
302 | 303 | |
|
303 | 304 | def stress(): |
|
304 | 305 | db = PickleShareDB('~/fsdbtest') |
@@ -316,7 +317,7 b' def stress():' | |||
|
316 | 317 | db[str(j)] = db.get(str(j), []) + [(i,j,"proc %d" % os.getpid())] |
|
317 | 318 | db.hset('hash',j, db.hget('hash',j,15) + 1 ) |
|
318 | 319 | |
|
319 |
print |
|
|
320 | print(i, end=' ') | |
|
320 | 321 | sys.stdout.flush() |
|
321 | 322 | if i % 10 == 0: |
|
322 | 323 | db.uncache() |
@@ -335,7 +336,7 b' def main():' | |||
|
335 | 336 | DB = PickleShareDB |
|
336 | 337 | import sys |
|
337 | 338 | if len(sys.argv) < 2: |
|
338 |
print |
|
|
339 | print(usage) | |
|
339 | 340 | return |
|
340 | 341 | |
|
341 | 342 | cmd = sys.argv[1] |
@@ -355,7 +356,7 b' def main():' | |||
|
355 | 356 | elif cmd == 'testwait': |
|
356 | 357 | db = DB(args[0]) |
|
357 | 358 | db.clear() |
|
358 |
print |
|
|
359 | print(db.waitget('250')) | |
|
359 | 360 | elif cmd == 'test': |
|
360 | 361 | test() |
|
361 | 362 | stress() |
@@ -1,5 +1,6 b'' | |||
|
1 | 1 | # encoding: utf-8 |
|
2 | 2 | """Tests for IPython.utils.text""" |
|
3 | from __future__ import print_function | |
|
3 | 4 | |
|
4 | 5 | #----------------------------------------------------------------------------- |
|
5 | 6 | # Copyright (C) 2011 The IPython Development Team |
@@ -45,11 +46,11 b' def test_columnize_random():' | |||
|
45 | 46 | longer_line = max([len(x) for x in out.split('\n')]) |
|
46 | 47 | longer_element = max(rand_len) |
|
47 | 48 | if longer_line > displaywidth: |
|
48 |
print |
|
|
49 |
print |
|
|
50 |
print |
|
|
51 |
print |
|
|
52 |
print |
|
|
49 | print("Columnize displayed something lager than displaywidth : %s " % longer_line) | |
|
50 | print("longer element : %s " % longer_element) | |
|
51 | print("displaywidth : %s " % displaywidth) | |
|
52 | print("number of element : %s " % nitems) | |
|
53 | print("size of each element :\n %s" % rand_len) | |
|
53 | 54 | assert False |
|
54 | 55 | |
|
55 | 56 | def test_columnize_medium(): |
General Comments 0
You need to be logged in to leave comments.
Login now