functions (like join) can use the iterator just as easily.

Cc: Liming Gao <[email protected]>
Cc: Yonghong Zhu <[email protected]>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jaben Carsey <[email protected]>
---
 BaseTools/Source/Python/AutoGen/AutoGen.py                     | 10 +++++-----
 BaseTools/Source/Python/AutoGen/GenVar.py                      |  8 ++++----
 BaseTools/Source/Python/Common/MigrationUtilities.py           |  2 +-
 BaseTools/Source/Python/Common/Misc.py                         |  8 ++++----
 BaseTools/Source/Python/Common/String.py                       | 12 
++++++------
 BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaDataTable.py |  4 ++--
 BaseTools/Source/Python/GenFds/GenFds.py                       |  2 +-
 BaseTools/Source/Python/Workspace/DscBuildData.py              |  6 +++---
 BaseTools/Source/Python/Workspace/InfBuildData.py              | 12 
++++++------
 BaseTools/Source/Python/Workspace/MetaDataTable.py             |  4 ++--
 BaseTools/Source/Python/build/build.py                         |  2 +-
 11 files changed, 35 insertions(+), 35 deletions(-)

diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py 
b/BaseTools/Source/Python/AutoGen/AutoGen.py
index 39d5932a9a66..6cd54c2e9aa1 100644
--- a/BaseTools/Source/Python/AutoGen/AutoGen.py
+++ b/BaseTools/Source/Python/AutoGen/AutoGen.py
@@ -460,7 +460,7 @@ class WorkspaceAutoGen(AutoGen):
                             'build',
                             FORMAT_INVALID,
                             "Building modules from source INFs, following PCD 
use %s and %s access method. It must be corrected to use only one access 
method." % (i, j),
-                            ExtraData="%s" % '\n\t'.join([str(P[1]+'.'+P[0]) 
for P in Intersections])
+                            ExtraData="%s" % '\n\t'.join(str(P[1]+'.'+P[0]) 
for P in Intersections)
                             )
 
             #
@@ -2295,7 +2295,7 @@ class PlatformAutoGen(AutoGen):
         #
         for Item in LibraryList:
             if ConsumedByList[Item] != [] and Item in Constructor and 
len(Constructor) > 1:
-                ErrorMessage = "\tconsumed by " + "\n\tconsumed by 
".join([str(L) for L in ConsumedByList[Item]])
+                ErrorMessage = "\tconsumed by " + "\n\tconsumed by 
".join(str(L) for L in ConsumedByList[Item])
                 EdkLogger.error("build", BUILD_ERROR, 'Library [%s] with 
constructors has a cycle' % str(Item),
                                 ExtraData=ErrorMessage, File=self.MetaFile)
             if Item not in SortedLibraryList:
@@ -2415,7 +2415,7 @@ class PlatformAutoGen(AutoGen):
                 if Sku.VariableGuid == '': continue
                 Sku.VariableGuidValue = GuidValue(Sku.VariableGuid, 
self.PackageList, self.MetaFile.Path)
                 if Sku.VariableGuidValue is None:
-                    PackageList = "\n\t".join([str(P) for P in 
self.PackageList])
+                    PackageList = "\n\t".join(str(P) for P in self.PackageList)
                     EdkLogger.error(
                                 'build',
                                 RESOURCE_NOT_AVAILABLE,
@@ -3122,7 +3122,7 @@ class ModuleAutoGen(AutoGen):
             for Depex in DepexList:
                 for key in Depex:
                     DepexStr += '[Depex.%s.%s]\n' % key
-                    DepexStr += '\n'.join(['# '+ val for val in Depex[key]])
+                    DepexStr += '\n'.join('# '+ val for val in Depex[key])
                     DepexStr += '\n\n'
             if not DepexStr:
                 return '[Depex.%s]\n' % self.Arch
@@ -3136,7 +3136,7 @@ class ModuleAutoGen(AutoGen):
                 DepexStr += ' AND '
             DepexStr += '('
             for D in Depex.values():
-                DepexStr += ' '.join([val for val in D])
+                DepexStr += ' '.join(val for val in D)
             Index = DepexStr.find('END')
             if Index > -1 and Index == len(DepexStr) - 3:
                 DepexStr = DepexStr[:-3]
diff --git a/BaseTools/Source/Python/AutoGen/GenVar.py 
b/BaseTools/Source/Python/AutoGen/GenVar.py
index bc750bd72f37..ffd490520dcc 100644
--- a/BaseTools/Source/Python/AutoGen/GenVar.py
+++ b/BaseTools/Source/Python/AutoGen/GenVar.py
@@ -80,7 +80,7 @@ class VariableMgr(object):
             try:
                 newvaluestr = "{" + 
",".join(VariableMgr.assemble_variable(newvalue)) +"}"
             except:
-                EdkLogger.error("build", AUTOGEN_ERROR, "Variable offset 
conflict in PCDs: %s \n" % (" and ".join([item.pcdname for item in 
sku_var_info_offset_list])))
+                EdkLogger.error("build", AUTOGEN_ERROR, "Variable offset 
conflict in PCDs: %s \n" % (" and ".join(item.pcdname for item in 
sku_var_info_offset_list)))
             n = sku_var_info_offset_list[0]
             indexedvarinfo[key] =  
