diff options
author | Carsey, Jaben <jaben.carsey@intel.com> | 2018-04-17 22:40:15 +0800 |
---|---|---|
committer | Yonghong Zhu <yonghong.zhu@intel.com> | 2018-04-18 22:15:36 +0800 |
commit | 9eb87141eca12b1f15afa4b769af04d1395891c6 (patch) | |
tree | 82ac481092b68ea3684f94bf7dc90c3c584aea52 /BaseTools/Source/Python/Common/Parsing.py | |
parent | 55c84777ee638be8735a5c421941e7eb71633bdf (diff) | |
download | edk2-9eb87141eca12b1f15afa4b769af04d1395891c6.tar.gz edk2-9eb87141eca12b1f15afa4b769af04d1395891c6.tar.bz2 edk2-9eb87141eca12b1f15afa4b769af04d1395891c6.zip |
BaseTools: refactor and remove un-needed use of .keys() on dictionaries
sometimes just delete it.
sometimes the loop needed .values() instead
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/Common/Parsing.py')
-rw-r--r-- | BaseTools/Source/Python/Common/Parsing.py | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/BaseTools/Source/Python/Common/Parsing.py b/BaseTools/Source/Python/Common/Parsing.py index d199d1e40d..453c2039e3 100644 --- a/BaseTools/Source/Python/Common/Parsing.py +++ b/BaseTools/Source/Python/Common/Parsing.py @@ -1,7 +1,7 @@ ## @file
# This file is used to define common parsing related functions used in parsing INF/DEC/DSC process
#
-# 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
@@ -37,16 +37,14 @@ def ParseDefineMacro2(Table, RecordSets, GlobalMacro): #
# Overrided by Global Macros
#
- for Key in GlobalMacro.keys():
- Macros[Key] = GlobalMacro[Key]
+ Macros.update(GlobalMacro)
#
# Replace the Macros
#
- for Key in RecordSets.keys():
- if RecordSets[Key] != []:
- for Item in RecordSets[Key]:
- Item[0] = ReplaceMacro(Item[0], Macros)
+ for Value in (v for v in RecordSets.values() if v):
+ for Item in Value:
+ Item[0] = ReplaceMacro(Item[0], Macros)
## ParseDefineMacro
#
@@ -79,8 +77,7 @@ def ParseDefineMacro(Table, GlobalMacro): #
# Overrided by Global Macros
#
- for Key in GlobalMacro.keys():
- Macros[Key] = GlobalMacro[Key]
+ Macros.update(GlobalMacro)
#
# Found all defined macro and replaced
|