#\r
# First judge whether this DEFINE is in conditional directive statements or not.\r
#\r
- if type(self) == DscParser and self._InDirective > -1:\r
+ if isinstance(self, DscParser) and self._InDirective > -1:\r
pass\r
else:\r
- if type(self) == DecParser:\r
+ if isinstance(self, DecParser):\r
if MODEL_META_DATA_HEADER in self._SectionType:\r
self._FileLocalMacros[Name] = Value\r
else:\r
self._ConstructSectionMacroDict(Name, Value)\r
\r
# EDK_GLOBAL defined macros\r
- elif type(self) != DscParser:\r
+ elif not isinstance(self, DscParser):\r
EdkLogger.error('Parser', FORMAT_INVALID, "EDK_GLOBAL can only be used in .dsc file",\r
ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex + 1)\r
elif self._SectionType != MODEL_META_DATA_HEADER:\r
# DataInfo = [data_type, scope1(arch), scope2(platform/moduletype)]\r
#\r
def __getitem__(self, DataInfo):\r
- if type(DataInfo) != type(()):\r
+ if not isinstance(DataInfo, type(())):\r
DataInfo = (DataInfo,)\r
\r
# Parse the file first, if necessary\r
TokenList = GetSplitValueList(self._CurrentLine, TAB_VALUE_SPLIT)\r
self._ValueList[0:len(TokenList)] = TokenList\r
# Don't do macro replacement for dsc file at this point\r
- if type(self) != DscParser:\r
+ if not isinstance(self, DscParser):\r
Macros = self._Macros\r
self._ValueList = [ReplaceMacro(Value, Macros) for Value in self._ValueList]\r
\r
EdkLogger.error('Parser', FORMAT_INVALID, "Invalid version number",\r
ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex + 1)\r
\r
- if type(self) == InfParser and self._Version < 0x00010005:\r
+ if isinstance(self, InfParser) and self._Version < 0x00010005:\r
# EDK module allows using defines as macros\r
self._FileLocalMacros[Name] = Value\r
self._Defines[Name] = Value\r
self._ValueList[1] = TokenList2[1] # keys\r
else:\r
self._ValueList[1] = TokenList[0]\r
- if len(TokenList) == 2 and type(self) != DscParser: # value\r
+ if len(TokenList) == 2 and not isinstance(self, DscParser): # value\r
self._ValueList[2] = ReplaceMacro(TokenList[1], self._Macros)\r
\r
if self._ValueList[1].count('_') != 4:\r
# DecParser SectionType is a list, will contain more than one item only in Pcd Section\r
# As Pcd section macro usage is not alllowed, so here it is safe\r
#\r
- if type(self) == DecParser:\r
+ if isinstance(self, DecParser):\r
SectionDictKey = self._SectionType[0], ScopeKey\r
else:\r
SectionDictKey = self._SectionType, ScopeKey\r
SpeSpeMacroDict = {}\r
\r
ActiveSectionType = self._SectionType\r
- if type(self) == DecParser:\r
+ if isinstance(self, DecParser):\r
ActiveSectionType = self._SectionType[0]\r
\r
for (SectionType, Scope) in self._SectionsMacroDict:\r
Macros.update(self._Symbols)\r
if GlobalData.BuildOptionPcd:\r
for Item in GlobalData.BuildOptionPcd:\r
- if type(Item) is tuple:\r
+ if isinstance(Item, tuple):\r
continue\r
PcdName, TmpValue = Item.split("=")\r
TmpValue = BuildOptionValue(TmpValue, self._GuidDict)\r