[var_info(n.pcdindex,n.pcdname,n.defaultstoragename,n.skuname,n.var_name, 
n.var_guid, "0x00",n.var_attribute,newvaluestr  , newvaluestr , 
DataType.TAB_VOID)]
         self.VarInfo = [item[0] for item in indexedvarinfo.values()]
@@ -116,9 +116,9 @@ class VariableMgr(object):
             default_sku_default = 
indexedvarinfo[index].get((DataType.TAB_DEFAULT,DataType.TAB_DEFAULT_STORES_DEFAULT))
 
             if default_sku_default.data_type not in 
DataType.TAB_PCD_NUMERIC_TYPES:
-                var_max_len = max([len(var_item.default_value.split(",")) for 
var_item in sku_var_info.values()])
+                var_max_len = max(len(var_item.default_value.split(",")) for 
var_item in sku_var_info.values())
                 if len(default_sku_default.default_value.split(",")) < 
var_max_len:
-                    tail = ",".join([ "0x00" for i in 
range(var_max_len-len(default_sku_default.default_value.split(",")))])
+                    tail = ",".join("0x00" for i in 
range(var_max_len-len(default_sku_default.default_value.split(","))))
 
             default_data_buffer = 
VariableMgr.PACK_VARIABLES_DATA(default_sku_default.default_value,default_sku_default.data_type,tail)
 
@@ -136,7 +136,7 @@ class VariableMgr(object):
 
                 if default_sku_default.data_type not in 
DataType.TAB_PCD_NUMERIC_TYPES:
                     if len(other_sku_other.default_value.split(",")) < 
var_max_len:
-                        tail = ",".join([ "0x00" for i in 
range(var_max_len-len(other_sku_other.default_value.split(",")))])
+                        tail = ",".join("0x00" for i in 
range(var_max_len-len(other_sku_other.default_value.split(","))))
 
                 others_data_buffer = 
VariableMgr.PACK_VARIABLES_DATA(other_sku_other.default_value,other_sku_other.data_type,tail)
 
diff --git a/BaseTools/Source/Python/Common/MigrationUtilities.py 
b/BaseTools/Source/Python/Common/MigrationUtilities.py
index 27d30a11b529..cc6bb4924dc3 100644
--- a/BaseTools/Source/Python/Common/MigrationUtilities.py
+++ b/BaseTools/Source/Python/Common/MigrationUtilities.py
@@ -506,7 +506,7 @@ def GetTextFileInfo(FileName, TagTuple):
 #
 def GetXmlFileInfo(FileName, TagTuple):
     XmlDom = XmlParseFile(FileName)
-    return tuple([XmlElement(XmlDom, XmlTag) for XmlTag in TagTuple])
+    return tuple(XmlElement(XmlDom, XmlTag) for XmlTag in TagTuple)
 
 
 ## Parse migration command line options
diff --git a/BaseTools/Source/Python/Common/Misc.py 
b/BaseTools/Source/Python/Common/Misc.py
index 86c69808422c..f01b4bd05b52 100644
--- a/BaseTools/Source/Python/Common/Misc.py
+++ b/BaseTools/Source/Python/Common/Misc.py
@@ -833,7 +833,7 @@ class TemplateString(object):
     def Append(self, AppendString, Dictionary=None):
         if Dictionary:
             SectionList = self._Parse(AppendString)
-            self.String += "".join([S.Instantiate(Dictionary) for S in 
SectionList])
+            self.String += "".join(S.Instantiate(Dictionary) for S in 
SectionList)
         else:
             self.String += AppendString
 
@@ -844,7 +844,7 @@ class TemplateString(object):
     #   @retval     str             The string replaced with placeholder values
     #
     def Replace(self, Dictionary=None):
-        return "".join([S.Instantiate(Dictionary) for S in 
self._TemplateSectionList])
+        return "".join(S.Instantiate(Dictionary) for S in 
self._TemplateSectionList)
 
 ## Progress indicator class
 #
@@ -1926,7 +1926,7 @@ class DefaultStore():
         if not self.DefaultStores or "0" in self.DefaultStores:
             return "0",TAB_DEFAULT_STORES_DEFAULT
         else:
-            minvalue = min([int(value_str) for value_str in 
self.DefaultStores])
+            minvalue = min(int(value_str) for value_str in self.DefaultStores)
             return (str(minvalue), self.DefaultStores[str(minvalue)])
     def GetMin(self,DefaultSIdList):
         if not DefaultSIdList:
@@ -2023,7 +2023,7 @@ class SkuClass():
             skuorderset.append(self.GetSkuChain(skuname))
 
         skuorder = []
-        for index in range(max([len(item) for item in skuorderset])):
+        for index in range(max(len(item) for item in skuorderset)):
             for subset in skuorderset:
                 if index > len(subset)-1:
                     continue
