summaryrefslogtreecommitdiffstats
path: root/BaseTools/Source/Python/Eot
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/Eot
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/Eot')
-rw-r--r--BaseTools/Source/Python/Eot/CParser.py12
-rw-r--r--BaseTools/Source/Python/Eot/CodeFragmentCollector.py2
-rw-r--r--BaseTools/Source/Python/Eot/Eot.py6
-rw-r--r--BaseTools/Source/Python/Eot/FvImage.py42
-rw-r--r--BaseTools/Source/Python/Eot/InfParserLite.py2
-rw-r--r--BaseTools/Source/Python/Eot/Report.py2
6 files changed, 33 insertions, 33 deletions
diff --git a/BaseTools/Source/Python/Eot/CParser.py b/BaseTools/Source/Python/Eot/CParser.py
index 41f2811430..94711a9a37 100644
--- a/BaseTools/Source/Python/Eot/CParser.py
+++ b/BaseTools/Source/Python/Eot/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/Eot/CodeFragmentCollector.py b/BaseTools/Source/Python/Eot/CodeFragmentCollector.py
index bb78a0f882..b977a9d532 100644
--- a/BaseTools/Source/Python/Eot/CodeFragmentCollector.py
+++ b/BaseTools/Source/Python/Eot/CodeFragmentCollector.py
@@ -291,7 +291,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/Eot/Eot.py b/BaseTools/Source/Python/Eot/Eot.py
index 5029f7369d..c4164199ac 100644
--- a/BaseTools/Source/Python/Eot/Eot.py
+++ b/BaseTools/Source/Python/Eot/Eot.py
@@ -579,11 +579,11 @@ class Eot(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/Eot/FvImage.py b/BaseTools/Source/Python/Eot/FvImage.py
index 0f742c7d86..affca4e71e 100644
--- a/BaseTools/Source/Python/Eot/FvImage.py
+++ b/BaseTools/Source/Python/Eot/FvImage.py
@@ -52,7 +52,7 @@ class Image(array):
return array.__new__(cls, 'B')
def __init__(m, ID=None):
- if ID == None:
+ if ID is None:
m._ID_ = str(uuid.uuid1()).upper()
else:
m._ID_ = ID
@@ -208,7 +208,7 @@ class FirmwareVolume(Image):
return (CouldBeLoaded, DepexString, FileDepex)
def Dispatch(self, Db = None):
- if Db == None:
+ if Db is None:
return False
self.UnDispatchedFfsDict = copy.copy(self.FfsDict)
# Find PeiCore, DexCore, PeiPriori, DxePriori first
@@ -236,15 +236,15 @@ class FirmwareVolume(Image):
continue
# Parse SEC_CORE first
- if FfsSecCoreGuid != None:
+ if FfsSecCoreGuid is not None:
self.OrderedFfsDict[FfsSecCoreGuid] = self.UnDispatchedFfsDict.pop(FfsSecCoreGuid)
self.LoadPpi(Db, FfsSecCoreGuid)
# Parse PEI first
- if FfsPeiCoreGuid != None:
+ if FfsPeiCoreGuid is not None:
self.OrderedFfsDict[FfsPeiCoreGuid] = self.UnDispatchedFfsDict.pop(FfsPeiCoreGuid)
self.LoadPpi(Db, FfsPeiCoreGuid)
- if FfsPeiPrioriGuid != None:
+ if FfsPeiPrioriGuid is not None:
# Load PEIM described in priori file
FfsPeiPriori = self.UnDispatchedFfsDict.pop(FfsPeiPrioriGuid)
if len(FfsPeiPriori.Sections) == 1:
@@ -263,10 +263,10 @@ class FirmwareVolume(Image):
self.DisPatchPei(Db)
# Parse DXE then
- if FfsDxeCoreGuid != None:
+ if FfsDxeCoreGuid is not None:
self.OrderedFfsDict[FfsDxeCoreGuid] = self.UnDispatchedFfsDict.pop(FfsDxeCoreGuid)
self.LoadProtocol(Db, FfsDxeCoreGuid)
- if FfsDxePrioriGuid != None:
+ if FfsDxePrioriGuid is not None:
# Load PEIM described in priori file
FfsDxePriori = self.UnDispatchedFfsDict.pop(FfsDxePrioriGuid)
if len(FfsDxePriori.Sections) == 1:
@@ -383,7 +383,7 @@ class FirmwareVolume(Image):
IsInstalled = True
NewFfs = self.UnDispatchedFfsDict.pop(FfsID)
NewFfs.Depex = DepexString
- if FileDepex != None:
+ if FileDepex is not None:
ScheduleList.insert.insert(FileDepex[1], FfsID, NewFfs, FileDepex[0])
else:
ScheduleList[FfsID] = NewFfs
@@ -471,7 +471,7 @@ class FirmwareVolume(Image):
FfsId = repr(FfsObj)
if ((self.Attributes & 0x00000800) != 0 and len(FfsObj) == 0xFFFFFF) \
or ((self.Attributes & 0x00000800) == 0 and len(FfsObj) == 0):
- if LastFfsObj != None:
+ if LastFfsObj is not None:
LastFfsObj.FreeSpace = EndOfFv - LastFfsObj._OFF_ - len(LastFfsObj)
else:
if FfsId in self.FfsDict:
@@ -480,7 +480,7 @@ class FirmwareVolume(Image):
% (FfsObj.Guid, FfsObj.Offset,
self.FfsDict[FfsId].Guid, self.FfsDict[FfsId].Offset))
self.FfsDict[FfsId] = FfsObj
- if LastFfsObj != None:
+ if LastFfsObj is not None:
LastFfsObj.FreeSpace = FfsStartAddress - LastFfsObj._OFF_ - len(LastFfsObj)
FfsStartAddress += len(FfsObj)
@@ -527,11 +527,11 @@ class CompressedImage(Image):
def __init__(m, CompressedData=None, CompressionType=None, UncompressedLength=None):
Image.__init__(m)
- if UncompressedLength != None:
+ if UncompressedLength is not None:
m.UncompressedLength = UncompressedLength
- if CompressionType != None:
+ if CompressionType is not None:
m.CompressionType = CompressionType
- if CompressedData != None:
+ if CompressedData is not None:
m.Data = CompressedData
def __str__(m):
@@ -607,13 +607,13 @@ class GuidDefinedImage(Image):
def __init__(m, SectionDefinitionGuid=None, DataOffset=None, Attributes=None, Data=None):
Image.__init__(m)
- if SectionDefinitionGuid != None:
+ if SectionDefinitionGuid is not None:
m.SectionDefinitionGuid = SectionDefinitionGuid
- if DataOffset != None:
+ if DataOffset is not None:
m.DataOffset = DataOffset
- if Attributes != None:
+ if Attributes is not None:
m.Attributes = Attributes
- if Data != None:
+ if Data is not None:
m.Data = Data
def __str__(m):
@@ -791,7 +791,7 @@ class Depex(Image):
else:
CurrentData = m._OPCODE_
m._ExprList.append(Token)
- if CurrentData == None:
+ if CurrentData is None:
break
return m._ExprList
@@ -867,9 +867,9 @@ class Section(Image):
def __init__(m, Type=None, Size=None):
Image.__init__(m)
m._Alignment = 1
- if Type != None:
+ if Type is not None:
m.Type = Type
- if Size != None:
+ if Size is not None:
m.Size = Size
def __str__(m):
@@ -1283,7 +1283,7 @@ class LinkMap:
for Line in MapFile:
Line = Line.strip()
if not MappingStart:
- if MappingTitle.match(Line) != None:
+ if MappingTitle.match(Line) is not None:
MappingStart = True
continue
ResultList = MappingFormat.findall(Line)
diff --git a/BaseTools/Source/Python/Eot/InfParserLite.py b/BaseTools/Source/Python/Eot/InfParserLite.py
index 6bb2c5f9f1..8867bb5dc2 100644
--- a/BaseTools/Source/Python/Eot/InfParserLite.py
+++ b/BaseTools/Source/Python/Eot/InfParserLite.py
@@ -52,7 +52,7 @@ class EdkInfParser(object):
self.SourceOverridePath = SourceOverridePath
# Load Inf file if filename is not None
- if Filename != None:
+ if Filename is not None:
self.LoadInfFile(Filename)
if SourceFileList:
diff --git a/BaseTools/Source/Python/Eot/Report.py b/BaseTools/Source/Python/Eot/Report.py
index 386e3eb8ec..7435b4d7c9 100644
--- a/BaseTools/Source/Python/Eot/Report.py
+++ b/BaseTools/Source/Python/Eot/Report.py
@@ -234,7 +234,7 @@ class Report(object):
#
def GenerateFfs(self, FfsObj):
self.FfsIndex = self.FfsIndex + 1
- if FfsObj != None and FfsObj.Type in [0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0xA]:
+ if FfsObj is not None and FfsObj.Type in [0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0xA]:
FfsGuid = FfsObj.Guid
FfsOffset = FfsObj._OFF_
FfsName = 'Unknown-Module'