From: Jaben Carsey <jaben.carsey@intel.com>
To: edk2-devel@lists.01.org
Cc: Liming Gao <liming.gao@intel.com>, Yonghong Zhu <yonghong.zhu@intel.com>
Subject: [PATCH v1 38/42] BaseTools: Remove lists form set construction
Date: Fri, 27 Apr 2018 15:32:52 -0700 [thread overview]
Message-ID: <2f962780c2f35ab17f5a471a242e1b0d1656d669.1524868035.git.jaben.carsey@intel.com> (raw)
In-Reply-To: <cover.1524868033.git.jaben.carsey@intel.com>
In-Reply-To: <cover.1524868033.git.jaben.carsey@intel.com>
There is no need to make a list to make a set. remove lists
that are only used in constructing sets.
Cc: Liming Gao <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jaben Carsey <jaben.carsey@intel.com>
---
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
next prev parent reply other threads:[~2018-04-27 22:33 UTC|newest]
Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-27 22:32 [PATCH v1 00/42] BaseTools: refactoring patches Jaben Carsey
2018-04-27 22:32 ` [PATCH v1 01/42] BaseTools: FdfParser - update to remove duplicate constant value Jaben Carsey
2018-04-27 22:32 ` [PATCH v1 02/42] BaseTools: AutoGen " Jaben Carsey
2018-04-27 22:32 ` [PATCH v1 03/42] BaseTools: check before accessing members in __eq__ Jaben Carsey
2018-04-27 22:32 ` [PATCH v1 04/42] BaseTools: this function has no purpose Jaben Carsey
2018-04-27 22:32 ` [PATCH v1 05/42] BaseTools: AutoGen - refactor assemble_variable Jaben Carsey
2018-04-27 22:32 ` [PATCH v1 06/42] BaseTools: AutoGen - refactor dictionary access Jaben Carsey
2018-04-27 22:32 ` [PATCH v1 07/42] BaseTools: AutoGen - GenVar refactor static methods Jaben Carsey
2018-04-27 22:32 ` [PATCH v1 08/42] BaseTools: AutoGen - share StripComments API Jaben Carsey
2018-04-27 22:32 ` [PATCH v1 09/42] BaseTools: AutoGen - refactor class factory Jaben Carsey
2018-04-27 22:32 ` [PATCH v1 10/42] BaseTools: Eot - remove unused lists Jaben Carsey
2018-04-27 22:32 ` [PATCH v1 11/42] BaseTools: Eot - refactor global data Jaben Carsey
2018-04-27 22:32 ` [PATCH v1 12/42] BaseTools: AutoGen - remove global line Jaben Carsey
2018-04-27 22:32 ` [PATCH v1 13/42] BaseTools: AutoGen - UniClassObject refactor static methods Jaben Carsey
2018-04-27 22:32 ` [PATCH v1 14/42] BaseTools: refactor to use list not dict Jaben Carsey
2018-04-27 22:32 ` [PATCH v1 15/42] BaseTools: eliminate {} from dictionary contructor call Jaben Carsey
2018-04-27 22:32 ` [PATCH v1 16/42] BaseTools: remove Compound statements Jaben Carsey
2018-04-27 22:32 ` [PATCH v1 17/42] BaseTools: Workspace - refactor a dict Jaben Carsey
2018-04-27 22:32 ` [PATCH v1 18/42] BaseTools: move PCD size calculation functions to PcdClassObject Jaben Carsey
2018-04-27 22:32 ` [PATCH v1 19/42] BaseTools: AutoGen - refactor out functions only called in __init__ Jaben Carsey
2018-04-27 22:32 ` [PATCH v1 20/42] BaseTools: AutoGen - refactor out a list Jaben Carsey
2018-04-27 22:32 ` [PATCH v1 21/42] BaseTools: AutoGen - refactor out a useless class Jaben Carsey
2018-04-27 22:32 ` [PATCH v1 22/42] BaseTools: AutoGen - no need to recompute Jaben Carsey
2018-04-27 22:32 ` [PATCH v1 23/42] BaseTools: refactor __init__ functions to not compute temporary variable Jaben Carsey
2018-04-27 22:32 ` [PATCH v1 24/42] BaseTools: AutoGen - remove function no one calls Jaben Carsey
2018-04-27 22:32 ` [PATCH v1 25/42] BaseTools: AutoGen - move function to clean file namespace Jaben Carsey
2018-04-27 22:32 ` [PATCH v1 26/42] BaseTools: AutoGen - remove another function no one calls Jaben Carsey
2018-04-27 22:32 ` [PATCH v1 27/42] BaseTools: Refactor to share GUID packing function Jaben Carsey
2018-04-27 22:32 ` [PATCH v1 28/42] BaseTools: AutoGen - refactor function to remove extra variables Jaben Carsey
2018-04-27 22:32 ` [PATCH v1 29/42] BaseTools: AutoGen - refactor more functions only called in __init__ Jaben Carsey
2018-04-27 22:32 ` [PATCH v1 30/42] BaseTools: remove unused member variable Jaben Carsey
2018-04-27 22:32 ` [PATCH v1 31/42] BaseTools: remove redundant content in InfSectionParser Jaben Carsey
2018-04-27 22:32 ` [PATCH v1 32/42] BaseTools: trim whitespace Jaben Carsey
2018-04-27 22:32 ` [PATCH v1 33/42] BaseTools: AutoGen - add Opcode constants Jaben Carsey
2018-04-27 22:32 ` [PATCH v1 34/42] BaseTools: standardize GUID and pack size Jaben Carsey
2018-04-27 22:32 ` [PATCH v1 35/42] BaseTools: remove unused variable Jaben Carsey
2018-04-27 22:32 ` [PATCH v1 36/42] BaseTools: GenFds - use existing shared string Jaben Carsey
2018-04-27 22:32 ` [PATCH v1 37/42] BaseTools: missed a copyright update Jaben Carsey
2018-04-27 22:32 ` Jaben Carsey [this message]
2018-04-27 22:32 ` [PATCH v1 39/42] BaseTools: refactor Depex optomization Jaben Carsey
2018-04-27 22:32 ` [PATCH v1 40/42] BaseTools: dont make iterator into list if not needed Jaben Carsey
2018-04-27 22:32 ` [PATCH v1 41/42] BaseTools: create base expression class Jaben Carsey
2018-04-27 22:32 ` [PATCH v1 42/42] BaseTools: use set instead of list Jaben Carsey
2018-05-04 4:33 ` [PATCH v1 00/42] BaseTools: refactoring patches Zhu, Yonghong
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2f962780c2f35ab17f5a471a242e1b0d1656d669.1524868035.git.jaben.carsey@intel.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox