From a31e9bd9ea261ce88fd09a89476d51d327732c78 Mon Sep 17 00:00:00 2001 From: Toshio Kuratomi Date: Wed, 19 Apr 2017 09:49:44 -0700 Subject: [PATCH] Really minor optimization and style change for d0e3d75381292fc7bf417598f9f6542a7fcd2d07 * Use a generator expression instead of a list comprehension * Use copy() to create a new set instead of the constructor. --- lib/ansible/modules/system/user.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/ansible/modules/system/user.py b/lib/ansible/modules/system/user.py index 49a71d99a71..fb0754183d7 100644 --- a/lib/ansible/modules/system/user.py +++ b/lib/ansible/modules/system/user.py @@ -552,8 +552,8 @@ class User(object): if self.groups is None: return None info = self.user_info() - groups = set([x.strip() for x in self.groups.split(',') if x]) - for g in set(groups): + groups = set(x.strip() for x in self.groups.split(',') if x) + for g in groups.copy(): if not self.group_exists(g): self.module.fail_json(msg="Group %s does not exist" % (g)) if info and remove_existing and self.group_info(g)[2] == info[3]: