[blivet:master 5/9] Compress loop into generator list comprehension
Vratislav Podzimek
vpodzime at redhat.com
Thu Apr 24 05:45:54 UTC 2014
On Wed, 2014-04-23 at 17:49 -0400, mulhern wrote:
> There should be no semantic change.
>
> Signed-off-by: mulhern <amulhern at redhat.com>
> ---
> blivet/storage_log.py | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/blivet/storage_log.py b/blivet/storage_log.py
> index 2f430e9..0609d0b 100644
> --- a/blivet/storage_log.py
> +++ b/blivet/storage_log.py
> @@ -67,7 +67,6 @@ def log_exception_info(log_func=log.debug, fmt_str=None, fmt_args=None):
> log_func(fmt_str, spaces, *fmt_args)
> log_func("%sBegin exception details.", spaces)
> tb = traceback.format_exception(*sys.exc_info())
> - for entry in tb:
> - for line in [l for l in entry.split("\n") if l]:
> - log_func("%s %s", spaces, line.rstrip())
> + for line in (l.rstrip() for entry in tb for l in entry.split("\n") if l):
I'd swap the 'for entry...' and 'for l...' because the generated values
are l.rstrip().
--
Vratislav Podzimek
Anaconda Rider | Red Hat, Inc. | Brno - Czech Republic
More information about the anaconda-patches
mailing list