From 9517d2c5c0e164e67db2b02bca552fc1c6b2fb3e Mon Sep 17 00:00:00 2001 From: Bernhard Reutner-Fischer Date: Mon, 8 Sep 2014 17:24:24 +0200 Subject: pwclient: Rephrase patch_ids iterator Don't generate an empty array, use for-loop instead as noticed by Jacob E. Keller Signed-off-by: Bernhard Reutner-Fischer Signed-off-by: Jeremy Kerr --- apps/patchwork/bin/pwclient | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) (limited to 'apps/patchwork/bin/pwclient') diff --git a/apps/patchwork/bin/pwclient b/apps/patchwork/bin/pwclient index b12e816..b86949c 100755 --- a/apps/patchwork/bin/pwclient +++ b/apps/patchwork/bin/pwclient @@ -646,26 +646,30 @@ def main(): if len(s) > 0: print unicode(s).encode("utf-8") - elif action in ('get', 'save', 'info'): - if action == 'info': - [action_info(rpc, patch_id) for patch_id in non_empty(h, patch_ids)] - else: - [action_get(rpc, patch_id) for patch_id in non_empty(h, patch_ids)] + elif action == 'info': + for patch_id in non_empty(h, patch_ids): + action_info(rpc, patch_id) + + elif action in ('get', 'save'): + for patch_id in non_empty(h, patch_ids): + action_get(rpc, patch_id) elif action == 'apply': - [action_apply(rpc, patch_id) for patch_id in non_empty(h, patch_ids)] + for patch_id in non_empty(h, patch_ids): + action_apply(rpc, patch_id) elif action == 'git_am': cmd = ['git', 'am'] if do_signoff: cmd.append('-s') - [action_apply(rpc, patch_id, cmd) for patch_id in - non_empty(h, patch_ids)] + for patch_id in non_empty(h, patch_ids): + action_apply(rpc, patch_id, cmd) elif action == 'update': - [action_update_patch(rpc, patch_id, state = state_str, + for patch_id in non_empty(h, patch_ids): + action_update_patch(rpc, patch_id, state = state_str, commit = commit_str - ) for patch_id in non_empty(h, patch_ids)] + ) else: sys.stderr.write("Unknown action '%s'\n" % action) -- cgit v1.2.3