From 7402bd06cfa88a93a416a1edff7e7f9283ee18ed Mon Sep 17 00:00:00 2001 From: Pierre Gondois Date: Wed, 30 Apr 2025 14:35:54 +0200 Subject: BaseTools: Ecc: Remove unnecessary code Running the vulture tool on the Ecc folder gave the following report. Remove the unnecessary code. - Ecc/c.py:52: unused function 'GetConfig' (60% confidence) - Ecc/c.py:484: unused function 'GetFileModificationTimeFromDB' (60% confidence) - Ecc/CodeFragmentCollector.py:77: unused attribute '__Token' (60% confidence) - Ecc/CodeFragmentCollector.py:78: unused attribute '__SkippedChars' (60% confidence) - Ecc/CodeFragmentCollector.py:109: unused method '__EndOfLine' (60% confidence) - Ecc/CodeFragmentCollector.py:134: unused method '__UndoOneChar' (60% confidence) - Ecc/CodeFragmentCollector.py:221: unused method '__InsertComma' (60% confidence) - Ecc/CodeFragmentCollector.py:539: unused method 'PrintFragments' (60% confidence) - Ecc/Database.py:81: unused attribute 'text_factory' (60% confidence) - Ecc/Database.py:214: unused method 'UpdateIdentifierBelongsToFunction_disabled' (60% confidence) - Ecc/MetaFileWorkspace/MetaDataTable.py:142: unused method 'IsIntegral' (60% confidence) - Ecc/MetaFileWorkspace/MetaDataTable.py:205: unused method 'GetCrossIndex' (60% confidence) - Ecc/Xml/XmlRoutines.py:145: unused function 'XmlElementData' (60% confidence) - Ecc/Xml/XmlRoutines.py:162: unused function 'XmlElementList' (60% confidence) - Ecc/Xml/XmlRoutines.py:192: unused function 'XmlNodeName' (60% confidence) Signed-off-by: Pierre Gondois --- BaseTools/Source/Python/Ecc/Database.py | 54 --------------------------------- 1 file changed, 54 deletions(-) (limited to 'BaseTools/Source/Python/Ecc/Database.py') diff --git a/BaseTools/Source/Python/Ecc/Database.py b/BaseTools/Source/Python/Ecc/Database.py index a5b70c5202..f31dd933e8 100644 --- a/BaseTools/Source/Python/Ecc/Database.py +++ b/BaseTools/Source/Python/Ecc/Database.py @@ -78,7 +78,6 @@ class Database(object): self.Conn.execute("PRAGMA page_size=4096") self.Conn.execute("PRAGMA synchronous=OFF") # to avoid non-ascii character conversion error - self.Conn.text_factory = str self.Cur = self.Conn.cursor() self.TblDataModel = TableDataModel(self.Cur) @@ -206,59 +205,6 @@ class Database(object): EdkLogger.verbose("Insert information from file %s ... DONE!" % File.FullPath) - ## UpdateIdentifierBelongsToFunction - # - # Update the field "BelongsToFunction" for each Identifier - # - # - def UpdateIdentifierBelongsToFunction_disabled(self): - EdkLogger.verbose("Update 'BelongsToFunction' for Identifiers started ...") - - SqlCommand = """select ID, BelongsToFile, StartLine, EndLine, Model from Identifier""" - EdkLogger.debug(4, "SqlCommand: %s" %SqlCommand) - self.Cur.execute(SqlCommand) - Records = self.Cur.fetchall() - for Record in Records: - IdentifierID = Record[0] - BelongsToFile = Record[1] - StartLine = Record[2] - EndLine = Record[3] - Model = Record[4] - - # - # Check whether an identifier belongs to a function - # - EdkLogger.debug(4, "For common identifiers ... ") - SqlCommand = """select ID from Function - where StartLine < %s and EndLine > %s - and BelongsToFile = %s""" % (StartLine, EndLine, BelongsToFile) - EdkLogger.debug(4, "SqlCommand: %s" %SqlCommand) - self.Cur.execute(SqlCommand) - IDs = self.Cur.fetchall() - for ID in IDs: - SqlCommand = """Update Identifier set BelongsToFunction = %s where ID = %s""" % (ID[0], IdentifierID) - EdkLogger.debug(4, "SqlCommand: %s" %SqlCommand) - self.Cur.execute(SqlCommand) - - # - # Check whether the identifier is a function header - # - EdkLogger.debug(4, "For function headers ... ") - if Model == DataClass.MODEL_IDENTIFIER_COMMENT: - SqlCommand = """select ID from Function - where StartLine = %s + 1 - and BelongsToFile = %s""" % (EndLine, BelongsToFile) - EdkLogger.debug(4, "SqlCommand: %s" %SqlCommand) - self.Cur.execute(SqlCommand) - IDs = self.Cur.fetchall() - for ID in IDs: - SqlCommand = """Update Identifier set BelongsToFunction = %s, Model = %s where ID = %s""" % (ID[0], DataClass.MODEL_IDENTIFIER_FUNCTION_HEADER, IdentifierID) - EdkLogger.debug(4, "SqlCommand: %s" %SqlCommand) - self.Cur.execute(SqlCommand) - - EdkLogger.verbose("Update 'BelongsToFunction' for Identifiers ... DONE") - - ## UpdateIdentifierBelongsToFunction # # Update the field "BelongsToFunction" for each Identifier -- cgit v1.2.3