diff options
author | Pierre Gondois <pierre.gondois@arm.com> | 2025-04-30 16:01:27 +0300 |
---|---|---|
committer | Liming Gao <gaoliming@byosoft.com.cn> | 2025-07-01 04:51:38 +0300 |
commit | 70d53c2df096d1789061f21b56cba34558a0c46d (patch) | |
tree | 5115e2617c0faedc455ffeeee1f57ab1aa5c7531 /BaseTools/Source/Python/UPT/Library/ParserValidate.py | |
parent | 5c558ce5f3631521a790ee8d30de3f4ffcd16f1a (diff) | |
download | edk2-70d53c2df096d1789061f21b56cba34558a0c46d.tar.xz |
BaseTools: UPT/Library: Remove unnecessary code
Running the vulture tool on the UPT/Library folder gave the following
report. Remove the unnecessary code.
- UPT/Library/CommentGenerating.py:50:
unused function 'GenGenericComment' (60% confidence)
- UPT/Library/CommentGenerating.py:172:
unused function 'GenInfPcdTailComment' (60% confidence)
- UPT/Library/CommentGenerating.py:185:
unused function 'GenInfProtocolPPITailComment' (60% confidence)
- UPT/Library/CommentGenerating.py:203:
unused function 'GenInfGuidTailComment' (60% confidence)
- UPT/Library/Misc.py:504:
unused class 'MergeCommentDict' (60% confidence)
- UPT/Library/Misc.py:527:
unused function 'GenDummyHelpTextObj' (60% confidence)
- UPT/Library/ParserValidate.py:110:
unused function 'IsValidInfComponentType' (60% confidence)
- UPT/Library/ParserValidate.py:122:
unused function 'IsValidToolFamily' (60% confidence)
- UPT/Library/ParserValidate.py:134:
unused function 'IsValidToolTagName' (60% confidence)
- UPT/Library/ParserValidate.py:465:
unused function 'IsValidBuildNumber' (60% confidence)
- UPT/Library/ParserValidate.py:478:
unused function 'IsValidDepex' (60% confidence)
- UPT/Library/ParserValidate.py:546:
unused function 'IsValidVersionString' (60% confidence)
- UPT/Library/ParserValidate.py:721:
unused function 'CheckUTF16FileHeader' (60% confidence)
- UPT/Library/Parsing.py:52:
unused function 'GetBuildOption' (60% confidence)
- UPT/Library/Parsing.py:100:
unused function 'GetLibraryClassOfInf' (60% confidence)
- UPT/Library/Parsing.py:150:
unused function 'GetPcd' (60% confidence)
- UPT/Library/Parsing.py:177:
unused function 'GetFeatureFlagPcd' (60% confidence)
- UPT/Library/Parsing.py:201:
unused function 'GetDynamicDefaultPcd' (60% confidence)
- UPT/Library/Parsing.py:227:
unused function 'GetDynamicHiiPcd' (60% confidence)
- UPT/Library/Parsing.py:254:
unused function 'GetDynamicVpdPcd' (60% confidence)
- UPT/Library/Parsing.py:277:
unused function 'GetComponent' (60% confidence)
- UPT/Library/Parsing.py:392:
unused function 'GetExec' (60% confidence)
- UPT/Library/Parsing.py:416:
unused function 'GetComponents' (60% confidence)
- UPT/Library/Parsing.py:532:
unused function 'GetSource' (60% confidence)
- UPT/Library/Parsing.py:581:
unused function 'GetGuidsProtocolsPpisOfInf' (60% confidence)
- UPT/Library/Parsing.py:595:
unused function 'GetGuidsProtocolsPpisOfDec' (60% confidence)
- UPT/Library/Parsing.py:645:
unused function 'GetPcdOfInf' (60% confidence)
- UPT/Library/Parsing.py:682:
unused function 'GetPcdOfDec' (60% confidence)
- UPT/Library/Parsing.py:739:
unused function 'InsertSectionItems' (60% confidence)
- UPT/Library/Parsing.py:776:
unused function 'GenMetaDatSectionItem' (60% confidence)
- UPT/Library/StringUtils.py:87:
unused function 'GetLibraryClassesWithModuleType' (60% confidence)
- UPT/Library/StringUtils.py:107:
unused function 'GetDynamics' (60% confidence)
- UPT/Library/StringUtils.py:350:
unused function 'GetMultipleValuesOfKeyFromLines' (60% confidence)
- UPT/Library/StringUtils.py:396:
unused function 'GetSingleValueOfKeyFromLines' (60% confidence)
- UPT/Library/StringUtils.py:463:
unused function 'PreCheck' (60% confidence)
- UPT/Library/StringUtils.py:675:
unused function 'StringArrayLength' (60% confidence)
- UPT/Library/StringUtils.py:718:
unused function 'IsHexDigit' (60% confidence)
- UPT/Library/UniClassObject.py:86:
unused function 'UniToStr' (60% confidence)
- UPT/Library/UniClassObject.py:227:
unused attribute 'StringNameByteList' (60% confidence)
- UPT/Library/UniClassObject.py:237:
unused attribute 'StringNameByteList' (60% confidence)
- UPT/Library/UniClassObject.py:377:
unused method 'GetIncludeFile' (60% confidence)
- UPT/Library/UniClassObject.py:947:
unused method 'FindStringValue' (60% confidence)
- UPT/Library/UniClassObject.py:957:
unused method 'FindByToken' (60% confidence)
- UPT/Library/UniClassObject.py:1022:
unused method 'ReadIncludeUNIfile' (60% confidence)
- UPT/Library/StringUtils.py:718:
unused function 'IsHexDigit' (60% confidence)
- UPT/Library/Xml/XmlRoutines.py:176:
unused function 'XmlElementList' (60% confidence)
- UPT/Library/Xml/XmlRoutines.py:202:
unused function 'XmlNodeName' (60% confidence)
Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
Diffstat (limited to 'BaseTools/Source/Python/UPT/Library/ParserValidate.py')
-rw-r--r-- | BaseTools/Source/Python/UPT/Library/ParserValidate.py | 97 |
1 files changed, 0 insertions, 97 deletions
diff --git a/BaseTools/Source/Python/UPT/Library/ParserValidate.py b/BaseTools/Source/Python/UPT/Library/ParserValidate.py index edb0c6275a..cfa51e7a3c 100644 --- a/BaseTools/Source/Python/UPT/Library/ParserValidate.py +++ b/BaseTools/Source/Python/UPT/Library/ParserValidate.py @@ -103,43 +103,6 @@ def IsValidInfMoudleType(ModuleType): else:
return False
-## Is Valid Component Type or not
-#
-# @param ComponentType: A string contain ComponentType need to be judged.
-#
-def IsValidInfComponentType(ComponentType):
- if ComponentType.upper() in COMPONENT_TYPE_LIST:
- return True
- else:
- return False
-
-
-## Is valid Tool Family or not
-#
-# @param ToolFamily: A string contain Tool Family need to be judged.
-# Family := [A-Z]([a-zA-Z0-9])*
-#
-def IsValidToolFamily(ToolFamily):
- ReIsValidFamily = re.compile(r"^[A-Z]+[A-Za-z0-9]{0,}$", re.DOTALL)
- if ReIsValidFamily.match(ToolFamily) is None:
- return False
- return True
-
-## Is valid Tool TagName or not
-#
-# The TagName sample is MYTOOLS and VS2005.
-#
-# @param TagName: A string contain Tool TagName need to be judged.
-#
-def IsValidToolTagName(TagName):
- if TagName.strip() == '':
- return True
- if TagName.strip() == '*':
- return True
- if not IsValidWord(TagName):
- return False
- return True
-
## Is valid arch or not
#
# @param Arch The arch string need to be validated
@@ -455,37 +418,6 @@ def IsValidHexVersion(Word): return True
-## IsValidBuildNumber
-#
-# Check whether the BUILD_NUMBER is valid.
-# ["BUILD_NUMBER" "=" <Integer>{1,4} <EOL>]
-#
-# @param Word: The BUILD_NUMBER string need to be checked.
-#
-def IsValidBuildNumber(Word):
- ReIsValieBuildNumber = re.compile(r"[0-9]{1,4}$", re.DOTALL)
- if ReIsValieBuildNumber.match(Word) is None:
- return False
-
- return True
-
-## IsValidDepex
-#
-# Check whether the Depex is valid.
-#
-# @param Word: The Depex string need to be checked.
-#
-def IsValidDepex(Word):
- Index = Word.upper().find("PUSH")
- if Index > -1:
- return IsValidCFormatGuid(Word[Index+4:].strip())
-
- ReIsValidCName = re.compile(r"^[A-Za-z_][0-9A-Za-z_\s\.]*$", re.DOTALL)
- if ReIsValidCName.match(Word) is None:
- return False
-
- return True
-
## IsValidNormalizedString
#
# Check
@@ -532,25 +464,6 @@ def IsValidIdString(String): return False
-## IsValidVersionString
-#
-# Check whether the VersionString is valid.
-# <AsciiString> ::= [ [<WhiteSpace>]{0,} [<AsciiChars>]{0,} ] {0,}
-# <WhiteSpace> ::= {<Tab>} {<Space>}
-# <Tab> ::= 0x09
-# <Space> ::= 0x20
-# <AsciiChars> ::= (0x21 - 0x7E)
-#
-# @param VersionString: The VersionString need to be checked.
-#
-def IsValidVersionString(VersionString):
- VersionString = VersionString.strip()
- for Char in VersionString:
- if not (Char >= 0x21 and Char <= 0x7E):
- return False
-
- return True
-
## IsValidPcdValue
#
# Check whether the PcdValue is valid.
@@ -714,13 +627,3 @@ def IsValidUserId(UserId): if Char == '.' and not Quoted:
return False
return True
-
-#
-# Check if a UTF16-LE file has a BOM header
-#
-def CheckUTF16FileHeader(File):
- FileIn = open(File, 'rb').read(2)
- if FileIn != b'\xff\xfe':
- return False
-
- return True
|