Permalink
Browse files

py3k print: WIP... overzealous fixing, breaks py2k

  • Loading branch information...
1 parent 1981689 commit 59e98c264e7848b8e2f83b3c507f87e4ffb2d578 @bfroehle committed Sep 27, 2012
Showing with 446 additions and 446 deletions.
  1. +21 −21 IPython/config/application.py
  2. +1 −1 IPython/config/configurable.py
  3. +12 −12 IPython/core/logger.py
  4. +2 −2 IPython/core/magic.py
  5. +2 −2 IPython/core/magics/auto.py
  6. +11 −11 IPython/core/magics/code.py
  7. +3 −3 IPython/core/magics/config.py
  8. +4 −4 IPython/core/magics/deprecated.py
  9. +29 −29 IPython/core/magics/execution.py
  10. +3 −3 IPython/core/magics/extension.py
  11. +29 −29 IPython/core/magics/namespace.py
  12. +16 −16 IPython/core/magics/osm.py
  13. +6 −6 IPython/core/magics/script.py
  14. +18 −18 IPython/core/profileapp.py
  15. +5 −5 IPython/core/pylabtools.py
  16. +1 −1 IPython/core/tests/refbug.py
  17. +1 −1 IPython/core/tests/test_debugger.py
  18. +3 −3 IPython/core/tests/test_inputsplitter.py
  19. +12 −12 IPython/core/ultratb.py
  20. +5 −5 IPython/deathrow/Gnuplot2.py
  21. +1 −1 IPython/deathrow/GnuplotInteractive.py
  22. +1 −1 IPython/deathrow/GnuplotRuntime.py
  23. +1 −1 IPython/deathrow/PhysicalQInput.py
  24. +1 −1 IPython/deathrow/dtutils.py
  25. +2 −2 IPython/deathrow/gui/wx/ipshell_nonblocking.py
  26. +2 −2 IPython/deathrow/gui/wx/wxIPython.py
  27. +1 −1 IPython/deathrow/ipipe.py
  28. +4 −4 IPython/deathrow/ipy_kitcfg.py
  29. +1 −1 IPython/deathrow/ipy_profile_numpy.py
  30. +1 −1 IPython/deathrow/ipy_profile_scipy.py
  31. +2 −2 IPython/deathrow/ipy_profile_sh.py
  32. +12 −12 IPython/deathrow/ipy_profile_zope.py
  33. +1 −1 IPython/deathrow/ipy_traits_completer.py
  34. +5 −5 IPython/deathrow/numeric_formats.py
  35. +2 −2 IPython/deathrow/oldfrontend/cocoa/cocoa_frontend.py
  36. +5 −5 IPython/deathrow/oldfrontend/linefrontendbase.py
  37. +1 −1 IPython/deathrow/oldfrontend/prefilterfrontend.py
  38. +6 −6 IPython/deathrow/oldfrontend/wx/wx_frontend.py
  39. +20 −20 IPython/deathrow/outputtrap.py
  40. +4 −4 IPython/deathrow/tests/test_prefilter.py
  41. +8 −8 IPython/deathrow/twshell.py
  42. +10 −10 IPython/extensions/storemagic.py
  43. +2 −2 IPython/external/decorator/_decorator.py
  44. +5 −5 IPython/external/mathjax.py
  45. +1 −1 IPython/frontend/html/notebook/handlers.py
  46. +2 −2 IPython/frontend/html/notebook/notebookapp.py
  47. +1 −1 IPython/frontend/terminal/embed.py
  48. +2 −2 IPython/frontend/terminal/ipapp.py
  49. +9 −9 IPython/lib/backgroundjobs.py
  50. +1 −1 IPython/lib/deepreload.py
  51. +1 −1 IPython/lib/inputhookglut.py
  52. +1 −1 IPython/lib/pretty.py
  53. +2 −2 IPython/parallel/apps/ipclusterapp.py
  54. +6 −6 IPython/parallel/client/client.py
  55. +3 −3 IPython/parallel/client/magics.py
  56. +1 −1 IPython/parallel/client/map.py
  57. +3 −3 IPython/parallel/client/view.py
  58. +4 −4 IPython/parallel/tests/__init__.py
  59. +4 −4 IPython/quarantine/envpersist.py
  60. +1 −1 IPython/quarantine/ipy_editors.py
  61. +1 −1 IPython/quarantine/ipy_exportdb.py
  62. +3 −3 IPython/quarantine/ipy_extutil.py
  63. +6 −6 IPython/quarantine/ipy_fsops.py
  64. +1 −1 IPython/quarantine/ipy_gnuglobal.py
  65. +35 −35 IPython/quarantine/ipy_jot.py
  66. +2 −2 IPython/quarantine/ipy_lookfor.py
  67. +2 −2 IPython/quarantine/ipy_rehashdir.py
  68. +1 −1 IPython/quarantine/ipy_server.py
  69. +2 −2 IPython/quarantine/ipy_signals.py
  70. +1 −1 IPython/quarantine/ipy_synchronize_with.py
  71. +5 −5 IPython/quarantine/ipy_which.py
  72. +7 −7 IPython/quarantine/ipy_winpdb.py
  73. +3 −3 IPython/quarantine/ipy_workdir.py
  74. +7 −7 IPython/quarantine/jobctrl.py
  75. +7 −7 IPython/quarantine/ledit.py
  76. +2 −2 IPython/quarantine/win32clip.py
  77. +2 −2 IPython/testing/plugin/iptest.py
  78. +1 −1 IPython/testing/plugin/show_refs.py
  79. +1 −1 IPython/testing/plugin/simplevars.py
  80. +4 −4 IPython/testing/tests/test_decorators.py
  81. +6 −6 IPython/testing/tests/test_tools.py
  82. +2 −2 IPython/utils/frame.py
  83. +12 −12 IPython/utils/pickleshare.py
  84. +5 −5 IPython/utils/tests/test_text.py
  85. +4 −4 IPython/utils/upgradedir.py
