##// END OF EJS Templates
Fix many py2-style prints in docs and commented code....
Antony Lee -
Show More
@@ -19,7 +19,7 b' example, you could use a startup file like this::'
19
19
20 def calljed(self,filename, linenum):
20 def calljed(self,filename, linenum):
21 "My editor hook calls the jed editor directly."
21 "My editor hook calls the jed editor directly."
22 print "Calling my own editor, jed ..."
22 print("Calling my own editor, jed ...")
23 if os.system('jed +%d %s' % (linenum,filename)) != 0:
23 if os.system('jed +%d %s' % (linenum,filename)) != 0:
24 raise TryNext()
24 raise TryNext()
25
25
@@ -111,7 +111,7 b' class CommandChainDispatcher:'
111 TryNext"""
111 TryNext"""
112 last_exc = TryNext()
112 last_exc = TryNext()
113 for prio,cmd in self.chain:
113 for prio,cmd in self.chain:
114 #print "prio",prio,"cmd",cmd #dbg
114 # print("prio",prio,"cmd",cmd) # dbg
115 try:
115 try:
116 return cmd(*args, **kw)
116 return cmd(*args, **kw)
117 except TryNext as exc:
117 except TryNext as exc:
@@ -320,7 +320,7 b' class InputSplitter(object):'
320 prompt = '>>> ' + indent
320 prompt = '>>> ' + indent
321 line = indent + raw_input(prompt)
321 line = indent + raw_input(prompt)
322 isp.push(line)
322 isp.push(line)
323 print 'Input source was:\n', isp.source_reset(),
323 print('Input source was:\n', isp.source_reset())
324 """
324 """
325 # A cache for storing the current indentation
325 # A cache for storing the current indentation
326 # The first value stores the most recently processed source input
326 # The first value stores the most recently processed source input
@@ -191,7 +191,7 b' which already exists. But you must first start the logging process with'
191 def log_write(self, data, kind='input'):
191 def log_write(self, data, kind='input'):
192 """Write data to the log file, if active"""
192 """Write data to the log file, if active"""
193
193
194 #print 'data: %r' % data # dbg
194 # print('data: %r' % data) # dbg
195 if self.log_active and data:
195 if self.log_active and data:
196 write = self.logfile.write
196 write = self.logfile.write
197 if kind=='input':
197 if kind=='input':
@@ -452,7 +452,7 b' class CodeMagics(Magics):'
452 # Load the parameter given as a variable. If not a string,
452 # Load the parameter given as a variable. If not a string,
453 # process it as an object instead (below)
453 # process it as an object instead (below)
454
454
455 #print '*** args',args,'type',type(args) # dbg
455 # print('*** args',args,'type',type(args)) # dbg
456 data = eval(args, shell.user_ns)
456 data = eval(args, shell.user_ns)
457 if not isinstance(data, str):
457 if not isinstance(data, str):
458 raise DataIsObject
458 raise DataIsObject
@@ -636,8 +636,8 b' class CodeMagics(Magics):'
636
636
637 In [1]: edit
637 In [1]: edit
638 Editing... done. Executing edited code...
638 Editing... done. Executing edited code...
639 Out[1]: 'def foo():\\n print "foo() was defined in an editing
639 Out[1]: 'def foo():\\n print("foo() was defined in an editing
640 session"\\n'
640 session")\\n'
641
641
642 We can then call the function foo()::
642 We can then call the function foo()::
643
643
@@ -661,21 +661,21 b' class CodeMagics(Magics):'
661 In [5]: edit
661 In [5]: edit
662 Editing... done. Executing edited code...
662 Editing... done. Executing edited code...
663 hello
663 hello
664 Out[5]: "print 'hello'\\n"
664 Out[5]: "print('hello')\\n"
665
665
666 Now we call it again with the previous output (stored in _)::
666 Now we call it again with the previous output (stored in _)::
667
667
668 In [6]: edit _
668 In [6]: edit _
669 Editing... done. Executing edited code...
669 Editing... done. Executing edited code...
670 hello world
670 hello world
671 Out[6]: "print 'hello world'\\n"
671 Out[6]: "print('hello world')\\n"
672
672
673 Now we call it with the output #8 (stored in _8, also as Out[8])::
673 Now we call it with the output #8 (stored in _8, also as Out[8])::
674
674
675 In [7]: edit _8
675 In [7]: edit _8
676 Editing... done. Executing edited code...
676 Editing... done. Executing edited code...
677 hello again
677 hello again
678 Out[7]: "print 'hello again'\\n"
678 Out[7]: "print('hello again')\\n"
679
679
680
680
681 Changing the default editor hook:
681 Changing the default editor hook:
@@ -1256,7 +1256,7 b' class ExecutionMagics(Magics):'
1256 Wall time: 1.37
1256 Wall time: 1.37
1257 Out[3]: 499999500000L
1257 Out[3]: 499999500000L
1258
1258
1259 In [4]: %time print 'hello world'
1259 In [4]: %time print('hello world')
1260 hello world
1260 hello world
1261 CPU times: user 0.00 s, sys: 0.00 s, total: 0.00 s
1261 CPU times: user 0.00 s, sys: 0.00 s, total: 0.00 s
1262 Wall time: 0.00
1262 Wall time: 0.00
@@ -1406,9 +1406,9 b' class ExecutionMagics(Magics):'
1406 44: x=1
1406 44: x=1
1407 45: y=3
1407 45: y=3
1408 46: z=x+y
1408 46: z=x+y
1409 47: print x
1409 47: print(x)
1410 48: a=5
1410 48: a=5
1411 49: print 'x',x,'y',y
1411 49: print('x',x,'y',y)
1412
1412
1413 you can create a macro with lines 44 through 47 (included) and line 49
1413 you can create a macro with lines 44 through 47 (included) and line 49
1414 called my_macro with::
1414 called my_macro with::
@@ -1428,7 +1428,7 b' class ExecutionMagics(Magics):'
1428
1428
1429 You can view a macro's contents by explicitly printing it with::
1429 You can view a macro's contents by explicitly printing it with::
1430
1430
1431 print macro_name
1431 print(macro_name)
1432
1432
1433 """
1433 """
1434 opts,args = self.parse_options(parameter_s,'rq',mode='list')
1434 opts,args = self.parse_options(parameter_s,'rq',mode='list')
@@ -1439,7 +1439,7 b' class ExecutionMagics(Magics):'
1439 "%macro insufficient args; usage '%macro name n1-n2 n3-4...")
1439 "%macro insufficient args; usage '%macro name n1-n2 n3-4...")
1440 name, codefrom = args[0], " ".join(args[1:])
1440 name, codefrom = args[0], " ".join(args[1:])
1441
1441
1442 #print 'rng',ranges # dbg
1442 # print('rng',ranges) # dbg
1443 try:
1443 try:
1444 lines = self.shell.find_user_code(codefrom, 'r' in opts)
1444 lines = self.shell.find_user_code(codefrom, 'r' in opts)
1445 except (ValueError, TypeError) as e:
1445 except (ValueError, TypeError) as e:
@@ -128,7 +128,7 b' class HistoryMagics(Magics):'
128
128
129 In [6]: %history -n 4-6
129 In [6]: %history -n 4-6
130 4:a = 12
130 4:a = 12
131 5:print a**2
131 5:print(a**2)
132 6:%history -n 4-6
132 6:%history -n 4-6
133
133
134 """
134 """
@@ -43,7 +43,7 b' class NamespaceMagics(Magics):'
43
43
44 '%pinfo object' is just a synonym for object? or ?object."""
44 '%pinfo object' is just a synonym for object? or ?object."""
45
45
46 #print 'pinfo par: <%s>' % parameter_s # dbg
46 # print('pinfo par: <%s>' % parameter_s) # dbg
47 # detail_level: 0 -> obj? , 1 -> obj??
47 # detail_level: 0 -> obj? , 1 -> obj??
48 detail_level = 0
48 detail_level = 0
49 # We need to detect if we got called as 'pinfo pinfo foo', which can
49 # We need to detect if we got called as 'pinfo pinfo foo', which can
@@ -1196,7 +1196,7 b' class Inspector(Colorable):'
1196
1196
1197 - list_types(False): list all available object types for object matching.
1197 - list_types(False): list all available object types for object matching.
1198 """
1198 """
1199 #print 'ps pattern:<%r>' % pattern # dbg
1199 # print('ps pattern:<%r>' % pattern) # dbg
1200
1200
1201 # defaults
1201 # defaults
1202 type_pattern = 'all'
1202 type_pattern = 'all'
@@ -1225,7 +1225,7 b' class Inspector(Colorable):'
1225 raise ValueError('invalid namespace <%s>. Valid names: %s' %
1225 raise ValueError('invalid namespace <%s>. Valid names: %s' %
1226 (name,ns_table.keys()))
1226 (name,ns_table.keys()))
1227
1227
1228 #print 'type_pattern:',type_pattern # dbg
1228 # print('type_pattern:',type_pattern) # dbg
1229 search_result, namespaces_seen = set(), set()
1229 search_result, namespaces_seen = set(), set()
1230 for ns_name in ns_search:
1230 for ns_name in ns_search:
1231 ns = ns_table[ns_name]
1231 ns = ns_table[ns_name]
@@ -122,8 +122,8 b' def _detect_screen_size(screen_lines_def):'
122 termios.tcsetattr(sys.stdout,termios.TCSANOW,term_flags)
122 termios.tcsetattr(sys.stdout,termios.TCSANOW,term_flags)
123 # Now we have what we needed: the screen size in rows/columns
123 # Now we have what we needed: the screen size in rows/columns
124 return screen_lines_real
124 return screen_lines_real
125 #print '***Screen size:',screen_lines_real,'lines x',\
125 # print('***Screen size:',screen_lines_real,'lines x',
126 #screen_cols,'columns.' # dbg
126 # screen_cols,'columns.') # dbg
127
127
128 def pager_page(strng, start=0, screen_lines=0, pager_cmd=None):
128 def pager_page(strng, start=0, screen_lines=0, pager_cmd=None):
129 """Display a string, piping through a pager after a certain length.
129 """Display a string, piping through a pager after a certain length.
@@ -179,9 +179,9 b' def pager_page(strng, start=0, screen_lines=0, pager_cmd=None):'
179 print(str_toprint)
179 print(str_toprint)
180 return
180 return
181
181
182 #print 'numlines',numlines,'screenlines',screen_lines # dbg
182 # print('numlines',numlines,'screenlines',screen_lines) # dbg
183 if numlines <= screen_lines :
183 if numlines <= screen_lines :
184 #print '*** normal print' # dbg
184 # print('*** normal print') # dbg
185 print(str_toprint)
185 print(str_toprint)
186 else:
186 else:
187 # Try to open pager and default to internal one if that fails.
187 # Try to open pager and default to internal one if that fails.
@@ -240,7 +240,7 b' class PrefilterManager(Configurable):'
240
240
241 This implements the checker/handler part of the prefilter pipe.
241 This implements the checker/handler part of the prefilter pipe.
242 """
242 """
243 # print "prefilter_line_info: ", line_info
243 # print("prefilter_line_info: ", line_info)
244 handler = self.find_handler(line_info)
244 handler = self.find_handler(line_info)
245 return handler.handle(line_info)
245 return handler.handle(line_info)
246
246
@@ -267,7 +267,7 b' class PrefilterManager(Configurable):'
267 transformers and then the checkers/handlers.
267 transformers and then the checkers/handlers.
268 """
268 """
269
269
270 # print "prefilter_line: ", line, continue_prompt
270 # print("prefilter_line: ", line, continue_prompt)
271 # All handlers *must* return a value, even if it's blank ('').
271 # All handlers *must* return a value, even if it's blank ('').
272
272
273 # save the line away in case we crash, so the post-mortem handler can
273 # save the line away in case we crash, so the post-mortem handler can
@@ -300,7 +300,7 b' class PrefilterManager(Configurable):'
300 return normal_handler.handle(line_info)
300 return normal_handler.handle(line_info)
301
301
302 prefiltered = self.prefilter_line_info(line_info)
302 prefiltered = self.prefilter_line_info(line_info)
303 # print "prefiltered line: %r" % prefiltered
303 # print("prefiltered line: %r" % prefiltered)
304 return prefiltered
304 return prefiltered
305
305
306 def prefilter_lines(self, lines, continue_prompt=False):
306 def prefilter_lines(self, lines, continue_prompt=False):
@@ -544,7 +544,7 b' class PrefilterHandler(Configurable):'
544 )
544 )
545
545
546 def handle(self, line_info):
546 def handle(self, line_info):
547 # print "normal: ", line_info
547 # print("normal: ", line_info)
548 """Handle normal input lines. Use as a template for handlers."""
548 """Handle normal input lines. Use as a template for handlers."""
549
549
550 # With autoindent on, we need some way to exit the input loop, and I
550 # With autoindent on, we need some way to exit the input loop, and I
@@ -224,7 +224,7 b' def mpl_runner(safe_execfile):'
224 import matplotlib
224 import matplotlib
225 import matplotlib.pyplot as plt
225 import matplotlib.pyplot as plt
226
226
227 #print '*** Matplotlib runner ***' # dbg
227 # print('*** Matplotlib runner ***') # dbg
228 # turn off rendering until end of script
228 # turn off rendering until end of script
229 with matplotlib.rc_context({"interactive": False}):
229 with matplotlib.rc_context({"interactive": False}):
230 safe_execfile(fname, *where, **kw)
230 safe_execfile(fname, *where, **kw)
@@ -63,19 +63,19 b' def split_user_input(line, pattern=None):'
63 pattern = line_split
63 pattern = line_split
64 match = pattern.match(line)
64 match = pattern.match(line)
65 if not match:
65 if not match:
66 # print "match failed for line '%s'" % line
66 # print("match failed for line '%s'" % line)
67 try:
67 try:
68 ifun, the_rest = line.split(None,1)
68 ifun, the_rest = line.split(None,1)
69 except ValueError:
69 except ValueError:
70 # print "split failed for line '%s'" % line
70 # print("split failed for line '%s'" % line)
71 ifun, the_rest = line, u''
71 ifun, the_rest = line, u''
72 pre = re.match(r'^(\s*)(.*)',line).groups()[0]
72 pre = re.match(r'^(\s*)(.*)',line).groups()[0]
73 esc = ""
73 esc = ""
74 else:
74 else:
75 pre, esc, ifun, the_rest = match.groups()
75 pre, esc, ifun, the_rest = match.groups()
76
76
77 #print 'line:<%s>' % line # dbg
77 # print('line:<%s>' % line) # dbg
78 #print 'pre <%s> ifun <%s> rest <%s>' % (pre,ifun.strip(),the_rest) # dbg
78 # print('pre <%s> ifun <%s> rest <%s>' % (pre,ifun.strip(),the_rest)) # dbg
79 return pre, esc or '', ifun.strip(), the_rest.lstrip()
79 return pre, esc or '', ifun.strip(), the_rest.lstrip()
80
80
81
81
@@ -26,7 +26,7 b' else:'
26 if name.startswith('C'):
26 if name.startswith('C'):
27 c = C(name)
27 c = C(name)
28
28
29 #print >> sys.stderr, "ARGV:", sys.argv # dbg
29 # print(>> sys.stderr, "ARGV:", sys.argv) # dbg
30
30
31 # This next print statement is NOT debugging, we're making the check on a
31 # This next print statement is NOT debugging, we're making the check on a
32 # completely separate process so we verify by capturing stdout:
32 # completely separate process so we verify by capturing stdout:
@@ -43,7 +43,7 b' def mini_interactive_loop(input_func):'
43 # Here we just return input so we can use it in a test suite, but a real
43 # Here we just return input so we can use it in a test suite, but a real
44 # interpreter would instead send it for execution somewhere.
44 # interpreter would instead send it for execution somewhere.
45 src = isp.source_reset()
45 src = isp.source_reset()
46 #print 'Input source was:\n', src # dbg
46 # print('Input source was:\n', src) # dbg
47 return src
47 return src
48
48
49 #-----------------------------------------------------------------------------
49 #-----------------------------------------------------------------------------
@@ -25,7 +25,7 b' def restore_aliases(ip, alias=None):'
25 staliases = ip.db.get('stored_aliases', {})
25 staliases = ip.db.get('stored_aliases', {})
26 if alias is None:
26 if alias is None:
27 for k,v in staliases.items():
27 for k,v in staliases.items():
28 #print "restore alias",k,v # dbg
28 # print("restore alias",k,v) # dbg
29 #self.alias_table[k] = v
29 #self.alias_table[k] = v
30 ip.alias_manager.define_alias(k,v)
30 ip.alias_manager.define_alias(k,v)
31 else:
31 else:
@@ -43,7 +43,7 b' def refresh_variables(ip):'
43 print("Unable to restore variable '%s', ignoring (use %%store -d to forget!)" % justkey)
43 print("Unable to restore variable '%s', ignoring (use %%store -d to forget!)" % justkey)
44 print("The error was:", sys.exc_info()[0])
44 print("The error was:", sys.exc_info()[0])
45 else:
45 else:
46 #print "restored",justkey,"=",obj #dbg
46 # print("restored",justkey,"=",obj) # dbg
47 ip.user_ns[justkey] = obj
47 ip.user_ns[justkey] = obj
48
48
49
49
@@ -456,13 +456,13 b' class IPythonConsoleLexer(Lexer):'
456 # does not use the continuation marker cannot be detected.
456 # does not use the continuation marker cannot be detected.
457 # For example, the 3 in the following is clearly output:
457 # For example, the 3 in the following is clearly output:
458 #
458 #
459 # In [1]: print 3
459 # In [1]: print(3)
460 # 3
460 # 3
461 #
461 #
462 # But the following second line is part of the input:
462 # But the following second line is part of the input:
463 #
463 #
464 # In [2]: while True:
464 # In [2]: while True:
465 # print True
465 # print(True)
466 #
466 #
467 # In both cases, the 2nd line will be 'output'.
467 # In both cases, the 2nd line will be 'output'.
468 #
468 #
@@ -300,7 +300,7 b' def block_parser(part, rgxin, rgxout, fmtin, fmtout):'
300
300
301 nextline = lines[i]
301 nextline = lines[i]
302 matchout = rgxout.match(nextline)
302 matchout = rgxout.match(nextline)
303 #print "nextline=%s, continuation=%s, starts=%s"%(nextline, continuation, nextline.startswith(continuation))
303 # print("nextline=%s, continuation=%s, starts=%s"%(nextline, continuation, nextline.startswith(continuation)))
304 if matchout or nextline.startswith('#'):
304 if matchout or nextline.startswith('#'):
305 break
305 break
306 elif nextline.startswith(continuation):
306 elif nextline.startswith(continuation):
@@ -538,7 +538,7 b' class EmbeddedSphinxShell(object):'
538 # When there is stdout from the input, it also has a '\n' at the
538 # When there is stdout from the input, it also has a '\n' at the
539 # tail end, and so this ensures proper spacing as well. E.g.:
539 # tail end, and so this ensures proper spacing as well. E.g.:
540 #
540 #
541 # In [1]: print x
541 # In [1]: print(x)
542 # 5
542 # 5
543 #
543 #
544 # In [2]: x = 5
544 # In [2]: x = 5
@@ -699,7 +699,7 b' class EmbeddedSphinxShell(object):'
699 """
699 """
700 self.ensure_pyplot()
700 self.ensure_pyplot()
701 command = 'plt.gcf().savefig("%s")'%image_file
701 command = 'plt.gcf().savefig("%s")'%image_file
702 #print 'SAVEFIG', command # dbg
702 # print('SAVEFIG', command) # dbg
703 self.process_input_line('bookmark ipy_thisdir', store_history=False)
703 self.process_input_line('bookmark ipy_thisdir', store_history=False)
704 self.process_input_line('cd -b ipy_savedir', store_history=False)
704 self.process_input_line('cd -b ipy_savedir', store_history=False)
705 self.process_input_line(command, store_history=False)
705 self.process_input_line(command, store_history=False)
@@ -270,7 +270,7 b' class TerminalIPythonApp(BaseIPythonApplication, InteractiveShellApp):'
270 if self.subapp is not None:
270 if self.subapp is not None:
271 # don't bother initializing further, starting subapp
271 # don't bother initializing further, starting subapp
272 return
272 return
273 # print self.extra_args
273 # print(self.extra_args)
274 if self.extra_args and not self.something_to_run:
274 if self.extra_args and not self.something_to_run:
275 self.file_to_run = self.extra_args[0]
275 self.file_to_run = self.extra_args[0]
276 self.init_path()
276 self.init_path()
@@ -127,11 +127,11 b' def inputhook(context):'
127 # 0.05 0.5%
127 # 0.05 0.5%
128 used_time = clock() - t
128 used_time = clock() - t
129 if used_time > 10.0:
129 if used_time > 10.0:
130 # print 'Sleep for 1 s' # dbg
130 # print('Sleep for 1 s') # dbg
131 time.sleep(1.0)
131 time.sleep(1.0)
132 elif used_time > 0.1:
132 elif used_time > 0.1:
133 # Few GUI events coming in, so we can sleep longer
133 # Few GUI events coming in, so we can sleep longer
134 # print 'Sleep for 0.05 s' # dbg
134 # print('Sleep for 0.05 s') # dbg
135 time.sleep(0.05)
135 time.sleep(0.05)
136 else:
136 else:
137 # Many GUI events coming in, so sleep only very little
137 # Many GUI events coming in, so sleep only very little
@@ -53,11 +53,11 b' def inputhook(context):'
53 # 0.05 0.5%
53 # 0.05 0.5%
54 used_time = clock() - t
54 used_time = clock() - t
55 if used_time > 10.0:
55 if used_time > 10.0:
56 # print 'Sleep for 1 s' # dbg
56 # print('Sleep for 1 s') # dbg
57 time.sleep(1.0)
57 time.sleep(1.0)
58 elif used_time > 0.1:
58 elif used_time > 0.1:
59 # Few GUI events coming in, so we can sleep longer
59 # Few GUI events coming in, so we can sleep longer
60 # print 'Sleep for 0.05 s' # dbg
60 # print('Sleep for 0.05 s') # dbg
61 time.sleep(0.05)
61 time.sleep(0.05)
62 else:
62 else:
63 # Many GUI events coming in, so sleep only very little
63 # Many GUI events coming in, so sleep only very little
@@ -137,11 +137,11 b' def inputhook_wx3(context):'
137 # 0.05 0.5%
137 # 0.05 0.5%
138 used_time = clock() - t
138 used_time = clock() - t
139 if used_time > 10.0:
139 if used_time > 10.0:
140 # print 'Sleep for 1 s' # dbg
140 # print('Sleep for 1 s') # dbg
141 time.sleep(1.0)
141 time.sleep(1.0)
142 elif used_time > 0.1:
142 elif used_time > 0.1:
143 # Few GUI events coming in, so we can sleep longer
143 # Few GUI events coming in, so we can sleep longer
144 # print 'Sleep for 0.05 s' # dbg
144 # print('Sleep for 0.05 s') # dbg
145 time.sleep(0.05)
145 time.sleep(0.05)
146 else:
146 else:
147 # Many GUI events coming in, so sleep only very little
147 # Many GUI events coming in, so sleep only very little
@@ -108,7 +108,7 b' class IPython2PythonConverter(object):'
108
108
109 newline(line)
109 newline(line)
110 newline('') # ensure a closing newline, needed by doctest
110 newline('') # ensure a closing newline, needed by doctest
111 #print "PYSRC:", '\n'.join(out) # dbg
111 # print("PYSRC:", '\n'.join(out)) # dbg
112 return '\n'.join(out)
112 return '\n'.join(out)
113
113
114 #return dnew
114 #return dnew
@@ -68,7 +68,7 b' class IPDoctestOutputChecker(doctest.OutputChecker):'
68 ret = doctest.OutputChecker.check_output(self, want, got,
68 ret = doctest.OutputChecker.check_output(self, want, got,
69 optionflags)
69 optionflags)
70 if not ret and self.random_re.search(want):
70 if not ret and self.random_re.search(want):
71 #print >> sys.stderr, 'RANDOM OK:',want # dbg
71 # print(>> sys.stderr, 'RANDOM OK:',want) # dbg
72 return True
72 return True
73
73
74 return ret
74 return ret
@@ -141,7 +141,7 b' class IPDocTestParser(doctest.DocTestParser):'
141 used for error messages.
141 used for error messages.
142 """
142 """
143
143
144 #print 'Parse string:\n',string # dbg
144 # print('Parse string:\n',string) # dbg
145
145
146 string = string.expandtabs()
146 string = string.expandtabs()
147 # If all lines begin with the same indentation, then strip it.
147 # If all lines begin with the same indentation, then strip it.
@@ -245,8 +245,8 b" def ipexec_validate(fname, expected_out, expected_err='',"
245 __tracebackhide__ = True
245 __tracebackhide__ = True
246
246
247 out, err = ipexec(fname, options, commands)
247 out, err = ipexec(fname, options, commands)
248 #print 'OUT', out # dbg
248 # print('OUT', out) # dbg
249 #print 'ERR', err # dbg
249 # print('ERR', err) # dbg
250 # If there are any errors, we must check those before stdout, as they may be
250 # If there are any errors, we must check those before stdout, as they may be
251 # more informative than simply having an empty stdout.
251 # more informative than simply having an empty stdout.
252 if err:
252 if err:
@@ -308,8 +308,8 b' def target_outdated(target,deps):'
308 for dep in deps:
308 for dep in deps:
309 dep_time = os.path.getmtime(dep)
309 dep_time = os.path.getmtime(dep)
310 if dep_time > target_time:
310 if dep_time > target_time:
311 #print "For target",target,"Dep failed:",dep # dbg
311 # print("For target",target,"Dep failed:",dep) # dbg
312 #print "times (dep,tar):",dep_time,target_time # dbg
312 # print("times (dep,tar):",dep_time,target_time) # dbg
313 return 1
313 return 1
314 return 0
314 return 0
315
315
@@ -48,7 +48,7 b' class StrDispatch(object):'
48 if re.match(r, key):
48 if re.match(r, key):
49 yield obj
49 yield obj
50 else:
50 else:
51 #print "nomatch",key # dbg
51 # print("nomatch",key) # dbg
52 pass
52 pass
53
53
54 def __repr__(self):
54 def __repr__(self):
@@ -254,10 +254,10 b' def test_get_xdg_dir_3():'
254 def test_filefind():
254 def test_filefind():
255 """Various tests for filefind"""
255 """Various tests for filefind"""
256 f = tempfile.NamedTemporaryFile()
256 f = tempfile.NamedTemporaryFile()
257 # print 'fname:',f.name
257 # print('fname:',f.name)
258 alt_dirs = paths.get_ipython_dir()
258 alt_dirs = paths.get_ipython_dir()
259 t = path.filefind(f.name, alt_dirs)
259 t = path.filefind(f.name, alt_dirs)
260 # print 'found:',t
260 # print('found:',t)
261
261
262
262
263 @dec.skip_if_not_win32
263 @dec.skip_if_not_win32
@@ -72,8 +72,8 b' class LSString(str):'
72
72
73 # def print_lsstring(arg):
73 # def print_lsstring(arg):
74 # """ Prettier (non-repr-like) and more informative printer for LSString """
74 # """ Prettier (non-repr-like) and more informative printer for LSString """
75 # print "LSString (.p, .n, .l, .s available). Value:"
75 # print("LSString (.p, .n, .l, .s available). Value:")
76 # print arg
76 # print(arg)
77 #
77 #
78 #
78 #
79 # print_lsstring = result_display.register(LSString)(print_lsstring)
79 # print_lsstring = result_display.register(LSString)(print_lsstring)
@@ -231,7 +231,7 b' class SList(list):'
231
231
232 # def print_slist(arg):
232 # def print_slist(arg):
233 # """ Prettier (non-repr-like) and more informative printer for SList """
233 # """ Prettier (non-repr-like) and more informative printer for SList """
234 # print "SList (.p, .n, .l, .s, .grep(), .fields(), sort() available):"
234 # print("SList (.p, .n, .l, .s, .grep(), .fields(), sort() available):")
235 # if hasattr(arg, 'hideonce') and arg.hideonce:
235 # if hasattr(arg, 'hideonce') and arg.hideonce:
236 # arg.hideonce = False
236 # arg.hideonce = False
237 # return
237 # return
@@ -144,8 +144,8 b' def target_outdated(target,deps):'
144 for dep in deps:
144 for dep in deps:
145 dep_time = os.path.getmtime(dep)
145 dep_time = os.path.getmtime(dep)
146 if dep_time > target_time:
146 if dep_time > target_time:
147 #print "For target",target,"Dep failed:",dep # dbg
147 # print("For target",target,"Dep failed:",dep) # dbg
148 #print "times (dep,tar):",dep_time,target_time # dbg
148 # print("times (dep,tar):",dep_time,target_time) # dbg
149 return 1
149 return 1
150 return 0
150 return 0
151
151
@@ -32,7 +32,7 b''
32 " ])\n",
32 " ])\n",
33 " while True:\n",
33 " while True:\n",
34 " inline(code, quiet=True, t=t)\n",
34 " inline(code, quiet=True, t=t)\n",
35 " print time.time()\n",
35 " print(time.time())\n",
36 " sys.stdout.flush() # this is important\n",
36 " sys.stdout.flush() # this is important\n",
37 "\n",
37 "\n",
38 "gilsleep(5)"
38 "gilsleep(5)"
General Comments 0
You need to be logged in to leave comments. Login now