diff options
author | Pierre Gondois <pierre.gondois@arm.com> | 2025-04-30 15:40:15 +0300 |
---|---|---|
committer | Liming Gao <gaoliming@byosoft.com.cn> | 2025-07-01 04:51:38 +0300 |
commit | 3c2f04a3c7e2058f7f0b784f365aa39e52237b44 (patch) | |
tree | 5a5274db946e34291bb503139e74ff8c056d4722 /BaseTools/Source/Python/Eot/CodeFragmentCollector.py | |
parent | 7402bd06cfa88a93a416a1edff7e7f9283ee18ed (diff) | |
download | edk2-3c2f04a3c7e2058f7f0b784f365aa39e52237b44.tar.xz |
BaseTools: Eot: Remove unnecessary code
Running the vulture tool on the Eot folder gave the following
report. Remove the unnecessary code.
- Eot/CodeFragment.py:47:
unused class 'AssignmentExpression' (60% confidence)
- Eot/CodeFragmentCollector.py:75:
unused attribute '__Token' (60% confidence)
- Eot/CodeFragmentCollector.py:76:
unused attribute '__SkippedChars' (60% confidence)
- Eot/CodeFragmentCollector.py:104:
unused method '__EndOfLine' (60% confidence)
- Eot/CodeFragmentCollector.py:129:
unused method '__UndoOneChar' (60% confidence)
- Eot/CodeFragmentCollector.py:215:
unused method '__InsertComma' (60% confidence)
- Eot/Database.py:81:
unused attribute 'text_factory' (60% confidence)
- Eot/EotMain.py:1012:
unused method 'SetFreeSpace' (60% confidence)
- Eot/Identification.py:36:
unused method 'GetFileFullPath' (60% confidence)
- Eot/Identification.py:43:
unused method 'GetFileRelativePath' (60% confidence)
- Eot/Parser.py:119:
unused function 'AddToGlobalMacro' (60% confidence)
- Eot/Parser.py:238:
unused function 'GetAllSourceFiles' (60% confidence)
- Eot/Parser.py:257:
unused function 'ParseConditionalStatementMacros' (60% confidence)
- Eot/Parser.py:267:
unused function 'GetAllFiles' (60% confidence)
- Eot/Parser.py:291:
unused function 'ParseConditionalStatement' (60% confidence)
- Eot/Parser.py:367:
unused function 'GetConditionalStatementStatus' (60% confidence)
- Eot/Parser.py:722:
unused function 'ConvertGuid' (60% confidence)
- Eot/Parser.py:857:
unused function 'ConvertGuid2' (60% confidence)
- Eot/Report.py:161:
unused method 'GeneratePpi' (60% confidence)
- Eot/Report.py:173:
unused method 'GenerateProtocol' (60% confidence)
Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
Diffstat (limited to 'BaseTools/Source/Python/Eot/CodeFragmentCollector.py')
-rw-r--r-- | BaseTools/Source/Python/Eot/CodeFragmentCollector.py | 63 |
1 files changed, 0 insertions, 63 deletions
diff --git a/BaseTools/Source/Python/Eot/CodeFragmentCollector.py b/BaseTools/Source/Python/Eot/CodeFragmentCollector.py index a5c1ceeaea..a6827c0ce1 100644 --- a/BaseTools/Source/Python/Eot/CodeFragmentCollector.py +++ b/BaseTools/Source/Python/Eot/CodeFragmentCollector.py @@ -72,9 +72,6 @@ class CodeFragmentCollector: self.CurrentLineNumber = 1
self.CurrentOffsetWithinLine = 0
- self.__Token = ""
- self.__SkippedChars = ""
-
## __EndOfFile() method
#
# Judge current buffer pos is at file end
@@ -93,21 +90,6 @@ class CodeFragmentCollector: else:
return False
- ## __EndOfLine() method
- #
- # Judge current buffer pos is at line end
- #
- # @param self The object pointer
- # @retval True Current File buffer position is at line end
- # @retval False Current File buffer position is NOT at line end
- #
- def __EndOfLine(self):
- SizeOfCurrentLine = len(self.Profile.FileLinesList[self.CurrentLineNumber - 1])
- if self.CurrentOffsetWithinLine >= SizeOfCurrentLine - 1:
- return True
- else:
- return False
-
## Rewind() method
#
# Reset file data buffer to the initial state
@@ -118,25 +100,6 @@ class CodeFragmentCollector: self.CurrentLineNumber = 1
self.CurrentOffsetWithinLine = 0
- ## __UndoOneChar() method
- #
- # Go back one char in the file buffer
- #
- # @param self The object pointer
- # @retval True Successfully go back one char
- # @retval False Not able to go back one char as file beginning reached
- #
- def __UndoOneChar(self):
-
- if self.CurrentLineNumber == 1 and self.CurrentOffsetWithinLine == 0:
- return False
- elif self.CurrentOffsetWithinLine == 0:
- self.CurrentLineNumber -= 1
- self.CurrentOffsetWithinLine = len(self.__CurrentLine()) - 1
- else:
- self.CurrentOffsetWithinLine -= 1
- return True
-
## __GetOneChar() method
#
# Move forward one char in the file buffer
@@ -205,32 +168,6 @@ class CodeFragmentCollector: def __CurrentLine(self):
return self.Profile.FileLinesList[self.CurrentLineNumber - 1]
- ## __InsertComma() method
- #
- # Insert ',' to replace PP
- #
- # @param self The object pointer
- # @retval List current line contents
- #
- def __InsertComma(self, Line):
-
-
- if self.Profile.FileLinesList[Line - 1][0] != T_CHAR_HASH:
- BeforeHashPart = str(self.Profile.FileLinesList[Line - 1]).split(T_CHAR_HASH)[0]
- if BeforeHashPart.rstrip().endswith(T_CHAR_COMMA) or BeforeHashPart.rstrip().endswith(';'):
- return
-
- if Line - 2 >= 0 and str(self.Profile.FileLinesList[Line - 2]).rstrip().endswith(','):
- return
-
- if Line - 2 >= 0 and str(self.Profile.FileLinesList[Line - 2]).rstrip().endswith(';'):
- return
-
- if str(self.Profile.FileLinesList[Line]).lstrip().startswith(',') or str(self.Profile.FileLinesList[Line]).lstrip().startswith(';'):
- return
-
- self.Profile.FileLinesList[Line - 1].insert(self.CurrentOffsetWithinLine, ',')
-
## PreprocessFileWithClear() method
#
# Run a preprocess for the file to clean all comments
|