From c5c7e68a915954d8fd15f6c8f3523c65ee06f489 Mon Sep 17 00:00:00 2001 From: "Carsey, Jaben" Date: Sat, 28 Apr 2018 06:32:52 +0800 Subject: [PATCH] BaseTools: Remove lists form set construction 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 Reviewed-by: Yonghong Zhu --- 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 7126fdcddf..23b289500e 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 [SUP_MODULE_UEFI_DRIVER, SUP_MODULE_DXE_DRIVER, SUP_MODULE_DXE_RUNTIME_DRIVER, SUP_MODULE_DXE_SAL_DRIVER, SUP_MODULE_DXE_SMM_DRIVER, SUP_MODULE_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 06ea7b05a3..da1e9ac427 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):