public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
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 3/4] BaseTools: make static functions when self is not needed
Date: Thu, 29 Mar 2018 17:19:32 -0700	[thread overview]
Message-ID: <a3ed8e64075256c7d0b1e8a80627d8940dfee722.1522369073.git.jaben.carsey@intel.com> (raw)
In-Reply-To: <cover.1522369072.git.jaben.carsey@intel.com>
In-Reply-To: <cover.1522369072.git.jaben.carsey@intel.com>

remove self, and add @staticmethod to functions

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/Common/FdfParserLite.py | 22 ++++++++---------
 BaseTools/Source/Python/GenFds/FdfParser.py     | 25 ++++++++++----------
 2 files changed, 22 insertions(+), 25 deletions(-)

diff --git a/BaseTools/Source/Python/Common/FdfParserLite.py b/BaseTools/Source/Python/Common/FdfParserLite.py
index 9219cdb1bcce..07f44567cfb5 100644
--- a/BaseTools/Source/Python/Common/FdfParserLite.py
+++ b/BaseTools/Source/Python/Common/FdfParserLite.py
@@ -2130,13 +2130,12 @@ class FdfParser(object):
     #
     #   Check whether reloc strip flag can be set for a file type.
     #
-    #   @param  self        The object pointer
     #   @param  FileType    The file type to check with
     #   @retval True        This type could have relocation strip flag
     #   @retval False       No way to have it
     #
-    
-    def __FileCouldHaveRelocFlag (self, FileType):
+    @staticmethod
+    def __FileCouldHaveRelocFlag (FileType):
         if FileType in ('SEC', 'PEI_CORE', 'PEIM', 'PEI_DXE_COMBO'):
             return True
         else:
@@ -2146,13 +2145,12 @@ class FdfParser(object):
     #
     #   Check whether reloc strip flag can be set for a section type.
     #
-    #   @param  self        The object pointer
     #   @param  SectionType The section type to check with
     #   @retval True        This type could have relocation strip flag
     #   @retval False       No way to have it
     #
-    
-    def __SectionCouldHaveRelocFlag (self, SectionType):
+    @staticmethod
+    def __SectionCouldHaveRelocFlag (SectionType):
         if SectionType in ('TE', 'PE32'):
             return True
         else:
@@ -3154,12 +3152,12 @@ class FdfParser(object):
     #
     #   Get whether a section could be optional
     #
-    #   @param  self        The object pointer
     #   @param  SectionType The section type to check
     #   @retval True        section could be optional
     #   @retval False       section never optional
     #
-    def __RuleSectionCouldBeOptional(self, SectionType):
+    @staticmethod
+    def __RuleSectionCouldBeOptional(SectionType):
         if SectionType in ("DXE_DEPEX", "UI", "VERSION", "PEI_DEPEX", "RAW", "SMM_DEPEX"):
             return True
         else:
@@ -3169,12 +3167,12 @@ class FdfParser(object):
     #
     #   Get whether a section could have build number information
     #
-    #   @param  self        The object pointer
     #   @param  SectionType The section type to check
     #   @retval True        section could have build number information
     #   @retval False       section never have build number information
     #
-    def __RuleSectionCouldHaveBuildNum(self, SectionType):
+    @staticmethod
+    def __RuleSectionCouldHaveBuildNum(SectionType):
         if SectionType in ("VERSION"):
             return True
         else:
@@ -3184,12 +3182,12 @@ class FdfParser(object):
     #
     #   Get whether a section could have string
     #
-    #   @param  self        The object pointer
     #   @param  SectionType The section type to check
     #   @retval True        section could have string
     #   @retval False       section never have string
     #
-    def __RuleSectionCouldHaveString(self, SectionType):
+    @staticmethod
+    def __RuleSectionCouldHaveString(SectionType):
         if SectionType in ("UI", "VERSION"):
             return True
         else:
