From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.136; helo=mga12.intel.com; envelope-from=yonghong.zhu@intel.com; receiver=edk2-devel@lists.01.org Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id A65BE21CB8662 for ; Wed, 28 Mar 2018 19:49:21 -0700 (PDT) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 28 Mar 2018 19:56:00 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.48,374,1517904000"; d="scan'208";a="39027729" Received: from fmsmsx104.amr.corp.intel.com ([10.18.124.202]) by orsmga003.jf.intel.com with ESMTP; 28 Mar 2018 19:55:59 -0700 Received: from fmsmsx120.amr.corp.intel.com (10.18.124.208) by fmsmsx104.amr.corp.intel.com (10.18.124.202) with Microsoft SMTP Server (TLS) id 14.3.319.2; Wed, 28 Mar 2018 19:55:59 -0700 Received: from shsmsx102.ccr.corp.intel.com (10.239.4.154) by fmsmsx120.amr.corp.intel.com (10.18.124.208) with Microsoft SMTP Server (TLS) id 14.3.319.2; Wed, 28 Mar 2018 19:55:59 -0700 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.235]) by shsmsx102.ccr.corp.intel.com ([169.254.2.80]) with mapi id 14.03.0319.002; Thu, 29 Mar 2018 10:55:56 +0800 From: "Zhu, Yonghong" To: "Carsey, Jaben" , "edk2-devel@lists.01.org" CC: "Gao, Liming" , "Zhu, Yonghong" Thread-Topic: [PATCH v1 4/4] BaseTools: dont use enumerate when un-needed Thread-Index: AQHTxiVXJuudWWCvPEmJNJxSqt8/36PmhptA Date: Thu, 29 Mar 2018 02:55:56 +0000 Message-ID: References: <76b0832a94769d586d234dfeb59fa94acd12aeb7.1522194073.git.jaben.carsey@intel.com> In-Reply-To: <76b0832a94769d586d234dfeb59fa94acd12aeb7.1522194073.git.jaben.carsey@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [PATCH v1 4/4] BaseTools: dont use enumerate when un-needed X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Mar 2018 02:49:22 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Yonghong Zhu =20 Best Regards, Zhu Yonghong -----Original Message----- From: Carsey, Jaben=20 Sent: Wednesday, March 28, 2018 7:43 AM To: edk2-devel@lists.01.org Cc: Gao, Liming ; Zhu, Yonghong Subject: [PATCH v1 4/4] BaseTools: dont use enumerate when un-needed Since we only use the item from the list and not the numeric value, dont bo= ther with enumerate() Cc: Liming Gao Cc: Yonghong Zhu Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Jaben Carsey --- BaseTools/Source/Python/Common/Expression.py | 4 ++-- BaseTools/Source/Python/Common/Misc.py | 2 +- BaseTools/Source/Python/GenPatchPcdTable/GenPatchPcdTable.py | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/BaseTools/Source/Python/Common/Expression.py b/BaseTools/Sourc= e/Python/Common/Expression.py index 340c50ebe00f..f28d770aad94 100644 --- a/BaseTools/Source/Python/Common/Expression.py +++ b/BaseTools/Source/Python/Common/Expression.py @@ -856,7 +856,7 @@ class ValueExpressionEx(ValueExpression): LabelDict =3D {} NewPcdValueList =3D [] LabelOffset =3D 0 - for Index, Item in enumerate(PcdValueList): + for Item in PcdValueList: # compute byte offset of every LABEL LabelList =3D _ReLabel.findall(Item) Item =3D _ReLabel.sub('', Item) @@ -882,7 +882= ,7 @@ class ValueExpressionEx(ValueExpression): except: LabelOffset =3D LabelOffset + 1 =20 - for Index, Item in enumerate(PcdValueList): + for Item in PcdValueList: # for LABEL parse Item =3D Item.strip() try: diff --git a/BaseTools/Source/Python/Common/Misc.py b/BaseTools/Source/Pyth= on/Common/Misc.py index 7d44fdcf8ba7..8f479ace4cb1 100644 --- a/BaseTools/Source/Python/Common/Misc.py +++ b/BaseTools/Source/Python/Common/Misc.py @@ -76,7 +76,7 @@ def GetVariableOffset(mapfilepath, efifilepath, varnames)= : def _parseForXcode(lines, efifilepath, varnames): status =3D 0 ret =3D [] - for index, line in enumerate(lines): + for line in lines: line =3D line.strip() if status =3D=3D 0 and line =3D=3D "# Symbols:": status =3D 1 diff --git a/BaseTools/Source/Python/GenPatchPcdTable/GenPatchPcdTable.py b= /BaseTools/Source/Python/GenPatchPcdTable/GenPatchPcdTable.py index fdad5a44dc3d..0a701158e2c2 100644 --- a/BaseTools/Source/Python/GenPatchPcdTable/GenPatchPcdTable.py +++ b/BaseTools/Source/Python/GenPatchPcdTable/GenPatchPcdTable.py @@ -65,7 +65,7 @@ def parsePcdInfoFromMapFile(mapfilepath, efifilepath): def _parseForXcode(lines, efifilepath): status =3D 0 pcds =3D [] - for index, line in enumerate(lines): + for line in lines: line =3D line.strip() if status =3D=3D 0 and line =3D=3D "# Symbols:": status =3D 1 -- 2.16.2.windows.1