From 91babb98afedd191b3f5675dffd78ce496a87789 2013-10-29 16:15:56 From: Thomas Kluyver Date: 2013-10-29 16:15:56 Subject: [PATCH] Clean up converted code. Mistakes spotted by @Carreau --- diff --git a/IPython/core/logger.py b/IPython/core/logger.py index 0b51285..0e41db5 100644 --- a/IPython/core/logger.py +++ b/IPython/core/logger.py @@ -159,12 +159,12 @@ which already exists. But you must first start the logging process with 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. diff --git a/IPython/core/magics/osm.py b/IPython/core/magics/osm.py index e6cad68..e4bb9ff 100644 --- a/IPython/core/magics/osm.py +++ b/IPython/core/magics/osm.py @@ -117,7 +117,7 @@ class OSMagics(Magics): try: alias,cmd = par.split(None, 1) except TypeError: - print((oinspect.getdoc(self.alias))) + print(oinspect.getdoc(self.alias)) return try: diff --git a/IPython/core/magics/pylab.py b/IPython/core/magics/pylab.py index 5c5887e..bf616b0 100644 --- a/IPython/core/magics/pylab.py +++ b/IPython/core/magics/pylab.py @@ -140,5 +140,4 @@ class PylabMagics(Magics): def _show_matplotlib_backend(self, gui, backend): """show matplotlib message backend message""" if not gui or gui == 'auto': - print(("Using matplotlib backend: %s" % backend)) - + print("Using matplotlib backend: %s" % backend) diff --git a/IPython/core/pylabtools.py b/IPython/core/pylabtools.py index c500106..6755fb8 100644 --- a/IPython/core/pylabtools.py +++ b/IPython/core/pylabtools.py @@ -75,7 +75,7 @@ def getfigs(*fig_nums): for num in fig_nums: f = Gcf.figs.get(num) if f is None: - print(('Warning: figure %s not available.' % num)) + print('Warning: figure %s not available.' % num) else: figs.append(f.canvas.figure) return figs diff --git a/IPython/core/shellapp.py b/IPython/core/shellapp.py index b7b515d..5b0cecf 100644 --- a/IPython/core/shellapp.py +++ b/IPython/core/shellapp.py @@ -249,7 +249,7 @@ class InteractiveShellApp(Configurable): self.log.info("Enabling GUI event loop integration, " "eventloop=%s, matplotlib=%s", gui, backend) if key == "auto": - print(("Using matplotlib backend: %s" % backend)) + print("Using matplotlib backend: %s" % backend) else: gui = r self.log.info("Enabling GUI event loop integration, " diff --git a/IPython/extensions/autoreload.py b/IPython/extensions/autoreload.py index 4cc3673..2f0de25 100644 --- a/IPython/extensions/autoreload.py +++ b/IPython/extensions/autoreload.py @@ -475,7 +475,6 @@ class AutoreloadMagics(Magics): if not modname: to_reload = sorted(self._reloader.modules.keys()) to_skip = sorted(self._reloader.skip_modules.keys()) - to_skip.sort() if stream is None: stream = sys.stdout if self._reloader.check_all: diff --git a/IPython/extensions/rmagic.py b/IPython/extensions/rmagic.py index c8a330b..0b27a19 100644 --- a/IPython/extensions/rmagic.py +++ b/IPython/extensions/rmagic.py @@ -618,9 +618,9 @@ class RMagics(Magics): ri.set_writeconsole(old_writeconsole) except RInterpreterError as e: - print((e.stdout)) + print(e.stdout) if not e.stdout.endswith(e.err): - print((e.err)) + print(e.err) rmtree(tmpd) return diff --git a/IPython/external/mathjax.py b/IPython/external/mathjax.py index 899bdbe..5272363 100644 --- a/IPython/external/mathjax.py +++ b/IPython/external/mathjax.py @@ -157,7 +157,7 @@ def install_mathjax(tag='v2.2', dest=default_dest, replace=False, file=None, ext try: anything_to_do = prepare_dest(dest, replace) except OSError as e: - print(("ERROR %s, require write access to %s" % (e, dest))) + print("ERROR %s, require write access to %s" % (e, dest)) return 1 else: if not anything_to_do: diff --git a/IPython/lib/demo.py b/IPython/lib/demo.py index f5c6bc3..7834cae 100644 --- a/IPython/lib/demo.py +++ b/IPython/lib/demo.py @@ -398,7 +398,7 @@ class Demo(object): print(self.marquee('<%s> block # %s (%s remaining)' % (self.title,index,self.nblocks-index-1)), file=io.stdout) - print((self.src_blocks_colored[index]), file=io.stdout) + print(self.src_blocks_colored[index], file=io.stdout) sys.stdout.flush() def show_all(self): diff --git a/IPython/nbconvert/postprocessors/serve.py b/IPython/nbconvert/postprocessors/serve.py index 7751372..73d1179 100644 --- a/IPython/nbconvert/postprocessors/serve.py +++ b/IPython/nbconvert/postprocessors/serve.py @@ -93,7 +93,7 @@ class ServePostProcessor(PostProcessorBase): http_server = httpserver.HTTPServer(app) http_server.listen(self.port, address=self.ip) url = "http://%s:%i/%s" % (self.ip, self.port, filename) - print(("Serving your slides at %s" % url)) + print("Serving your slides at %s" % url) print("Use Control-C to stop this server") if self.open_in_browser: webbrowser.open(url, new=2) diff --git a/IPython/nbconvert/writers/debug.py b/IPython/nbconvert/writers/debug.py index 88aa105..85cc24b 100644 --- a/IPython/nbconvert/writers/debug.py +++ b/IPython/nbconvert/writers/debug.py @@ -35,9 +35,9 @@ class DebugWriter(WriterBase): """ if isinstance(resources['outputs'], dict): - print(("outputs extracted from %s" % notebook_name)) - print(('-' * 80)) + print("outputs extracted from %s" % notebook_name) + print('-' * 80) pprint(resources['outputs'], indent=2, width=70) else: - print(("no outputs extracted from %s" % notebook_name)) - print(('=' * 80)) + print("no outputs extracted from %s" % notebook_name) + print('=' * 80) diff --git a/IPython/parallel/client/client.py b/IPython/parallel/client/client.py index 4fb1e12..3c37ac9 100644 --- a/IPython/parallel/client/client.py +++ b/IPython/parallel/client/client.py @@ -734,9 +734,9 @@ class Client(HasTraits): msg_id = parent['msg_id'] if msg_id not in self.outstanding: if msg_id in self.history: - print(("got stale result: %s"%msg_id)) + print("got stale result: %s"%msg_id) else: - print(("got unknown result: %s"%msg_id)) + print("got unknown result: %s"%msg_id) else: self.outstanding.remove(msg_id) @@ -770,11 +770,11 @@ class Client(HasTraits): msg_id = parent['msg_id'] if msg_id not in self.outstanding: if msg_id in self.history: - print(("got stale result: %s"%msg_id)) + print("got stale result: %s"%msg_id) print(self.results[msg_id]) print(msg) else: - print(("got unknown result: %s"%msg_id)) + print("got unknown result: %s"%msg_id) else: self.outstanding.remove(msg_id) content = msg['content']