diff --git a/BaseTools/Source/Python/GenFds/FdfParser.py b/BaseTools/Source/Python/GenFds/FdfParser.py
index 9cdee358d24e..8945e3e2b1cc 100644
--- a/BaseTools/Source/Python/GenFds/FdfParser.py
+++ b/BaseTools/Source/Python/GenFds/FdfParser.py
@@ -704,7 +704,8 @@ class FdfParser:
         # Preprocess done.
         self.Rewind()
         
-    def __GetIfListCurrentItemStat(self, IfList):
+    @staticmethod
+    def __GetIfListCurrentItemStat(IfList):
         if len(IfList) == 0:
             return True
         
@@ -2628,13 +2629,12 @@ class FdfParser:
     #
     #   Check whether reloc strip flag can be set for a file type.
     #
-    #   @param  self        The object pointer
     #   @param  FileType    The file type to check with
     #   @retval True        This type could have relocation strip flag
     #   @retval False       No way to have it
     #
-
-    def __FileCouldHaveRelocFlag (self, FileType):
+    @staticmethod
+    def __FileCouldHaveRelocFlag (FileType):
         if FileType in ('SEC', 'PEI_CORE', 'PEIM', 'PEI_DXE_COMBO'):
             return True
         else:
@@ -2644,13 +2644,12 @@ class FdfParser:
     #
     #   Check whether reloc strip flag can be set for a section type.
     #
-    #   @param  self        The object pointer
     #   @param  SectionType The section type to check with
     #   @retval True        This type could have relocation strip flag
     #   @retval False       No way to have it
     #
-
-    def __SectionCouldHaveRelocFlag (self, SectionType):
+    @staticmethod
+    def __SectionCouldHaveRelocFlag (SectionType):
         if SectionType in ('TE', 'PE32'):
             return True
         else:
@@ -3991,12 +3990,12 @@ class FdfParser:
     #
     #   Get whether a section could be optional
     #
-    #   @param  self        The object pointer
     #   @param  SectionType The section type to check
     #   @retval True        section could be optional
     #   @retval False       section never optional
     #
-    def __RuleSectionCouldBeOptional(self, SectionType):
+    @staticmethod
+    def __RuleSectionCouldBeOptional(SectionType):
         if SectionType in ("DXE_DEPEX", "UI", "VERSION", "PEI_DEPEX", "RAW", "SMM_DEPEX"):
             return True
         else:
@@ -4006,12 +4005,12 @@ class FdfParser:
     #
     #   Get whether a section could have build number information
     #
-    #   @param  self        The object pointer
     #   @param  SectionType The section type to check
     #   @retval True        section could have build number information
     #   @retval False       section never have build number information
     #
-    def __RuleSectionCouldHaveBuildNum(self, SectionType):
+    @staticmethod
+    def __RuleSectionCouldHaveBuildNum(SectionType):
         if SectionType in ("VERSION"):
             return True
         else:
@@ -4021,12 +4020,12 @@ class FdfParser:
     #
     #   Get whether a section could have string
     #
-    #   @param  self        The object pointer
     #   @param  SectionType The section type to check
     #   @retval True        section could have string
     #   @retval False       section never have string
     #
-    def __RuleSectionCouldHaveString(self, SectionType):
+    @staticmethod
+    def __RuleSectionCouldHaveString(SectionType):
         if SectionType in ("UI", "VERSION"):
             return True
         else:
-- 
2.16.2.windows.1



  parent reply	other threads:[~2018-03-30  0:12 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-30  0:19 [PATCH v1 0/4] BaseTools: remove un-needed code Jaben Carsey
2018-03-30  0:19 ` [PATCH v1 1/4] BaseTools: change hex parsing to use built in Jaben Carsey
2018-03-30  0:19 ` [PATCH v1 2/4] BaseTools: remove uncalled function Jaben Carsey
2018-03-30  0:19 ` Jaben Carsey [this message]
2018-03-30  0:19 ` [PATCH v1 4/4] BaseTools: remove uncalled functions Jaben Carsey
2018-04-03  9:26 ` [PATCH v1 0/4] BaseTools: remove un-needed code 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=a3ed8e64075256c7d0b1e8a80627d8940dfee722.1522369073.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