From 6090fd654f2c9fb169415028d171ee20e7eb55f9 Mon Sep 17 00:00:00 2001 From: Michal Date: Mon, 17 Sep 2018 14:43:59 +0200 Subject: [PATCH] "Generator Expressions" improvements https://www.python.org/dev/peps/pep-0289/ --- plug-ins/pygimp/plug-ins/colorxhtml.py | 2 +- plug-ins/pygimp/plug-ins/pyconsole.py | 2 +- plug-ins/pygimp/plug-ins/python-console.py | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/plug-ins/pygimp/plug-ins/colorxhtml.py b/plug-ins/pygimp/plug-ins/colorxhtml.py index 6bf74de81a..686eef1471 100755 --- a/plug-ins/pygimp/plug-ins/colorxhtml.py +++ b/plug-ins/pygimp/plug-ins/colorxhtml.py @@ -90,7 +90,7 @@ def colorxhtml(img, drawable, filename, raw_filename, allchars = string.maketrans('', '') goodchars = string.digits + string.ascii_letters + string.punctuation - badchars = ''.join([c for c in allchars if c not in goodchars]) + badchars = ''.join(c for c in allchars if c not in goodchars) chars = chars.translate(allchars, badchars) diff --git a/plug-ins/pygimp/plug-ins/pyconsole.py b/plug-ins/pygimp/plug-ins/pyconsole.py index 05df576b8b..199290bf8c 100644 --- a/plug-ins/pygimp/plug-ins/pyconsole.py +++ b/plug-ins/pygimp/plug-ins/pyconsole.py @@ -410,7 +410,7 @@ class _ReadLine(object): self.__insert(iter, "\n") width = max(self.__get_width(), 4) - max_width = max([len(s) for s in completions]) + max_width = max(len(s) for s in completions) n_columns = max(int(width / (max_width + 1)), 1) col_width = int(width / n_columns) total = len(completions) diff --git a/plug-ins/pygimp/plug-ins/python-console.py b/plug-ins/pygimp/plug-ins/python-console.py index a8c7e4c4e7..f5c72217e4 100755 --- a/plug-ins/pygimp/plug-ins/python-console.py +++ b/plug-ins/pygimp/plug-ins/python-console.py @@ -128,8 +128,8 @@ def do_console(): cmd = '' if len(proc.return_vals) > 0: - cmd = ', '.join([x[1].replace('-', '_') - for x in proc.return_vals]) + ' = ' + cmd = ', '.join(x[1].replace('-', '_') + for x in proc.return_vals) + ' = ' cmd = cmd + 'pdb.%s' % proc.proc_name.replace('-', '_') @@ -138,8 +138,8 @@ def do_console(): else: params = proc.params - cmd = cmd + '(%s)' % ', '.join([x[1].replace('-', '_') - for x in params]) + cmd = cmd + '(%s)' % ', '.join(x[1].replace('-', '_') + for x in params) buffer = self.cons.buffer