diff --git a/BaseTools/Source/Python/Common/String.py 
b/BaseTools/Source/Python/Common/String.py
index 389a3ca51d27..70784bcbbdaa 100644
--- a/BaseTools/Source/Python/Common/String.py
+++ b/BaseTools/Source/Python/Common/String.py
@@ -818,27 +818,27 @@ def StringToArray(String):
     if isinstance(String, unicode):
         if len(unicode) == 0:
             return "{0x00,0x00}"
-        return "{%s,0x00,0x00}" % ",".join(["0x%02x,0x00" % ord(C) for C in 
String])
+        return "{%s,0x00,0x00}" % ",".join("0x%02x,0x00" % ord(C) for C in 
String)
     elif String.startswith('L"'):
         if String == "L\"\"":
             return "{0x00,0x00}"
         else:
-            return "{%s,0x00,0x00}" % ",".join(["0x%02x,0x00" % ord(C) for C 
in String[2:-1]])
+            return "{%s,0x00,0x00}" % ",".join("0x%02x,0x00" % ord(C) for C in 
String[2:-1])
     elif String.startswith('"'):
         if String == "\"\"":
             return "{0x00,0x00}"
         else:
             StringLen = len(String[1:-1])
             if StringLen % 2:
-                return "{%s,0x00}" % ",".join(["0x%02x" % ord(C) for C in 
String[1:-1]])
+                return "{%s,0x00}" % ",".join("0x%02x" % ord(C) for C in 
String[1:-1])
             else:
-                return "{%s,0x00,0x00}" % ",".join(["0x%02x" % ord(C) for C in 
String[1:-1]])
+                return "{%s,0x00,0x00}" % ",".join("0x%02x" % ord(C) for C in 
String[1:-1])
     elif String.startswith('{'):
         StringLen = len(String.split(","))
         if StringLen % 2:
-            return "{%s,0x00}" % ",".join([ C.strip() for C in 
String[1:-1].split(',')])
+            return "{%s,0x00}" % ",".join(C.strip() for C in 
String[1:-1].split(','))
         else:
-            return "{%s}" % ",".join([ C.strip() for C in 
String[1:-1].split(',')])
+            return "{%s}" % ",".join(C.strip() for C in 
String[1:-1].split(','))
 
     else:
         if len(String.split()) % 2:
diff --git a/BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaDataTable.py 
b/BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaDataTable.py
index 6b980150f53e..760f88cc7294 100644
--- a/BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaDataTable.py
+++ b/BaseTools/Source/Python/Ecc/MetaFileWorkspace/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.<BR>
+# Copyright (c) 2008 - 2018, Intel Corporation. All rights reserved.<BR>
 # 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)
diff --git a/BaseTools/Source/Python/GenFds/GenFds.py 
b/BaseTools/Source/Python/GenFds/GenFds.py
index 4b8c7913d2db..7e80575dd794 100644
--- a/BaseTools/Source/Python/GenFds/GenFds.py
+++ b/BaseTools/Source/Python/GenFds/GenFds.py
@@ -761,7 +761,7 @@ class GenFds :
                                     length = F.tell()
                                     F.seek(4)
                                     TmpStr = unpack('%dh' % ((length - 4) / 
2), F.read())
-                                    Name = ''.join([chr(c) for c in 
TmpStr[:-1]])
+                                    Name = ''.join(chr(c) for c in TmpStr[:-1])
                         else:
                             FileList = []
                             if 'fv.sec.txt' in MatchDict:
diff --git a/BaseTools/Source/Python/Workspace/DscBuildData.py 
b/BaseTools/Source/Python/Workspace/DscBuildData.py
index 235392e1e4fb..3d3db61d851b 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 a725a2a2a772..d21f38bc7f46 100644
--- a/BaseTools/Source/Python/Workspace/InfBuildData.py
+++ b/BaseTools/Source/Python/Workspace/InfBuildData.py
@@ -718,7 +718,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])
@@ -743,7 +743,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])
@@ -768,7 +768,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])
@@ -938,7 +938,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])
@@ -981,7 +981,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)
@@ -1151,7 +1151,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 0cfec9023261..e37a10c82f8f 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.<BR>
+# Copyright (c) 2008 - 2018, Intel Corporation. All rights reserved.<BR>
 # 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)
diff --git a/BaseTools/Source/Python/build/build.py 
b/BaseTools/Source/Python/build/build.py
index 0ca78c1fa451..6b01617c5c5f 100644
--- a/BaseTools/Source/Python/build/build.py
+++ b/BaseTools/Source/Python/build/build.py
@@ -545,7 +545,7 @@ class BuildTask:
             # while not BuildTask._ErrorFlag.isSet() and \
             while len(BuildTask._RunningQueue) > 0:
                 EdkLogger.verbose("Waiting for thread ending...(%d)" % 
len(BuildTask._RunningQueue))
-                EdkLogger.debug(EdkLogger.DEBUG_8, "Threads [%s]" % ", 
".join([Th.getName() for Th in threading.enumerate()]))
+                EdkLogger.debug(EdkLogger.DEBUG_8, "Threads [%s]" % ", 
".join(Th.getName() for Th in threading.enumerate()))
                 # avoid tense loop
                 time.sleep(0.1)
         except BaseException, X:
-- 
2.16.2.windows.1

_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to