@@ -239,7 +239,7 @@ def print_alias_help(self):
help[0] = help[0].replace('--%s='%alias, '-%s '%alias)
lines.extend(help)
# lines.append('')
- print os.linesep.join(lines)
+ print(os.linesep.join(lines))
def print_flag_help(self):
"""Print the flag part of the help."""
@@ -252,7 +252,7 @@ def print_flag_help(self):
lines.append(prefix+m)
lines.append(indent(dedent(help.strip())))
# lines.append('')
- print os.linesep.join(lines)
+ print(os.linesep.join(lines))
def print_options(self):
if not self.flags and not self.aliases:
@@ -263,10 +263,10 @@ def print_options(self):
for p in wrap_paragraphs(self.option_description):
lines.append(p)
lines.append('')
- print os.linesep.join(lines)
+ print(os.linesep.join(lines))
self.print_flag_help()
self.print_alias_help()
- print
+ print()
def print_subcommands(self):
"""Print the subcommand part of the help."""
@@ -284,7 +284,7 @@ def print_subcommands(self):
if help:
lines.append(indent(dedent(help.strip())))
lines.append('')
- print os.linesep.join(lines)
+ print(os.linesep.join(lines))
def print_help(self, classes=False):
"""Print the help for each Configurable class in self.classes.
@@ -296,25 +296,25 @@ def print_help(self, classes=False):
if classes:
if self.classes:
- print "Class parameters"
- print "----------------"
- print
+ print("Class parameters")
+ print("----------------")
+ print()
for p in wrap_paragraphs(self.keyvalue_description):
- print p
- print
+ print(p)
+ print()
for cls in self.classes:
cls.class_print_help()
- print
+ print()
else:
- print "To see all available configurables, use `--help-all`"
- print
+ print("To see all available configurables, use `--help-all`")
+ print()
def print_description(self):
"""Print the application description."""
for p in wrap_paragraphs(self.description):
- print p
- print
+ print(p)
+ print()
def print_examples(self):
"""Print usage and examples.
@@ -323,15 +323,15 @@ def print_examples(self):
and should contain examples of the application's usage.
"""
if self.examples:
- print "Examples"
- print "--------"
- print
- print indent(dedent(self.examples.strip()))
- print
+ print("Examples")
+ print("--------")
+ print()
+ print(indent(dedent(self.examples.strip())))
+ print()
def print_version(self):
"""Print the version string."""
- print self.version
+ print(self.version)
def update_config(self, config):
"""Fire the traits events when the config is updated."""
@@ -200,7 +200,7 @@ def class_get_trait_help(cls, trait, inst=None):
@classmethod
def class_print_help(cls, inst=None):
"""Get the help string for a single trait and print it."""
- print cls.class_get_help(inst)
+ print(cls.class_get_help(inst))
@classmethod
def class_config_section(cls):
View
@@ -137,33 +137,33 @@ def switch_log(self,val):
label = {0:'OFF',1:'ON',False:'OFF',True:'ON'}
if self.logfile is None:
- print """
+ print("""
Logging hasn't been started yet (use logstart for that).
%logon/%logoff are for temporarily starting and stopping logging for a logfile
which already exists. But you must first start the logging process with
-%logstart (optionally giving a logfile name)."""
+%logstart (optionally giving a logfile name).""")
else:
if self.log_active == val:
- print 'Logging is already',label[val]
+ print('Logging is already',label[val])
else:
- print 'Switching logging',label[val]
+ print('Switching logging',label[val])
self.log_active = not self.log_active
self.log_active_out = self.log_active
def logstate(self):
"""Print a status message about the logger."""
if self.logfile is None:
- print 'Logging has not been activated.'
+ print('Logging has not been activated.')
else:
state = self.log_active and 'active' or 'temporarily suspended'
- print 'Filename :',self.logfname
- print 'Mode :',self.logmode
- print 'Output logging :',self.log_output
- print 'Raw input log :',self.log_raw_input
- print 'Timestamping :',self.timestamp
- print 'State :',state
+ print('Filename :',self.logfname)
+ print('Mode :',self.logmode)
+ print('Output logging :',self.log_output)
+ print('Raw input log :',self.log_raw_input)
+ print('Timestamping :',self.timestamp)
+ print('State :',state)
def log(self, line_mod, line_ori):
"""Write the sources to a log.
@@ -213,7 +213,7 @@ def logstop(self):
self.logfile.close()
self.logfile = None
else:
- print "Logging hadn't been started."
+ print("Logging hadn't been started.")
self.log_active = False
# For backwards compatibility, in case anyone was using this.
View
@@ -540,8 +540,8 @@ def __init__(self, shell):
def arg_err(self,func):
"""Print docstring if incorrect arguments were passed"""
- print 'Error in arguments:'
- print oinspect.getdoc(func)
+ print('Error in arguments:')
+ print(oinspect.getdoc(func))
def format_latex(self, strng):
"""Format a string for latex inclusion."""
@@ -57,7 +57,7 @@ def automagic(self, parameter_s=''):
else:
val = not mman.auto_magic
mman.auto_magic = val
- print '\n' + self.shell.magics_manager.auto_status()
+ print('\n' + self.shell.magics_manager.auto_status())
@skip_doctest
@line_magic
@@ -125,4 +125,4 @@ def autocall(self, parameter_s=''):
except AttributeError:
self.shell.autocall = self._magic_state.autocall_save = 1
- print "Automatic calling is:",['OFF','Smart','Full'][self.shell.autocall]
+ print("Automatic calling is:",['OFF','Smart','Full'][self.shell.autocall])
@@ -88,15 +88,15 @@ def save(self, parameter_s=''):
try:
overwrite = self.shell.ask_yes_no('File `%s` exists. Overwrite (y/[N])? ' % fname, default='n')
except StdinNotImplementedError:
- print "File `%s` exists. Use `%%save -f %s` to force overwrite" % (fname, parameter_s)
+ print("File `%s` exists. Use `%%save -f %s` to force overwrite" % (fname, parameter_s))
return
if not overwrite :
- print 'Operation cancelled.'
+ print('Operation cancelled.')
return
try:
cmds = self.shell.find_user_code(codefrom,raw)
except (TypeError, ValueError) as e:
- print e.args[0]
+ print(e.args[0])
return
out = py3compat.cast_unicode(cmds)
with io.open(fname, mode, encoding="utf-8") as f:
@@ -106,8 +106,8 @@ def save(self, parameter_s=''):
# make sure we end on a newline
if not out.endswith(u'\n'):
f.write(u'\n')
- print 'The following commands were written to file `%s`:' % fname
- print cmds
+ print('The following commands were written to file `%s`:' % fname)
+ print(cmds)
@line_magic
def pastebin(self, parameter_s=''):
@@ -129,7 +129,7 @@ def pastebin(self, parameter_s=''):
try:
code = self.shell.find_user_code(args)
except (ValueError, TypeError) as e:
- print e.args[0]
+ print(e.args[0])
return
post_data = json.dumps({
@@ -198,7 +198,7 @@ def load(self, arg_s):
ans = True
if ans is False :
- print 'Operation cancelled.'
+ print('Operation cancelled.')
return
self.shell.set_next_input(contents)
@@ -323,7 +323,7 @@ class DataIsObject(Exception): pass
if use_temp:
filename = shell.mktempfile(data)
- print 'IPython will make a temporary file named:',filename
+ print('IPython will make a temporary file named:',filename)
return filename, lineno, use_temp
@@ -493,7 +493,7 @@ def edit(self, parameter_s='',last_call=['','']):
return
# do actual editing here
- print 'Editing...',
+ print('Editing...', end=' ')
sys.stdout.flush()
try:
# Quote filenames that may have spaces in them
@@ -510,9 +510,9 @@ def edit(self, parameter_s='',last_call=['','']):
self.shell.user_ns['pasted_block'] = file_read(filename)
if 'x' in opts: # -x prevents actual execution
- print
+ print()
else:
- print 'done. Executing edited code...'
+ print('done. Executing edited code...')
if 'r' in opts: # Untranslated IPython code
self.shell.run_cell(file_read(filename),
store_history=False)
@@ -115,9 +115,9 @@ def config(self, s):
line = s.strip()
if not line:
# print available configurable names
- print "Available objects for config:"
+ print("Available objects for config:")
for name in classnames:
- print " ", name
+ print(" ", name)
return
elif line in classnames:
# `%config TerminalInteractiveShell` will print trait info for
@@ -127,7 +127,7 @@ def config(self, s):
help = cls.class_get_help(c)
# strip leading '--' from cl-args:
help = re.sub(re.compile(r'^--', re.MULTILINE), '', help)
- print help
+ print(help)
return
elif '=' not in line:
raise UsageError("Invalid config statement: %r, "
@@ -26,20 +26,20 @@ class DeprecatedMagics(Magics):
@line_magic
def install_profiles(self, parameter_s=''):
"""%install_profiles has been deprecated."""
- print '\n'.join([
+ print('\n'.join([
"%install_profiles has been deprecated.",
"Use `ipython profile list` to view available profiles.",
"Requesting a profile with `ipython profile create <name>`",
"or `ipython --profile=<name>` will start with the bundled",
"profile of that name if it exists."
- ])
+ ]))
@line_magic
def install_default_config(self, parameter_s=''):
"""%install_default_config has been deprecated."""
- print '\n'.join([
+ print('\n'.join([
"%install_default_config has been deprecated.",
"Use `ipython profile create <name>` to initialize a profile",
"with the default config files.",
"Add `--reset` to overwrite already existing config files with defaults."
- ])
+ ]))
Oops, something went wrong.

0 comments on commit 59e98c2

Please sign in to comment.