From 7b45f5fb6652e6b946a022727a2bb189034bbde3 Mon Sep 17 00:00:00 2001 From: Alina Lenk Date: Wed, 2 Mar 2022 16:27:17 +0100 Subject: [PATCH 4/5] generate_packets.py: make Variant poscaps and negcaps sets See osdn #44010 Signed-off-by: Alina Lenk --- common/generate_packets.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/common/generate_packets.py b/common/generate_packets.py index 5d2e367615..ee698c647c 100755 --- a/common/generate_packets.py +++ b/common/generate_packets.py @@ -988,14 +988,14 @@ class Variant: self.cancel=packet.cancel self.want_force=packet.want_force - self.poscaps=poscaps - self.negcaps=negcaps + self.poscaps = set(poscaps) + self.negcaps = set(negcaps) if self.poscaps or self.negcaps: - def f(cap): - return 'has_capability("%s", capability)'%(cap) - t=(list(map(lambda x,f=f: f(x),self.poscaps))+ - list(map(lambda x,f=f: '!'+f(x),self.negcaps))) - self.condition=" && ".join(t) + cap_fmt = """has_capability("%s", capability)""" + self.condition = " && ".join(chain( + (cap_fmt % cap for cap in sorted(self.poscaps)), + ("!" + cap_fmt % cap for cap in sorted(self.negcaps)), + )) else: self.condition="TRUE" self.key_fields=list(filter(lambda x:x.is_key,self.fields)) -- 2.17.1