summaryrefslogtreecommitdiffstats
path: root/BaseTools/Source/Python/Ecc
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
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')
-rw-r--r--BaseTools/Source/Python/Ecc/CParser.py12
-rw-r--r--BaseTools/Source/Python/Ecc/Check.py2
-rw-r--r--BaseTools/Source/Python/Ecc/CodeFragmentCollector.py4
-rw-r--r--BaseTools/Source/Python/Ecc/Ecc.py30
-rw-r--r--BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaDataTable.py4
-rw-r--r--BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaFileParser.py12
-rw-r--r--BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaFileTable.py14
-rw-r--r--BaseTools/Source/Python/Ecc/Xml/XmlRoutines.py10
-rw-r--r--BaseTools/Source/Python/Ecc/c.py62
9 files changed, 75 insertions, 75 deletions
diff --git a/BaseTools/Source/Python/Ecc/CParser.py b/BaseTools/Source/Python/Ecc/CParser.py
index 41f2811430..94711a9a37 100644
--- a/BaseTools/Source/Python/Ecc/CParser.py
+++ b/BaseTools/Source/Python/Ecc/CParser.py
@@ -783,14 +783,14 @@ class CParser(Parser):
if self.backtracking == 0:
- if d != None:
+ if d is not None:
self.function_definition_stack[-1].ModifierText = self.input.toString(d.start,d.stop)
else:
self.function_definition_stack[-1].ModifierText = ''
self.function_definition_stack[-1].DeclText = self.input.toString(declarator1.start,declarator1.stop)
self.function_definition_stack[-1].DeclLine = declarator1.start.line
self.function_definition_stack[-1].DeclOffset = declarator1.start.charPositionInLine
- if a != None:
+ if a is not None:
self.function_definition_stack[-1].LBLine = a.start.line
self.function_definition_stack[-1].LBOffset = a.start.charPositionInLine
else:
@@ -920,7 +920,7 @@ class CParser(Parser):
return
if self.backtracking == 0:
- if b != None:
+ if b is not None:
self.StoreTypedefDefinition(a.line, a.charPositionInLine, d.line, d.charPositionInLine, self.input.toString(b.start,b.stop), self.input.toString(c.start,c.stop))
else:
self.StoreTypedefDefinition(a.line, a.charPositionInLine, d.line, d.charPositionInLine, '', self.input.toString(c.start,c.stop))
@@ -957,7 +957,7 @@ class CParser(Parser):
return
if self.backtracking == 0:
- if t != None:
+ if t is not None:
self.StoreVariableDeclaration(s.start.line, s.start.charPositionInLine, t.start.line, t.start.charPositionInLine, self.input.toString(s.start,s.stop), self.input.toString(t.start,t.stop))
@@ -1401,7 +1401,7 @@ class CParser(Parser):
return
if self.backtracking == 0:
- if s.stop != None:
+ if s.stop is not None:
self.StoreStructUnionDefinition(s.start.line, s.start.charPositionInLine, s.stop.line, s.stop.charPositionInLine, self.input.toString(s.start,s.stop))
@@ -1416,7 +1416,7 @@ class CParser(Parser):
return
if self.backtracking == 0:
- if e.stop != None:
+ if e.stop is not None:
self.StoreEnumerationDefinition(e.start.line, e.start.charPositionInLine, e.stop.line, e.stop.charPositionInLine, self.input.toString(e.start,e.stop))
diff --git a/BaseTools/Source/Python/Ecc/Check.py b/BaseTools/Source/Python/Ecc/Check.py
index 5864758950..27783e617b 100644
--- a/BaseTools/Source/Python/Ecc/Check.py
+++ b/BaseTools/Source/Python/Ecc/Check.py
@@ -1299,7 +1299,7 @@ class Check(object):
RecordSet = EccGlobalData.gDb.TblFile.Exec(SqlCommand)
for Record in RecordSet:
Name = Record[1].strip()
- if Name != '' and Name != None:
+ if Name != '' and Name is not None:
if Name[0] == '(':
Name = Name[1:Name.find(')')]
if Name.find('(') > -1:
diff --git a/BaseTools/Source/Python/Ecc/CodeFragmentCollector.py b/BaseTools/Source/Python/Ecc/CodeFragmentCollector.py
index 171600feeb..fbe0c41b38 100644
--- a/BaseTools/Source/Python/Ecc/CodeFragmentCollector.py
+++ b/BaseTools/Source/Python/Ecc/CodeFragmentCollector.py
@@ -301,7 +301,7 @@ class CodeFragmentCollector:
InCharLiteral = not InCharLiteral
# meet new line, then no longer in a comment for // and '#'
if self.__CurrentChar() == T_CHAR_LF:
- if HashComment and PPDirectiveObj != None:
+ if HashComment and PPDirectiveObj is not None:
if PPDirectiveObj.Content.rstrip(T_CHAR_CR).endswith(T_CHAR_BACKSLASH):
PPDirectiveObj.Content += T_CHAR_LF
PPExtend = True
@@ -423,7 +423,7 @@ class CodeFragmentCollector:
InCharLiteral = not InCharLiteral
# meet new line, then no longer in a comment for // and '#'
if self.__CurrentChar() == T_CHAR_LF:
- if HashComment and PPDirectiveObj != None:
+ if HashComment and PPDirectiveObj is not None:
if PPDirectiveObj.Content.rstrip(T_CHAR_CR).endswith(T_CHAR_BACKSLASH):
PPDirectiveObj.Content += T_CHAR_LF
PPExtend = True
diff --git a/BaseTools/Source/Python/Ecc/Ecc.py b/BaseTools/Source/Python/Ecc/Ecc.py
index 94f9a427e3..60dfc00260 100644
--- a/BaseTools/Source/Python/Ecc/Ecc.py
+++ b/BaseTools/Source/Python/Ecc/Ecc.py
@@ -178,7 +178,7 @@ class Ecc(object):
self.BuildMetaDataFileDatabase(SpeciDirs)
if self.ScanSourceCode:
EdkLogger.quiet("Building database for Meta Data File Done!")
- if SpeciDirs == None:
+ if SpeciDirs is None:
c.CollectSourceCodeDataIntoDB(EccGlobalData.gTarget)
else:
for specificDir in SpeciDirs:
@@ -195,7 +195,7 @@ class Ecc(object):
#
def BuildMetaDataFileDatabase(self, SpecificDirs = None):
ScanFolders = []
- if SpecificDirs == None:
+ if SpecificDirs is None:
ScanFolders.append(EccGlobalData.gTarget)
else:
for specificDir in SpecificDirs:
@@ -346,15 +346,15 @@ class Ecc(object):
self.SetLogLevel(Options)
# Set other options
- if Options.ConfigFile != None:
+ if Options.ConfigFile is not None:
self.ConfigFile = Options.ConfigFile
- if Options.OutputFile != None:
+ if Options.OutputFile is not None:
self.OutputFile = Options.OutputFile
- if Options.ReportFile != None:
+ if Options.ReportFile is not None:
self.ReportFile = Options.ReportFile
- if Options.ExceptionFile != None:
+ if Options.ExceptionFile is not None:
self.ExceptionFile = Options.ExceptionFile
- if Options.Target != None:
+ if Options.Target is not None:
if not os.path.isdir(Options.Target):
EdkLogger.error("ECC", BuildToolError.OPTION_VALUE_INVALID, ExtraData="Target [%s] does NOT exist" % Options.Target)
else:
@@ -362,15 +362,15 @@ class Ecc(object):
else:
EdkLogger.warn("Ecc", EdkLogger.ECC_ERROR, "The target source tree was not specified, using current WORKSPACE instead!")
EccGlobalData.gTarget = os.path.normpath(os.getenv("WORKSPACE"))
- if Options.keepdatabase != None:
+ if Options.keepdatabase is not None:
self.IsInit = False
- if Options.metadata != None and Options.sourcecode != None:
+ if Options.metadata is not None and Options.sourcecode is not None:
EdkLogger.error("ECC", BuildToolError.OPTION_CONFLICT, ExtraData="-m and -s can't be specified at one time")
- if Options.metadata != None:
+ if Options.metadata is not None:
self.ScanSourceCode = False
- if Options.sourcecode != None:
+ if Options.sourcecode is not None:
self.ScanMetaData = False
- if Options.folders != None:
+ if Options.folders is not None:
self.OnlyScan = True
## SetLogLevel
@@ -380,11 +380,11 @@ class Ecc(object):
# @param Option: The option list including log level setting
#
def SetLogLevel(self, Option):
- if Option.verbose != None:
+ if Option.verbose is not None:
EdkLogger.SetLevel(EdkLogger.VERBOSE)
- elif Option.quiet != None:
+ elif Option.quiet is not None:
EdkLogger.SetLevel(EdkLogger.QUIET)
- elif Option.debug != None:
+ elif Option.debug is not None:
EdkLogger.SetLevel(Option.debug + 1)
else:
EdkLogger.SetLevel(EdkLogger.INFO)
diff --git a/BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaDataTable.py b/BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaDataTable.py
index a27e98c975..6b980150f5 100644
--- a/BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaDataTable.py
+++ b/BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaDataTable.py
@@ -116,7 +116,7 @@ class Table(object):
SqlCommand = """select max(ID) from %s""" % self.Table
Record = self.Cur.execute(SqlCommand).fetchall()
Id = Record[0][0]
- if Id == None:
+ if Id is None:
Id = self.IdBase
return Id
@@ -191,7 +191,7 @@ class TableDataModel(Table):
def InitTable(self):
EdkLogger.verbose("\nInitialize table DataModel started ...")
Count = self.GetCount()
- if Count != None and Count != 0:
+ if Count is not None and Count != 0:
return
for Item in DataClass.MODEL_LIST:
CrossIndex = Item[1]
diff --git a/BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaFileParser.py b/BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaFileParser.py
index ba478f9ecf..34ab586084 100644
--- a/BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaFileParser.py
+++ b/BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaFileParser.py
@@ -228,7 +228,7 @@ class MetaFileParser(object):
self.Start()
# No specific ARCH or Platform given, use raw data
- if self._RawTable and (len(DataInfo) == 1 or DataInfo[1] == None):
+ if self._RawTable and (len(DataInfo) == 1 or DataInfo[1] is None):
return self._RawTable.Query(*DataInfo)
# Do post-process if necessary
@@ -564,7 +564,7 @@ class InfParser(MetaFileParser):
self._ValueList = ['','','']
# parse current line, result will be put in self._ValueList
self._SectionParser[self._SectionType](self)
- if self._ValueList == None or self._ItemType == MODEL_META_DATA_DEFINE:
+ if self._ValueList is None or self._ItemType == MODEL_META_DATA_DEFINE:
self._ItemType = -1
continue
#
@@ -877,7 +877,7 @@ class DscParser(MetaFileParser):
self._ValueList = ['', '', '']
self._SectionParser[SectionType](self)
- if self._ValueList == None:
+ if self._ValueList is None:
continue
#
# Model, Value1, Value2, Value3, Arch, ModuleType, BelongsToItem=-1, BelongsToFile=-1,
@@ -1197,7 +1197,7 @@ class DscParser(MetaFileParser):
File=self._FileWithError, ExtraData=' '.join(self._ValueList),
Line=self._LineIndex+1)
- if self._ValueList == None:
+ if self._ValueList is None:
continue
NewOwner = self._IdMapping.get(Owner, -1)
@@ -1573,7 +1573,7 @@ class DecParser(MetaFileParser):
# section content
self._ValueList = ['','','']
self._SectionParser[self._SectionType[0]](self)
- if self._ValueList == None or self._ItemType == MODEL_META_DATA_DEFINE:
+ if self._ValueList is None or self._ItemType == MODEL_META_DATA_DEFINE:
self._ItemType = -1
self._Comments = []
continue
@@ -1932,7 +1932,7 @@ class Fdf(FdfObject):
#
# Load Fdf file if filename is not None
#
- if Filename != None:
+ if Filename is not None:
try:
self.LoadFdfFile(Filename)
except Exception:
diff --git a/BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaFileTable.py b/BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaFileTable.py
index 54a3016948..9faa6b58b0 100644
--- a/BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaFileTable.py
+++ b/BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaFileTable.py
@@ -117,9 +117,9 @@ class ModuleTable(MetaFileTable):
ConditionString = "Model=%s AND Enabled>=0" % Model
ValueString = "Value1,Value2,Value3,Usage,Scope1,Scope2,ID,StartLine"
- if Arch != None and Arch != 'COMMON':
+ if Arch is not None and Arch != 'COMMON':
ConditionString += " AND (Scope1='%s' OR Scope1='COMMON')" % Arch
- if Platform != None and Platform != 'COMMON':
+ if Platform is not None and Platform != 'COMMON':
ConditionString += " AND (Scope2='%s' OR Scope2='COMMON' OR Scope2='DEFAULT')" % Platform
SqlCommand = "SELECT %s FROM %s WHERE %s" % (ValueString, self.Table, ConditionString)
@@ -198,7 +198,7 @@ class PackageTable(MetaFileTable):
ConditionString = "Model=%s AND Enabled>=0" % Model
ValueString = "Value1,Value2,Value3,Scope1,ID,StartLine"
- if Arch != None and Arch != 'COMMON':
+ if Arch is not None and Arch != 'COMMON':
ConditionString += " AND (Scope1='%s' OR Scope1='COMMON')" % Arch
SqlCommand = "SELECT %s FROM %s WHERE %s" % (ValueString, self.Table, ConditionString)
@@ -283,17 +283,17 @@ class PlatformTable(MetaFileTable):
ConditionString = "Model=%s AND Enabled>0" % Model
ValueString = "Value1,Value2,Value3,Scope1,Scope2,ID,StartLine"
- if Scope1 != None and Scope1 != 'COMMON':
+ if Scope1 is not None and Scope1 != 'COMMON':
ConditionString += " AND (Scope1='%s' OR Scope1='COMMON')" % Scope1
- if Scope2 != None and Scope2 != 'COMMON':
+ if Scope2 is not None and Scope2 != 'COMMON':
ConditionString += " AND (Scope2='%s' OR Scope2='COMMON' OR Scope2='DEFAULT')" % Scope2
- if BelongsToItem != None:
+ if BelongsToItem is not None:
ConditionString += " AND BelongsToItem=%s" % BelongsToItem
else:
ConditionString += " AND BelongsToItem<0"
- if FromItem != None:
+ if FromItem is not None:
ConditionString += " AND FromItem=%s" % FromItem
SqlCommand = "SELECT %s FROM %s WHERE %s" % (ValueString, self.Table, ConditionString)
diff --git a/BaseTools/Source/Python/Ecc/Xml/XmlRoutines.py b/BaseTools/Source/Python/Ecc/Xml/XmlRoutines.py
index b93588eea6..a86f19624c 100644
--- a/BaseTools/Source/Python/Ecc/Xml/XmlRoutines.py
+++ b/BaseTools/Source/Python/Ecc/Xml/XmlRoutines.py
@@ -30,14 +30,14 @@ from Common.LongFilePathSupport import OpenLongFilePath as open
def CreateXmlElement(Name, String, NodeList, AttributeList):
Doc = xml.dom.minidom.Document()
Element = Doc.createElement(Name)
- if String != '' and String != None:
+ if String != '' and String is not None:
Element.appendChild(Doc.createTextNode(String))
for Item in NodeList:
if type(Item) == type([]):
Key = Item[0]
Value = Item[1]
- if Key != '' and Key != None and Value != '' and Value != None:
+ if Key != '' and Key is not None and Value != '' and Value is not None:
Node = Doc.createElement(Key)
Node.appendChild(Doc.createTextNode(Value))
Element.appendChild(Node)
@@ -46,7 +46,7 @@ def CreateXmlElement(Name, String, NodeList, AttributeList):
for Item in AttributeList:
Key = Item[0]
Value = Item[1]
- if Key != '' and Key != None and Value != '' and Value != None:
+ if Key != '' and Key is not None and Value != '' and Value is not None:
Element.setAttribute(Key, Value)
return Element
@@ -62,7 +62,7 @@ def CreateXmlElement(Name, String, NodeList, AttributeList):
# @revel Nodes A list of XML nodes matching XPath style Sting.
#
def XmlList(Dom, String):
- if String == None or String == "" or Dom == None or Dom == "":
+ if String is None or String == "" or Dom is None or Dom == "":
return []
if Dom.nodeType == Dom.DOCUMENT_NODE:
Dom = Dom.documentElement
@@ -98,7 +98,7 @@ def XmlList(Dom, String):
# @revel Node A single XML node matching XPath style Sting.
#
def XmlNode(Dom, String):
- if String == None or String == "" or Dom == None or Dom == "":
+ if String is None or String == "" or Dom is None or Dom == "":
return ""
if Dom.nodeType == Dom.DOCUMENT_NODE:
Dom = Dom.documentElement
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])