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>
This commit is contained in:
committed by
Yonghong Zhu
parent
05a32984ab
commit
4231a8193e
@ -69,7 +69,7 @@ class DoxygenAction:
|
||||
self._chmCallback = None
|
||||
|
||||
def Log(self, message, level='info'):
|
||||
if self._log != None:
|
||||
if self._log is not None:
|
||||
self._log(message, level)
|
||||
|
||||
def IsVerbose(self):
|
||||
@ -94,7 +94,7 @@ class DoxygenAction:
|
||||
|
||||
self.Log(" >>>>>> Generate doxygen index page file...Zzz...\n")
|
||||
indexPagePath = self.GenerateIndexPage()
|
||||
if indexPagePath == None:
|
||||
if indexPagePath is None:
|
||||
self.Log("Fail to generate index page!\n", 'error')
|
||||
return False
|
||||
else:
|
||||
@ -109,7 +109,7 @@ class DoxygenAction:
|
||||
self.Log(" <<<<<< Success Save doxygen config file to %s...\n" % configFilePath)
|
||||
|
||||
# launch doxygen tool to generate document
|
||||
if self._doxygenCallback != None:
|
||||
if self._doxygenCallback is not None:
|
||||
self.Log(" >>>>>> Start doxygen process...Zzz...\n")
|
||||
if not self._doxygenCallback(self._doxPath, configFilePath):
|
||||
return False
|
||||
@ -166,9 +166,9 @@ class PackageDocumentAction(DoxygenAction):
|
||||
self._configFile.AddPreDefined('MDE_CPU_ARM')
|
||||
|
||||
namestr = self._pObj.GetName()
|
||||
if self._arch != None:
|
||||
if self._arch is not None:
|
||||
namestr += '[%s]' % self._arch
|
||||
if self._tooltag != None:
|
||||
if self._tooltag is not None:
|
||||
namestr += '[%s]' % self._tooltag
|
||||
self._configFile.SetProjectName(namestr)
|
||||
self._configFile.SetStripPath(self._pObj.GetWorkspace())
|
||||
@ -314,7 +314,7 @@ class PackageDocumentAction(DoxygenAction):
|
||||
objs = pObj.GetFileObj().GetSectionObjectsByName('libraryclass', self._arch)
|
||||
if len(objs) == 0: return []
|
||||
|
||||
if self._arch != None:
|
||||
if self._arch is not None:
|
||||
for obj in objs:
|
||||
classPage = doxygen.Page(obj.GetClassName(),
|
||||
"lc_%s" % obj.GetClassName())
|
||||
@ -399,7 +399,7 @@ class PackageDocumentAction(DoxygenAction):
|
||||
mo = re.match(r"^[#\w\s]+[<\"]([\\/\w.]+)[>\"]$", lines[no].strip())
|
||||
filePath = mo.groups()[0]
|
||||
|
||||
if filePath == None or len(filePath) == 0:
|
||||
if filePath is None or len(filePath) == 0:
|
||||
continue
|
||||
|
||||
# find header file in module's path firstly.
|
||||
@ -417,7 +417,7 @@ class PackageDocumentAction(DoxygenAction):
|
||||
if os.path.exists(incPath):
|
||||
fullPath = incPath
|
||||
break
|
||||
if infObj != None:
|
||||
if infObj is not None:
|
||||
pkgInfObjs = infObj.GetSectionObjectsByName('packages')
|
||||
for obj in pkgInfObjs:
|
||||
decObj = dec.DECFile(os.path.join(pObj.GetWorkspace(), obj.GetPath()))
|
||||
@ -433,10 +433,10 @@ class PackageDocumentAction(DoxygenAction):
|
||||
if os.path.exists(os.path.join(incPath, filePath)):
|
||||
fullPath = os.path.join(os.path.join(incPath, filePath))
|
||||
break
|
||||
if fullPath != None:
|
||||
if fullPath is not None:
|
||||
break
|
||||
|
||||
if fullPath == None and self.IsVerbose():
|
||||
if fullPath is None and self.IsVerbose():
|
||||
self.Log('Can not resolve header file %s for file %s in package %s\n' % (filePath, path, pObj.GetFileObj().GetFilename()), 'error')
|
||||
return
|
||||
else:
|
||||
@ -477,7 +477,7 @@ class PackageDocumentAction(DoxygenAction):
|
||||
typeRootPageDict[obj.GetPcdType()] = doxygen.Page(obj.GetPcdType(), 'pcd_%s_root_page' % obj.GetPcdType())
|
||||
pcdRootPage.AddPage(typeRootPageDict[obj.GetPcdType()])
|
||||
typeRoot = typeRootPageDict[obj.GetPcdType()]
|
||||
if self._arch != None:
|
||||
if self._arch is not None:
|
||||
pcdPage = doxygen.Page('%s' % obj.GetPcdName(),
|
||||
'pcd_%s_%s_%s' % (obj.GetPcdType(), obj.GetArch(), obj.GetPcdName().split('.')[1]))
|
||||
pcdPage.AddDescription('<br>\n'.join(obj.GetComment()) + '<br>\n')
|
||||
@ -573,7 +573,7 @@ class PackageDocumentAction(DoxygenAction):
|
||||
pageRoot = doxygen.Page('GUID', 'guid_root_page')
|
||||
objs = pObj.GetFileObj().GetSectionObjectsByName('guids', self._arch)
|
||||
if len(objs) == 0: return []
|
||||
if self._arch != None:
|
||||
if self._arch is not None:
|
||||
for obj in objs:
|
||||
pageRoot.AddPage(self._GenerateGuidSubPage(pObj, obj, configFile))
|
||||
else:
|
||||
@ -626,7 +626,7 @@ class PackageDocumentAction(DoxygenAction):
|
||||
pageRoot = doxygen.Page('PPI', 'ppi_root_page')
|
||||
objs = pObj.GetFileObj().GetSectionObjectsByName('ppis', self._arch)
|
||||
if len(objs) == 0: return []
|
||||
if self._arch != None:
|
||||
if self._arch is not None:
|
||||
for obj in objs:
|
||||
pageRoot.AddPage(self._GeneratePpiSubPage(pObj, obj, configFile))
|
||||
else:
|
||||
@ -680,7 +680,7 @@ class PackageDocumentAction(DoxygenAction):
|
||||
pageRoot = doxygen.Page('PROTOCOL', 'protocol_root_page')
|
||||
objs = pObj.GetFileObj().GetSectionObjectsByName('protocols', self._arch)
|
||||
if len(objs) == 0: return []
|
||||
if self._arch != None:
|
||||
if self._arch is not None:
|
||||
for obj in objs:
|
||||
pageRoot.AddPage(self._GenerateProtocolSubPage(pObj, obj, configFile))
|
||||
else:
|
||||
@ -773,7 +773,7 @@ class PackageDocumentAction(DoxygenAction):
|
||||
if not infObj.Parse():
|
||||
self.Log('Fail to load INF file %s' % inf)
|
||||
continue
|
||||
if infObj.GetProduceLibraryClass() != None:
|
||||
if infObj.GetProduceLibraryClass() is not None:
|
||||
libObjs.append(infObj)
|
||||
else:
|
||||
modObjs.append(infObj)
|
||||
@ -951,7 +951,7 @@ class PackageDocumentAction(DoxygenAction):
|
||||
retarr = self.SearchLibraryClassHeaderFile(lcObj.GetClass(),
|
||||
workspace,
|
||||
refDecObjs)
|
||||
if retarr != None:
|
||||
if retarr is not None:
|
||||
pkgname, hPath = retarr
|
||||
else:
|
||||
self.Log('Fail find the library class %s definition from module %s dependent package!' % (lcObj.GetClass(), infObj.GetFilename()), 'error')
|
||||
|
Reference in New Issue
Block a user