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
@ -58,7 +58,7 @@ class Page(BaseDoxygeItem):
|
||||
return subpage
|
||||
|
||||
def AddPages(self, pageArray):
|
||||
if pageArray == None:
|
||||
if pageArray is None:
|
||||
return
|
||||
for page in pageArray:
|
||||
self.AddPage(page)
|
||||
@ -370,7 +370,7 @@ class DoxygenConfigFile:
|
||||
self.mWarningFile = str.replace('\\', '/')
|
||||
|
||||
def FileExists(self, path):
|
||||
if path == None:
|
||||
if path is None:
|
||||
return False
|
||||
if len(path) == 0:
|
||||
return False
|
||||
@ -382,7 +382,7 @@ class DoxygenConfigFile:
|
||||
return False
|
||||
|
||||
def AddFile(self, path):
|
||||
if path == None:
|
||||
if path is None:
|
||||
return
|
||||
|
||||
if len(path) == 0:
|
||||
|
@ -553,7 +553,7 @@ class EfiFvMapFile(object):
|
||||
if line[0] != ' ':
|
||||
# new entry
|
||||
ret = rMapEntry.match(line)
|
||||
if ret != None:
|
||||
if ret is not None:
|
||||
name = ret.groups()[0]
|
||||
baseaddr = int(ret.groups()[1], 16)
|
||||
entry = int(ret.groups()[2], 16)
|
||||
|
@ -34,7 +34,7 @@ class BaseINIFile(object):
|
||||
if key not in cls._objs.keys():
|
||||
cls._objs[key] = object.__new__(cls, *args, **kwargs)
|
||||
|
||||
if parent != None:
|
||||
if parent is not None:
|
||||
cls._objs[key].AddParent(parent)
|
||||
|
||||
return cls._objs[key]
|
||||
@ -47,7 +47,7 @@ class BaseINIFile(object):
|
||||
self._isModify = True
|
||||
|
||||
def AddParent(self, parent):
|
||||
if parent == None: return
|
||||
if parent is None: return
|
||||
if not hasattr(self, "_parents"):
|
||||
self._parents = []
|
||||
|
||||
@ -122,7 +122,7 @@ class BaseINIFile(object):
|
||||
continue
|
||||
|
||||
m = section_re.match(templine)
|
||||
if m!= None: # found a section
|
||||
if mis not None: # found a section
|
||||
inGlobal = False
|
||||
# Finish the latest section first
|
||||
if len(sObjs) != 0:
|
||||
@ -165,7 +165,7 @@ class BaseINIFile(object):
|
||||
def Destroy(self, parent):
|
||||
|
||||
# check referenced parent
|
||||
if parent != None:
|
||||
if parent is not None:
|
||||
assert parent in self._parents, "when destory ini object, can not found parent reference!"
|
||||
self._parents.remove(parent)
|
||||
|
||||
@ -307,7 +307,7 @@ class BaseINISection(object):
|
||||
visit += 1
|
||||
continue
|
||||
line = line.split('#')[0].strip()
|
||||
if iniObj != None:
|
||||
if iniObj is not None:
|
||||
if line.endswith('}'):
|
||||
iniObj._end = visit - self._start
|
||||
if not iniObj.Parse():
|
||||
|
@ -35,14 +35,14 @@ def WarnMsg(mess, fName=None, fNo=None):
|
||||
def NormalMessage(type, mess, fName=None, fNo=None):
|
||||
strMsg = type
|
||||
|
||||
if fName != None:
|
||||
if fName is not None:
|
||||
strMsg += ' %s' % fName.replace('/', '\\')
|
||||
if fNo != None:
|
||||
if fNo is not None:
|
||||
strMsg += '(%d):' % fNo
|
||||
else:
|
||||
strMsg += ' :'
|
||||
|
||||
if fName == None and fNo == None:
|
||||
if fName is None and fNo is None:
|
||||
strMsg += ' '
|
||||
strMsg += mess
|
||||
|
||||
|
Reference in New Issue
Block a user