diff options
author | Carsey, Jaben <jaben.carsey@intel.com> | 2018-04-20 23:51:45 +0800 |
---|---|---|
committer | Yonghong Zhu <yonghong.zhu@intel.com> | 2018-04-26 14:44:36 +0800 |
commit | 34c006cd47fdffec7092cb5e4f6a7c2e87e7a5ec (patch) | |
tree | 0640929534a7c4df63e9095f5c1aff99c8b4b11a /BaseTools/Source/Python/AutoGen/GenVar.py | |
parent | 6553c61724f74bd160d2002f5aa768aa687a2af4 (diff) | |
download | edk2-34c006cd47fdffec7092cb5e4f6a7c2e87e7a5ec.tar.gz edk2-34c006cd47fdffec7092cb5e4f6a7c2e87e7a5ec.tar.bz2 edk2-34c006cd47fdffec7092cb5e4f6a7c2e87e7a5ec.zip |
BaseTools: AutoGen - use defaultdict to auto initialize
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>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
Diffstat (limited to 'BaseTools/Source/Python/AutoGen/GenVar.py')
-rw-r--r-- | BaseTools/Source/Python/AutoGen/GenVar.py | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/BaseTools/Source/Python/AutoGen/GenVar.py b/BaseTools/Source/Python/AutoGen/GenVar.py index 3dae16efd0..13bcf99b26 100644 --- a/BaseTools/Source/Python/AutoGen/GenVar.py +++ b/BaseTools/Source/Python/AutoGen/GenVar.py @@ -128,7 +128,7 @@ class VariableMgr(object): return var_value
def process_variable_data(self):
- var_data = dict()
+ var_data = collections.defaultdict(collections.OrderedDict)
indexedvarinfo = collections.OrderedDict()
for item in self.VarInfo:
@@ -155,8 +155,6 @@ class VariableMgr(object): for item in default_data_buffer:
default_data_array += unpack("B",item)
- if (DataType.TAB_DEFAULT,DataType.TAB_DEFAULT_STORES_DEFAULT) not in var_data:
- var_data[(DataType.TAB_DEFAULT,DataType.TAB_DEFAULT_STORES_DEFAULT)] = collections.OrderedDict()
var_data[(DataType.TAB_DEFAULT,DataType.TAB_DEFAULT_STORES_DEFAULT)][index] = (default_data_buffer,sku_var_info[(DataType.TAB_DEFAULT,DataType.TAB_DEFAULT_STORES_DEFAULT)])
for (skuid,defaultstoragename) in indexedvarinfo.get(index):
@@ -177,8 +175,6 @@ class VariableMgr(object): data_delta = self.calculate_delta(default_data_array, others_data_array)
- if (skuid,defaultstoragename) not in var_data:
- var_data[(skuid,defaultstoragename)] = collections.OrderedDict()
var_data[(skuid,defaultstoragename)][index] = (data_delta,sku_var_info[(skuid,defaultstoragename)])
return var_data
|