summaryrefslogtreecommitdiffstats
path: root/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/edk2/model
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/Scripts/PackageDocumentTools/plugins/EdkPlugins/edk2/model
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/Scripts/PackageDocumentTools/plugins/EdkPlugins/edk2/model')
-rw-r--r--BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/edk2/model/baseobject.py74
-rw-r--r--BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/edk2/model/dec.py2
-rw-r--r--BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/edk2/model/doxygengen.py32
-rw-r--r--BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/edk2/model/doxygengen_spec.py32
-rw-r--r--BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/edk2/model/dsc.py2
-rw-r--r--BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/edk2/model/inf.py12
6 files changed, 77 insertions, 77 deletions
diff --git a/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/edk2/model/baseobject.py b/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/edk2/model/baseobject.py
index 05fa2529be..7c120d85c2 100644
--- a/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/edk2/model/baseobject.py
+++ b/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/edk2/model/baseobject.py
@@ -74,7 +74,7 @@ class SurfaceObject(object):
def Load(self, relativePath):
# if has been loaded, directly return
- if self._fileObj != None: return True
+ if self._fileObj is not None: return True
relativePath = os.path.normpath(relativePath)
fullPath = os.path.join(self._workspace, relativePath)
@@ -160,7 +160,7 @@ class Platform(SurfaceObject):
return dsc.DSCFile
def GetModuleCount(self):
- if self.GetFileObj() == None:
+ if self.GetFileObj() is None:
ErrorMsg("Fail to get module count because DSC file has not been load!")
return len(self.GetFileObj().GetComponents())
@@ -171,7 +171,7 @@ class Platform(SurfaceObject):
def LoadModules(self, precallback=None, postcallback=None):
for obj in self.GetFileObj().GetComponents():
mFilename = obj.GetFilename()
- if precallback != None:
+ if precallback is not None:
precallback(self, mFilename)
arch = obj.GetArch()
if arch.lower() == 'common':
@@ -182,7 +182,7 @@ class Platform(SurfaceObject):
module = Module(self, self.GetWorkspace())
if module.Load(mFilename, arch, obj.GetOveridePcds(), obj.GetOverideLibs()):
self._modules.append(module)
- if postcallback != None:
+ if postcallback is not None:
postcallback(self, module)
else:
del module
@@ -222,7 +222,7 @@ class Platform(SurfaceObject):
for obj in objs:
if obj.GetPcdName().lower() == name.lower():
arr.append(obj)
- if arch != None:
+ if arch is not None:
arr = self.FilterObjsByArch(arr, arch)
return arr
@@ -292,7 +292,7 @@ class Platform(SurfaceObject):
newSect = newDsc.AddNewSection(oldSect.GetName())
for oldComObj in oldSect.GetObjects():
module = self.GetModuleObject(oldComObj.GetFilename(), oldSect.GetArch())
- if module == None: continue
+ if module is None: continue
newComObj = dsc.DSCComponentObject(newSect)
newComObj.SetFilename(oldComObj.GetFilename())
@@ -300,7 +300,7 @@ class Platform(SurfaceObject):
# add all library instance for override section
libdict = module.GetLibraries()
for libclass in libdict.keys():
- if libdict[libclass] != None:
+ if libdict[libclass] is not None:
newComObj.AddOverideLib(libclass, libdict[libclass].GetRelativeFilename().replace('\\', '/'))
# add all pcds for override section
@@ -338,7 +338,7 @@ class Module(SurfaceObject):
def Destroy(self):
for lib in self._libs.values():
- if lib != None:
+ if lib is not None:
lib.Destroy()
self._libs.clear()
@@ -351,12 +351,12 @@ class Module(SurfaceObject):
del self._ppis[:]
for protocol in self._protocols:
- if protocol != None:
+ if protocol is not None:
protocol.DeRef(self)
del self._protocols[:]
for guid in self._guids:
- if guid != None:
+ if guid is not None:
guid.DeRef(self)
del self._guids[:]
@@ -375,9 +375,9 @@ class Module(SurfaceObject):
return False
self._arch = arch
- if overidePcds != None:
+ if overidePcds is not None:
self._overideLibs = overideLibs
- if overideLibs != None:
+ if overideLibs is not None:
self._overidePcds = overidePcds
self._SearchLibraries()
@@ -403,7 +403,7 @@ class Module(SurfaceObject):
def GetPcds(self):
pcds = self._pcds.copy()
for lib in self._libs.values():
- if lib == None: continue
+ if lib is None: continue
for name in lib._pcds.keys():
pcds[name] = lib._pcds[name]
return pcds
@@ -412,7 +412,7 @@ class Module(SurfaceObject):
ppis = []
ppis += self._ppis
for lib in self._libs.values():
- if lib == None: continue
+ if lib is None: continue
ppis += lib._ppis
return ppis
@@ -420,7 +420,7 @@ class Module(SurfaceObject):
pros = []
pros = self._protocols
for lib in self._libs.values():
- if lib == None: continue
+ if lib is None: continue
pros += lib._protocols
return pros
@@ -428,7 +428,7 @@ class Module(SurfaceObject):
guids = []
guids += self._guids
for lib in self._libs.values():
- if lib == None: continue
+ if lib is None: continue
guids += lib._guids
return guids
@@ -436,12 +436,12 @@ class Module(SurfaceObject):
deps = []
deps += self._depexs
for lib in self._libs.values():
- if lib == None: continue
+ if lib is None: continue
deps += lib._depexs
return deps
def IsLibrary(self):
- return self.GetFileObj().GetDefine("LIBRARY_CLASS") != None
+ return self.GetFileObj().GetDefine("LIBRARY_CLASS") is not None
def GetLibraryInstance(self, classname, arch, type):
if classname not in self._libs.keys():
@@ -454,7 +454,7 @@ class Module(SurfaceObject):
parent = self.GetParent()
if issubclass(parent.__class__, Platform):
path = parent.GetLibraryPath(classname, arch, type)
- if path == None:
+ if path is None:
ErrorMsg('Fail to get library instance for %s' % classname, self.GetFilename())
return None
self._libs[classname] = Library(self, self.GetWorkspace())
@@ -477,7 +477,7 @@ class Module(SurfaceObject):
continue
classname = obj.GetClass()
instance = self.GetLibraryInstance(classname, arch, type)
- if not self.IsLibrary() and instance != None:
+ if not self.IsLibrary() and instance is not None:
instance._isInherit = False
if classname not in self._libs.keys():
@@ -490,7 +490,7 @@ class Module(SurfaceObject):
pros = []
deps = []
guids = []
- if self.GetFileObj() != None:
+ if self.GetFileObj() is not None:
pcds = self.FilterObjsByArch(self.GetFileObj().GetSectionObjectsByName('pcd'),
self.GetArch())
for pcd in pcds:
@@ -534,31 +534,31 @@ class Module(SurfaceObject):
objs = self.GetFileObj().GetSectionObjectsByName('packages')
for obj in objs:
package = self.GetPlatform().GetPackage(obj.GetPath())
- if package != None:
+ if package is not None:
self._packages.append(package)
def GetPackages(self):
return self._packages
def GetPcdObjects(self):
- if self.GetFileObj() == None:
+ if self.GetFileObj() is None:
return []
return self.GetFileObj().GetSectionObjectsByName('pcd')
def GetLibraryClassHeaderFilePath(self):
lcname = self.GetFileObj().GetProduceLibraryClass()
- if lcname == None: return None
+ if lcname is None: return None
pkgs = self.GetPackages()
for package in pkgs:
path = package.GetLibraryClassHeaderPathByName(lcname)
- if path != None:
+ if path is not None:
return os.path.realpath(os.path.join(package.GetFileObj().GetPackageRootPath(), path))
return None
def Reload(self, force=False, callback=None):
- if callback != None:
+ if callback is not None:
callback(self, "Starting reload...")
ret = SurfaceObject.Reload(self, force)
@@ -568,7 +568,7 @@ class Module(SurfaceObject):
return True
for lib in self._libs.values():
- if lib != None:
+ if lib is not None:
lib.Destroy()
self._libs.clear()
@@ -591,13 +591,13 @@ class Module(SurfaceObject):
del self._packages[:]
del self._depexs[:]
- if callback != None:
+ if callback is not None:
callback(self, "Searching libraries...")
self._SearchLibraries()
- if callback != None:
+ if callback is not None:
callback(self, "Searching packages...")
self._SearchPackage()
- if callback != None:
+ if callback is not None:
callback(self, "Searching surface items...")
self._SearchSurfaceItems()
@@ -665,16 +665,16 @@ class Package(SurfaceObject):
def Destroy(self):
for pcd in self._pcds.values():
- if pcd != None:
+ if pcd is not None:
pcd.Destroy()
for guid in self._guids.values():
- if guid != None:
+ if guid is not None:
guid.Destroy()
for protocol in self._protocols.values():
- if protocol != None:
+ if protocol is not None:
protocol.Destroy()
for ppi in self._ppis.values():
- if ppi != None:
+ if ppi is not None:
ppi.Destroy()
self._pcds.clear()
self._guids.clear()
@@ -689,7 +689,7 @@ class Package(SurfaceObject):
pcds = self.GetFileObj().GetSectionObjectsByName('pcds')
for pcd in pcds:
if pcd.GetPcdName() in self._pcds.keys():
- if self._pcds[pcd.GetPcdName()] != None:
+ if self._pcds[pcd.GetPcdName()] is not None:
self._pcds[pcd.GetPcdName()].AddDecObj(pcd)
else:
self._pcds[pcd.GetPcdName()] = PcdItem(pcd.GetPcdName(), self, pcd)
@@ -726,7 +726,7 @@ class Package(SurfaceObject):
def GetPcdDefineObjs(self, name=None):
arr = []
objs = self.GetFileObj().GetSectionObjectsByName('pcds')
- if name == None: return objs
+ if name is None: return objs
for obj in objs:
if obj.GetPcdName().lower() == name.lower():
@@ -772,7 +772,7 @@ class ModulePcd(object):
def __init__(self, parent, name, infObj, pcdItem):
assert issubclass(parent.__class__, Module), "Module's PCD's parent must be module!"
- assert pcdItem != None, 'Pcd %s does not in some package!' % name
+ assert pcdItem is not None, 'Pcd %s does not in some package!' % name
self._name = name
self._parent = parent
diff --git a/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/edk2/model/dec.py b/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/edk2/model/dec.py
index 3bd0b7b587..9ff0df3851 100644
--- a/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/edk2/model/dec.py
+++ b/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/edk2/model/dec.py
@@ -77,7 +77,7 @@ class DECSection(ini.BaseINISection):
return arr[1]
def IsArchMatch(self, arch):
- if arch == None or self.GetArch() == 'common':
+ if arch is None or self.GetArch() == 'common':
return True
if self.GetArch().lower() != arch.lower():
diff --git a/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/edk2/model/doxygengen.py b/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/edk2/model/doxygengen.py
index 268ba5c3bd..94b6588c0d 100644
--- a/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/edk2/model/doxygengen.py
+++ b/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/edk2/model/doxygengen.py
@@ -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')
diff --git a/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/edk2/model/doxygengen_spec.py b/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/edk2/model/doxygengen_spec.py
index 876da1327b..ca55929eda 100644
--- a/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/edk2/model/doxygengen_spec.py
+++ b/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/edk2/model/doxygengen_spec.py
@@ -66,7 +66,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):
@@ -91,7 +91,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:
@@ -106,7 +106,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
@@ -167,9 +167,9 @@ class PackageDocumentAction(DoxygenAction):
self._configFile.AddPreDefined(macro)
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())
@@ -315,7 +315,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())
@@ -401,7 +401,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.
@@ -419,7 +419,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()))
@@ -435,10 +435,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:
@@ -479,7 +479,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')
@@ -575,7 +575,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:
@@ -628,7 +628,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:
@@ -682,7 +682,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:
@@ -775,7 +775,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)
@@ -954,7 +954,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')
diff --git a/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/edk2/model/dsc.py b/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/edk2/model/dsc.py
index f8ed531561..0628fa7408 100644
--- a/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/edk2/model/dsc.py
+++ b/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/edk2/model/dsc.py
@@ -189,7 +189,7 @@ class DSCComponentObject(DSCSectionObject):
lines.append(' <%s>\n' % key)
for name, value in self._OveridePcds[key]:
- if value != None:
+ if value is not None:
lines.append(' %s|%s\n' % (name, value))
else:
lines.append(' %s\n' % name)
diff --git a/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/edk2/model/inf.py b/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/edk2/model/inf.py
index 9d70fbcf97..32b26850e7 100644
--- a/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/edk2/model/inf.py
+++ b/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/edk2/model/inf.py
@@ -23,7 +23,7 @@ class INFFile(ini.BaseINIFile):
def GetProduceLibraryClass(self):
obj = self.GetDefine("LIBRARY_CLASS")
- if obj == None: return None
+ if obj is None: return None
return obj.split('|')[0].strip()
@@ -59,7 +59,7 @@ class INFFile(ini.BaseINIFile):
if not ini.BaseINIFile.Parse(self):
return False
classname = self.GetProduceLibraryClass()
- if classname != None:
+ if classname is not None:
libobjdict = INFFile._libobjs
if libobjdict.has_key(classname):
if self not in libobjdict[classname]:
@@ -77,7 +77,7 @@ class INFFile(ini.BaseINIFile):
def Clear(self):
classname = self.GetProduceLibraryClass()
- if classname != None:
+ if classname is not None:
libobjdict = INFFile._libobjs
libobjdict[classname].remove(self)
if len(libobjdict[classname]) == 0:
@@ -114,7 +114,7 @@ class INFSection(ini.BaseINISection):
return arr[1]
def IsArchMatch(self, arch):
- if arch == None or self.GetArch() == 'common':
+ if arch is None or self.GetArch() == 'common':
return True
if self.GetArch().lower() != arch.lower():
@@ -258,9 +258,9 @@ class INFSourceObject(INFSectionObject):
del objdict[self.mFilename]
def IsMatchFamily(self, family):
- if family == None:
+ if family is None:
return True
- if self.mFamily != None:
+ if self.mFamily is not None:
if family.strip().lower() == self.mFamily.lower():
return True
else: