summaryrefslogtreecommitdiffstats
path: root/BaseTools/Source/Python/Ecc/c.py
diff options
context:
space:
mode:
authorCarsey, Jaben </o=Intel/ou=Americas01/cn=Workers/cn=Carsey, Jaben>2018-03-27 04:25:43 +0800
committerYonghong Zhu <yonghong.zhu@intel.com>2018-03-30 08:25:13 +0800
commit4231a8193ec0d52df7e0a101d96c51b1a2b7a996 (patch)
tree4fc8e46c9d51a4938e891e6b029781f1b66537ae /BaseTools/Source/Python/Ecc/c.py
parent05a32984ab799a564e2eeb7dff128fe0992910d8 (diff)
downloadedk2-4231a8193ec0d52df7e0a101d96c51b1a2b7a996.tar.gz
edk2-4231a8193ec0d52df7e0a101d96c51b1a2b7a996.tar.bz2
edk2-4231a8193ec0d52df7e0a101d96c51b1a2b7a996.zip
BaseTools: Remove equality operator with None
replace "== None" with "is None" and "!= None" with "is not None" Cc: Yonghong Zhu <yonghong.zhu@intel.com> Cc: Liming Gao <liming.gao@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Jaben Carsey <jaben.carsey@intel.com> Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
Diffstat (limited to 'BaseTools/Source/Python/Ecc/c.py')
-rw-r--r--BaseTools/Source/Python/Ecc/c.py62
1 files changed, 31 insertions, 31 deletions
diff --git a/BaseTools/Source/Python/Ecc/c.py b/BaseTools/Source/Python/Ecc/c.py
index 39a9d8ac36..175e2d2e04 100644
--- a/BaseTools/Source/Python/Ecc/c.py
+++ b/BaseTools/Source/Python/Ecc/c.py
@@ -550,7 +550,7 @@ def CollectSourceCodeDataIntoDB(RootDir):
Db.UpdateIdentifierBelongsToFunction()
def GetTableID(FullFileName, ErrorMsgList=None):
- if ErrorMsgList == None:
+ if ErrorMsgList is None:
ErrorMsgList = []
Db = GetDB()
@@ -575,7 +575,7 @@ def GetIncludeFileList(FullFileName):
if os.path.splitext(FullFileName)[1].upper() not in ('.H'):
return []
IFList = IncludeFileListDict.get(FullFileName)
- if IFList != None:
+ if IFList is not None:
return IFList
FileID = GetTableID(FullFileName)
@@ -601,12 +601,12 @@ def GetFullPathOfIncludeFile(Str, IncludePathList):
return None
def GetAllIncludeFiles(FullFileName):
- if AllIncludeFileListDict.get(FullFileName) != None:
+ if AllIncludeFileListDict.get(FullFileName) is not None:
return AllIncludeFileListDict.get(FullFileName)
FileDirName = os.path.dirname(FullFileName)
IncludePathList = IncludePathListDict.get(FileDirName)
- if IncludePathList == None:
+ if IncludePathList is None:
IncludePathList = MetaDataParser.GetIncludeListOfFile(EccGlobalData.gWorkspace, FullFileName, GetDB())
if FileDirName not in IncludePathList:
IncludePathList.insert(0, FileDirName)
@@ -618,7 +618,7 @@ def GetAllIncludeFiles(FullFileName):
FileName = FileName.strip('\"')
FileName = FileName.lstrip('<').rstrip('>').strip()
FullPath = GetFullPathOfIncludeFile(FileName, IncludePathList)
- if FullPath != None:
+ if FullPath is not None:
IncludeFileQueue.append(FullPath)
i = 0
@@ -629,7 +629,7 @@ def GetAllIncludeFiles(FullFileName):
FileName = FileName.strip('\"')
FileName = FileName.lstrip('<').rstrip('>').strip()
FullPath = GetFullPathOfIncludeFile(FileName, IncludePathList)
- if FullPath != None and FullPath not in IncludeFileQueue:
+ if FullPath is not None and FullPath not in IncludeFileQueue:
IncludeFileQueue.insert(i + 1, FullPath)
i += 1
@@ -853,7 +853,7 @@ def DiffModifier(Str1, Str2):
def GetTypedefDict(FullFileName):
Dict = ComplexTypeDict.get(FullFileName)
- if Dict != None:
+ if Dict is not None:
return Dict
FileID = GetTableID(FullFileName)
@@ -898,7 +898,7 @@ def GetTypedefDict(FullFileName):
def GetSUDict(FullFileName):
Dict = SUDict.get(FullFileName)
- if Dict != None:
+ if Dict is not None:
return Dict
FileID = GetTableID(FullFileName)
@@ -983,9 +983,9 @@ def StripComments(Str):
def GetFinalTypeValue(Type, FieldName, TypedefDict, SUDict):
Value = TypedefDict.get(Type)
- if Value == None:
+ if Value is None:
Value = SUDict.get(Type)
- if Value == None:
+ if Value is None:
return None
LBPos = Value.find('{')
@@ -994,11 +994,11 @@ def GetFinalTypeValue(Type, FieldName, TypedefDict, SUDict):
for FT in FTList:
if FT not in ('struct', 'union'):
Value = TypedefDict.get(FT)
- if Value == None:
+ if Value is None:
Value = SUDict.get(FT)
break
- if Value == None:
+ if Value is None:
return None
LBPos = Value.find('{')
@@ -1025,11 +1025,11 @@ def GetFinalTypeValue(Type, FieldName, TypedefDict, SUDict):
return None
def GetRealType(Type, TypedefDict, TargetType=None):
- if TargetType != None and Type == TargetType:
+ if TargetType is not None and Type == TargetType:
return Type
while TypedefDict.get(Type):
Type = TypedefDict.get(Type)
- if TargetType != None and Type == TargetType:
+ if TargetType is not None and Type == TargetType:
return Type
return Type
@@ -1043,10 +1043,10 @@ def GetTypeInfo(RefList, Modifier, FullFileName, TargetType=None):
while Index < len(RefList):
FieldName = RefList[Index]
FromType = GetFinalTypeValue(Type, FieldName, TypedefDict, SUDict)
- if FromType == None:
+ if FromType is None:
return None
# we want to determine the exact type.
- if TargetType != None:
+ if TargetType is not None:
Type = FromType.split()[0]
# we only want to check if it is a pointer
else:
@@ -1151,7 +1151,7 @@ def GetVarInfo(PredVarList, FuncRecord, FullFileName, IsFuncCall=False, TargetTy
# Type = GetDataTypeFromModifier(Result[0]).split()[-1]
TypeList = GetDataTypeFromModifier(Result[0]).split()
Type = TypeList[-1]
- if len(TypeList) > 1 and StarList != None:
+ if len(TypeList) > 1 and StarList is not None:
for Star in StarList:
Type = Type.strip()
Type = Type.rstrip(Star)
@@ -1174,7 +1174,7 @@ def GetVarInfo(PredVarList, FuncRecord, FullFileName, IsFuncCall=False, TargetTy
Type = TypeList[-1]
if Type == '*' and len(TypeList) >= 2:
Type = TypeList[-2]
- if len(TypeList) > 1 and StarList != None:
+ if len(TypeList) > 1 and StarList is not None:
for Star in StarList:
Type = Type.strip()
Type = Type.rstrip(Star)
@@ -1199,7 +1199,7 @@ def GetVarInfo(PredVarList, FuncRecord, FullFileName, IsFuncCall=False, TargetTy
else:
TypeList = GetDataTypeFromModifier(Result[0]).split()
Type = TypeList[-1]
- if len(TypeList) > 1 and StarList != None:
+ if len(TypeList) > 1 and StarList is not None:
for Star in StarList:
Type = Type.strip()
Type = Type.rstrip(Star)
@@ -1230,7 +1230,7 @@ def GetVarInfo(PredVarList, FuncRecord, FullFileName, IsFuncCall=False, TargetTy
else:
TypeList = GetDataTypeFromModifier(Result[0]).split()
Type = TypeList[-1]
- if len(TypeList) > 1 and StarList != None:
+ if len(TypeList) > 1 and StarList is not None:
for Star in StarList:
Type = Type.strip()
Type = Type.rstrip(Star)
@@ -1939,12 +1939,12 @@ def CheckPointerNullComparison(FullFileName):
p = GetFuncDeclPattern()
for Str in PSL:
FuncRecord = GetFuncContainsPE(Str[1], FL)
- if FuncRecord == None:
+ if FuncRecord is None:
continue
for Exp in GetPredicateListFromPredicateExpStr(Str[0]):
PredInfo = SplitPredicateStr(Exp)
- if PredInfo[1] == None:
+ if PredInfo[1] is None:
PredVarStr = PredInfo[0][0].strip()
IsFuncCall = False
SearchInCache = False
@@ -1966,7 +1966,7 @@ def CheckPointerNullComparison(FullFileName):
continue
if SearchInCache:
Type = FuncReturnTypeDict.get(PredVarStr)
- if Type != None:
+ if Type is not None:
if Type.find('*') != -1 and Type != 'BOOLEAN*':
PrintErrorMsg(ERROR_PREDICATE_EXPRESSION_CHECK_COMPARISON_NULL_TYPE, 'Predicate Expression: %s' % Exp, FileTable, Str[2])
continue
@@ -1977,7 +1977,7 @@ def CheckPointerNullComparison(FullFileName):
Type = GetVarInfo(PredVarList, FuncRecord, FullFileName, IsFuncCall, None, StarList)
if SearchInCache:
FuncReturnTypeDict[PredVarStr] = Type
- if Type == None:
+ if Type is None:
continue
Type = GetTypeFromArray(Type, PredVarStr)
if Type.find('*') != -1 and Type != 'BOOLEAN*':
@@ -2018,12 +2018,12 @@ def CheckNonBooleanValueComparison(FullFileName):
p = GetFuncDeclPattern()
for Str in PSL:
FuncRecord = GetFuncContainsPE(Str[1], FL)
- if FuncRecord == None:
+ if FuncRecord is None:
continue
for Exp in GetPredicateListFromPredicateExpStr(Str[0]):
PredInfo = SplitPredicateStr(Exp)
- if PredInfo[1] == None:
+ if PredInfo[1] is None:
PredVarStr = PredInfo[0][0].strip()
IsFuncCall = False
SearchInCache = False
@@ -2046,7 +2046,7 @@ def CheckNonBooleanValueComparison(FullFileName):
if SearchInCache:
Type = FuncReturnTypeDict.get(PredVarStr)
- if Type != None:
+ if Type is not None:
if Type.find('BOOLEAN') == -1:
PrintErrorMsg(ERROR_PREDICATE_EXPRESSION_CHECK_NO_BOOLEAN_OPERATOR, 'Predicate Expression: %s' % Exp, FileTable, Str[2])
continue
@@ -2056,7 +2056,7 @@ def CheckNonBooleanValueComparison(FullFileName):
Type = GetVarInfo(PredVarList, FuncRecord, FullFileName, IsFuncCall, 'BOOLEAN', StarList)
if SearchInCache:
FuncReturnTypeDict[PredVarStr] = Type
- if Type == None:
+ if Type is None:
continue
if Type.find('BOOLEAN') == -1:
PrintErrorMsg(ERROR_PREDICATE_EXPRESSION_CHECK_NO_BOOLEAN_OPERATOR, 'Predicate Expression: %s' % Exp, FileTable, Str[2])
@@ -2097,7 +2097,7 @@ def CheckBooleanValueComparison(FullFileName):
p = GetFuncDeclPattern()
for Str in PSL:
FuncRecord = GetFuncContainsPE(Str[1], FL)
- if FuncRecord == None:
+ if FuncRecord is None:
continue
for Exp in GetPredicateListFromPredicateExpStr(Str[0]):
@@ -2125,7 +2125,7 @@ def CheckBooleanValueComparison(FullFileName):
if SearchInCache:
Type = FuncReturnTypeDict.get(PredVarStr)
- if Type != None:
+ if Type is not None:
if Type.find('BOOLEAN') != -1:
PrintErrorMsg(ERROR_PREDICATE_EXPRESSION_CHECK_BOOLEAN_VALUE, 'Predicate Expression: %s' % Exp, FileTable, Str[2])
continue
@@ -2136,7 +2136,7 @@ def CheckBooleanValueComparison(FullFileName):
Type = GetVarInfo(PredVarList, FuncRecord, FullFileName, IsFuncCall, 'BOOLEAN', StarList)
if SearchInCache:
FuncReturnTypeDict[PredVarStr] = Type
- if Type == None:
+ if Type is None:
continue
if Type.find('BOOLEAN') != -1:
PrintErrorMsg(ERROR_PREDICATE_EXPRESSION_CHECK_BOOLEAN_VALUE, 'Predicate Expression: %s' % Exp, FileTable, Str[2])