No need to make a list from the set. just pop the item off. Cc: Liming Gao <liming....@intel.com> Cc: Yonghong Zhu <yonghong....@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Jaben Carsey <jaben.car...@intel.com> --- BaseTools/Source/Python/AutoGen/GenDepex.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/BaseTools/Source/Python/AutoGen/GenDepex.py b/BaseTools/Source/Python/AutoGen/GenDepex.py index 533447efe82e..f415eaaa7723 100644 --- a/BaseTools/Source/Python/AutoGen/GenDepex.py +++ b/BaseTools/Source/Python/AutoGen/GenDepex.py @@ -271,10 +271,14 @@ class DependencyExpression: ## Simply optimize the dependency expression by removing duplicated operands def Optimize(self): - ValidOpcode = list(set(self.OpcodeList)) - if len(ValidOpcode) != 1 or ValidOpcode[0] not in [DEPEX_OPCODE_AND, DEPEX_OPCODE_OR]: + OpcodeSet = set(self.OpcodeList) + # if there are isn't one in the set, return + if len(OpcodeSet) != 1: + return + Op = OpcodeSet.pop() + #if Op isn't either OR or AND, return + if Op not in [DEPEX_OPCODE_AND, DEPEX_OPCODE_OR]: return - Op = ValidOpcode[0] NewOperand = [] AllOperand = set() for Token in self.PostfixNotation: -- 2.16.2.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel