From 8252e6bf2ddfa210992c3590008029933592ad16 Mon Sep 17 00:00:00 2001 From: "Carsey, Jaben" Date: Sat, 28 Apr 2018 06:32:54 +0800 Subject: BaseTools: dont make iterator into list if not needed functions (like join) can use the iterator just as easily. 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/Workspace/DscBuildData.py | 6 +++--- BaseTools/Source/Python/Workspace/InfBuildData.py | 12 ++++++------ BaseTools/Source/Python/Workspace/MetaDataTable.py | 4 ++-- 3 files changed, 11 insertions(+), 11 deletions(-) (limited to 'BaseTools/Source/Python/Workspace') diff --git a/BaseTools/Source/Python/Workspace/DscBuildData.py b/BaseTools/Source/Python/Workspace/DscBuildData.py index da1e9ac427..627a157926 100644 --- a/BaseTools/Source/Python/Workspace/DscBuildData.py +++ b/BaseTools/Source/Python/Workspace/DscBuildData.py @@ -1514,7 +1514,7 @@ class DscBuildData(PlatformBuildClassObject): return len(Value) - 2 return len(Value) - return str(max([pcd_size for pcd_size in [get_length(item) for item in sku_values]])) + return str(max(get_length(item) for item in sku_values)) @staticmethod def ExecuteCommand (Command): @@ -2078,7 +2078,7 @@ class DscBuildData(PlatformBuildClassObject): SearchPathList = [] SearchPathList.append(os.path.normpath(mws.join(GlobalData.gWorkspace, "BaseTools/Source/C/Include"))) SearchPathList.append(os.path.normpath(mws.join(GlobalData.gWorkspace, "BaseTools/Source/C/Common"))) - SearchPathList.extend([str(item) for item in IncSearchList]) + SearchPathList.extend(str(item) for item in IncSearchList) IncFileList = GetDependencyList(IncludeFileFullPaths,SearchPathList) for include_file in IncFileList: MakeApp += "$(OBJECTS) : %s\n" % include_file @@ -2324,7 +2324,7 @@ class DscBuildData(PlatformBuildClassObject): if PcdType in [self._PCD_TYPE_STRING_[MODEL_PCD_DYNAMIC_HII], self._PCD_TYPE_STRING_[MODEL_PCD_DYNAMIC_EX_HII]]: for skuid in PcdObj.SkuInfoList: skuobj = PcdObj.SkuInfoList[skuid] - mindefaultstorename = DefaultStoreObj.GetMin(set([defaultstorename for defaultstorename in skuobj.DefaultStoreDict])) + mindefaultstorename = DefaultStoreObj.GetMin(set(defaultstorename for defaultstorename in skuobj.DefaultStoreDict)) for defaultstorename in DefaultStores: if defaultstorename not in skuobj.DefaultStoreDict: skuobj.DefaultStoreDict[defaultstorename] = copy.deepcopy(skuobj.DefaultStoreDict[mindefaultstorename]) diff --git a/BaseTools/Source/Python/Workspace/InfBuildData.py b/BaseTools/Source/Python/Workspace/InfBuildData.py index 602746de32..bd1c841541 100644 --- a/BaseTools/Source/Python/Workspace/InfBuildData.py +++ b/BaseTools/Source/Python/Workspace/InfBuildData.py @@ -698,7 +698,7 @@ class InfBuildData(ModuleBuildClassObject): CName = Record[0] Value = ProtocolValue(CName, self.Packages, self.MetaFile.Path) if Value is None: - PackageList = "\n\t".join([str(P) for P in self.Packages]) + PackageList = "\n\t".join(str(P) for P in self.Packages) EdkLogger.error('build', RESOURCE_NOT_AVAILABLE, "Value of Protocol [%s] is not found under [Protocols] section in" % CName, ExtraData=PackageList, File=self.MetaFile, Line=Record[-1]) @@ -723,7 +723,7 @@ class InfBuildData(ModuleBuildClassObject): CName = Record[0] Value = PpiValue(CName, self.Packages, self.MetaFile.Path) if Value is None: - PackageList = "\n\t".join([str(P) for P in self.Packages]) + PackageList = "\n\t".join(str(P) for P in self.Packages) EdkLogger.error('build', RESOURCE_NOT_AVAILABLE, "Value of PPI [%s] is not found under [Ppis] section in " % CName, ExtraData=PackageList, File=self.MetaFile, Line=Record[-1]) @@ -748,7 +748,7 @@ class InfBuildData(ModuleBuildClassObject): CName = Record[0] Value = GuidValue(CName, self.Packages, self.MetaFile.Path) if Value is None: - PackageList = "\n\t".join([str(P) for P in self.Packages]) + PackageList = "\n\t".join(str(P) for P in self.Packages) EdkLogger.error('build', RESOURCE_NOT_AVAILABLE, "Value of Guid [%s] is not found under [Guids] section in" % CName, ExtraData=PackageList, File=self.MetaFile, Line=Record[-1]) @@ -918,7 +918,7 @@ class InfBuildData(ModuleBuildClassObject): if Value is None: Value = GuidValue(Token, self.Packages, self.MetaFile.Path) if Value is None: - PackageList = "\n\t".join([str(P) for P in self.Packages]) + PackageList = "\n\t".join(str(P) for P in self.Packages) EdkLogger.error('build', RESOURCE_NOT_AVAILABLE, "Value of [%s] is not found in" % Token, ExtraData=PackageList, File=self.MetaFile, Line=Record[-1]) @@ -961,7 +961,7 @@ class InfBuildData(ModuleBuildClassObject): if TokenSpaceGuid not in self.Guids: Value = GuidValue(TokenSpaceGuid, self.Packages, self.MetaFile.Path) if Value is None: - PackageList = "\n\t".join([str(P) for P in self.Packages]) + PackageList = "\n\t".join(str(P) for P in self.Packages) EdkLogger.error('build', RESOURCE_NOT_AVAILABLE, "Value of Guid [%s] is not found under [Guids] section in" % TokenSpaceGuid, ExtraData=PackageList, File=self.MetaFile, Line=LineNo) @@ -1131,7 +1131,7 @@ class InfBuildData(ModuleBuildClassObject): FORMAT_INVALID, "PCD [%s.%s] in [%s] is not found in dependent packages:" % (TokenSpaceGuid, PcdRealName, self.MetaFile), File=self.MetaFile, Line=LineNo, - ExtraData="\t%s" % '\n\t'.join([str(P) for P in self.Packages]) + ExtraData="\t%s" % '\n\t'.join(str(P) for P in self.Packages) ) Pcds[PcdCName, TokenSpaceGuid] = Pcd diff --git a/BaseTools/Source/Python/Workspace/MetaDataTable.py b/BaseTools/Source/Python/Workspace/MetaDataTable.py index 0cfec90232..e37a10c82f 100644 --- a/BaseTools/Source/Python/Workspace/MetaDataTable.py +++ b/BaseTools/Source/Python/Workspace/MetaDataTable.py @@ -1,7 +1,7 @@ ## @file # This file is used to create/update/query/erase table for files # -# Copyright (c) 2008 - 2014, Intel Corporation. All rights reserved.
+# Copyright (c) 2008 - 2018, Intel Corporation. All rights reserved.
# This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License # which accompanies this distribution. The full text of the license may be found at @@ -73,7 +73,7 @@ class Table(object): self.ID = self.ID + self._ID_STEP_ if self.ID >= (self.IdBase + self._ID_MAX_): self.ID = self.IdBase + self._ID_STEP_ - Values = ", ".join([str(Arg) for Arg in Args]) + Values = ", ".join(str(Arg) for Arg in Args) SqlCommand = "insert into %s values(%s, %s)" % (self.Table, self.ID, Values) EdkLogger.debug(EdkLogger.DEBUG_5, SqlCommand) self.Cur.execute(SqlCommand) -- cgit v1.2.3