From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.115; helo=mga14.intel.com; envelope-from=jaben.carsey@intel.com; receiver=edk2-devel@lists.01.org Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 342F92034C8CF for ; Fri, 27 Apr 2018 15:33:03 -0700 (PDT) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 27 Apr 2018 15:33:02 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,336,1520924400"; d="scan'208";a="54252886" Received: from jcarsey-desk1.amr.corp.intel.com ([10.7.159.144]) by orsmga002.jf.intel.com with ESMTP; 27 Apr 2018 15:33:01 -0700 From: Jaben Carsey To: edk2-devel@lists.01.org Cc: Liming Gao , Yonghong Zhu Date: Fri, 27 Apr 2018 15:32:52 -0700 Message-Id: <2f962780c2f35ab17f5a471a242e1b0d1656d669.1524868035.git.jaben.carsey@intel.com> X-Mailer: git-send-email 2.16.2.windows.1 In-Reply-To: References: In-Reply-To: References: Subject: [PATCH v1 38/42] BaseTools: Remove lists form set construction X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 Apr 2018 22:33:04 -0000 There is no need to make a list to make a set. remove lists that are only used in constructing sets. Cc: Liming Gao Cc: Yonghong Zhu Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Jaben Carsey --- BaseTools/Source/Python/AutoGen/GenDepex.py | 7 +++---- BaseTools/Source/Python/Workspace/DscBuildData.py | 10 +++++----- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/BaseTools/Source/Python/AutoGen/GenDepex.py b/BaseTools/Source/Python/AutoGen/GenDepex.py index 3dcbad5be666..533447efe82e 100644 --- a/BaseTools/Source/Python/AutoGen/GenDepex.py +++ b/BaseTools/Source/Python/AutoGen/GenDepex.py @@ -54,7 +54,7 @@ gType2Phase = { # class DependencyExpression: - ArchProtocols = set([ + ArchProtocols = { '665e3ff6-46cc-11d4-9a38-0090273fc14d', # 'gEfiBdsArchProtocolGuid' '26baccb1-6f42-11d4-bce7-0080c73c8881', # 'gEfiCpuArchProtocolGuid' '26baccb2-6f42-11d4-bce7-0080c73c8881', # 'gEfiMetronomeArchProtocolGuid' @@ -67,8 +67,7 @@ class DependencyExpression: '6441f818-6362-4e44-b570-7dba31dd2453', # 'gEfiVariableWriteArchProtocolGuid' '1e5668e2-8481-11d4-bcf1-0080c73c8881', # 'gEfiVariableArchProtocolGuid' '665e3ff5-46cc-11d4-9a38-0090273fc14d' # 'gEfiWatchdogTimerArchProtocolGuid' - ] - ) + } OpcodePriority = { DEPEX_OPCODE_AND : 1, @@ -304,7 +303,7 @@ class DependencyExpression: # don't generate depex if all operands are architecture protocols if self.ModuleType in ['UEFI_DRIVER', 'DXE_DRIVER', 'DXE_RUNTIME_DRIVER', 'DXE_SAL_DRIVER', 'DXE_SMM_DRIVER', 'MM_STANDALONE'] and \ Op == DEPEX_OPCODE_AND and \ - self.ArchProtocols == set([GuidStructureStringToGuidString(Guid) for Guid in AllOperand]): + self.ArchProtocols == set(GuidStructureStringToGuidString(Guid) for Guid in AllOperand): self.PostfixNotation = [] return diff --git a/BaseTools/Source/Python/Workspace/DscBuildData.py b/BaseTools/Source/Python/Workspace/DscBuildData.py index 48690aa357f7..235392e1e4fb 100644 --- a/BaseTools/Source/Python/Workspace/DscBuildData.py +++ b/BaseTools/Source/Python/Workspace/DscBuildData.py @@ -942,7 +942,7 @@ class DscBuildData(PlatformBuildClassObject): for skuid in pcd.SkuInfoList: skuobj = pcd.SkuInfoList.get(skuid) if TAB_DEFAULT_STORES_DEFAULT not in skuobj.DefaultStoreDict: - PcdDefaultStoreSet = set([defaultstorename for defaultstorename in skuobj.DefaultStoreDict]) + PcdDefaultStoreSet = set(defaultstorename for defaultstorename in skuobj.DefaultStoreDict) mindefaultstorename = DefaultStoreMgr.GetMin(PcdDefaultStoreSet) skuobj.DefaultStoreDict[TAB_DEFAULT_STORES_DEFAULT] = copy.deepcopy(skuobj.DefaultStoreDict[mindefaultstorename]) return Pcds @@ -1360,7 +1360,7 @@ class DscBuildData(PlatformBuildClassObject): nextskuid = self.SkuIdMgr.GetNextSkuId(nextskuid) if NoDefault: continue - PcdDefaultStoreSet = set([defaultstorename for defaultstorename in stru_pcd.SkuOverrideValues[nextskuid]]) + PcdDefaultStoreSet = set(defaultstorename for defaultstorename in stru_pcd.SkuOverrideValues[nextskuid]) mindefaultstorename = DefaultStoreMgr.GetMin(PcdDefaultStoreSet) for defaultstoreid in DefaultStores: @@ -1404,7 +1404,7 @@ class DscBuildData(PlatformBuildClassObject): if str_pcd_obj.Type not in [self._PCD_TYPE_STRING_[MODEL_PCD_DYNAMIC_HII], self._PCD_TYPE_STRING_[MODEL_PCD_DYNAMIC_EX_HII]]: continue - PcdDefaultStoreSet = set([defaultstorename for skuobj in str_pcd_obj.SkuInfoList.values() for defaultstorename in skuobj.DefaultStoreDict]) + PcdDefaultStoreSet = set(defaultstorename for skuobj in str_pcd_obj.SkuInfoList.values() for defaultstorename in skuobj.DefaultStoreDict) DefaultStoreObj = DefaultStore(self._GetDefaultStores()) mindefaultstorename = DefaultStoreObj.GetMin(PcdDefaultStoreSet) str_pcd_obj.SkuInfoList[self.SkuIdMgr.SystemSkuId].HiiDefaultValue = str_pcd_obj.SkuInfoList[self.SkuIdMgr.SystemSkuId].DefaultStoreDict[mindefaultstorename] @@ -2308,7 +2308,7 @@ class DscBuildData(PlatformBuildClassObject): Pcds = {} DefaultStoreObj = DefaultStore(self._GetDefaultStores()) SkuIds = {skuname:skuid for skuname,skuid in self.SkuIdMgr.AvailableSkuIdSet.items() if skuname != TAB_COMMON} - DefaultStores = set([storename for pcdobj in PcdSet.values() for skuobj in pcdobj.SkuInfoList.values() for storename in skuobj.DefaultStoreDict]) + DefaultStores = set(storename for pcdobj in PcdSet.values() for skuobj in pcdobj.SkuInfoList.values() for storename in skuobj.DefaultStoreDict) for PcdCName, TokenSpaceGuid in PcdSet: PcdObj = PcdSet[(PcdCName, TokenSpaceGuid)] self.CopyDscRawValue(PcdObj) @@ -2498,7 +2498,7 @@ class DscBuildData(PlatformBuildClassObject): invalidhii = [] for pcdname in Pcds: pcd = Pcds[pcdname] - varnameset = set([sku.VariableName for (skuid,sku) in pcd.SkuInfoList.items()]) + varnameset = set(sku.VariableName for (skuid,sku) in pcd.SkuInfoList.items()) if len(varnameset) > 1: invalidhii.append(".".join((pcdname[1],pcdname[0]))) if len(invalidhii): -- 2.16.2.windows.1