From 4070833c7b4d0a5457e6c3578c1cd9d3b9cd2230 Mon Sep 17 00:00:00 2001 From: "Mads M. Pedersen" <mmpe@dtu.dk> Date: Wed, 19 Oct 2016 10:09:25 +0200 Subject: [PATCH] refactor list in ssh_client.py --- wetb/utils/cluster_tools/ssh_client.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/wetb/utils/cluster_tools/ssh_client.py b/wetb/utils/cluster_tools/ssh_client.py index 786437cf..015d75cd 100644 --- a/wetb/utils/cluster_tools/ssh_client.py +++ b/wetb/utils/cluster_tools/ssh_client.py @@ -158,11 +158,7 @@ class SSHClient(object): cwd = os.path.join(cwd, os.path.split(filepattern)[0]).replace("\\", "/") filepattern = os.path.split(filepattern)[1] _, out, _ = self.execute(r'find %s -maxdepth 1 -type f -name "%s"' % (cwd, filepattern)) - files = [] - for file in out.strip().split("\n"): - if file != "": - files.append(file.strip()) - return files + return [file for file in out.strip().split("\n") if file != ""] class SharedSSHClient(SSHClient): -- GitLab