diff options
Diffstat (limited to 'BaseTools/Source/Python/Common')
-rw-r--r-- | BaseTools/Source/Python/Common/DataType.py | 4 | ||||
-rw-r--r-- | BaseTools/Source/Python/Common/Expression.py | 10 | ||||
-rw-r--r-- | BaseTools/Source/Python/Common/Misc.py | 28 | ||||
-rw-r--r-- | BaseTools/Source/Python/Common/RangeExpression.py | 6 | ||||
-rw-r--r-- | BaseTools/Source/Python/Common/StringUtils.py | 2 | ||||
-rw-r--r-- | BaseTools/Source/Python/Common/ToolDefClassObject.py | 6 | ||||
-rw-r--r-- | BaseTools/Source/Python/Common/VpdInfoFile.py | 10 |
7 files changed, 33 insertions, 33 deletions
diff --git a/BaseTools/Source/Python/Common/DataType.py b/BaseTools/Source/Python/Common/DataType.py index 154245ca31..473fb7473a 100644 --- a/BaseTools/Source/Python/Common/DataType.py +++ b/BaseTools/Source/Python/Common/DataType.py @@ -531,8 +531,8 @@ PCDS_DYNAMICEX_DEFAULT = "PcdsDynamicExDefault" PCDS_DYNAMICEX_VPD = "PcdsDynamicExVpd"
PCDS_DYNAMICEX_HII = "PcdsDynamicExHii"
-SECTIONS_HAVE_ITEM_PCD_SET = {PCDS_DYNAMIC_DEFAULT.upper(),PCDS_DYNAMIC_VPD.upper(),PCDS_DYNAMIC_HII.upper(), \
- PCDS_DYNAMICEX_DEFAULT.upper(),PCDS_DYNAMICEX_VPD.upper(),PCDS_DYNAMICEX_HII.upper()}
+SECTIONS_HAVE_ITEM_PCD_SET = {PCDS_DYNAMIC_DEFAULT.upper(), PCDS_DYNAMIC_VPD.upper(), PCDS_DYNAMIC_HII.upper(), \
+ PCDS_DYNAMICEX_DEFAULT.upper(), PCDS_DYNAMICEX_VPD.upper(), PCDS_DYNAMICEX_HII.upper()}
# Section allowed to have items after arch
SECTIONS_HAVE_ITEM_AFTER_ARCH_SET = {TAB_LIBRARY_CLASSES.upper(), TAB_DEPEX.upper(), TAB_USER_EXTENSIONS.upper(),
PCDS_DYNAMIC_DEFAULT.upper(),
diff --git a/BaseTools/Source/Python/Common/Expression.py b/BaseTools/Source/Python/Common/Expression.py index c63030a16e..9ff4f10425 100644 --- a/BaseTools/Source/Python/Common/Expression.py +++ b/BaseTools/Source/Python/Common/Expression.py @@ -569,7 +569,7 @@ class ValueExpression(BaseExpression): IsArray = IsGuid = False
if len(Token.split(',')) == 11 and len(Token.split(',{')) == 2 \
and len(Token.split('},')) == 1:
- HexLen = [11,6,6,5,4,4,4,4,4,4,6]
+ HexLen = [11, 6, 6, 5, 4, 4, 4, 4, 4, 4, 6]
HexList= Token.split(',')
if HexList[3].startswith('{') and \
not [Index for Index, Hex in enumerate(HexList) if len(Hex) > HexLen[Index]]:
@@ -765,7 +765,7 @@ class ValueExpression(BaseExpression): # Parse operator
def _GetOperator(self):
self.__SkipWS()
- LegalOpLst = ['&&', '||', '!=', '==', '>=', '<='] + self.NonLetterOpLst + ['?',':']
+ LegalOpLst = ['&&', '||', '!=', '==', '>=', '<='] + self.NonLetterOpLst + ['?', ':']
self._Token = ''
Expr = self._Expr[self._Idx:]
@@ -842,7 +842,7 @@ class ValueExpressionEx(ValueExpression): elif Item.startswith(TAB_UINT64):
ItemSize = 8
ValueType = TAB_UINT64
- elif Item[0] in {'"',"'",'L'}:
+ elif Item[0] in {'"', "'", 'L'}:
ItemSize = 0
ValueType = TAB_VOID
else:
@@ -946,7 +946,7 @@ class ValueExpressionEx(ValueExpression): # replace each offset, except errors
for Offset in OffsetList:
try:
- Item = Item.replace('OFFSET_OF({})'.format(Offset),LabelDict[Offset])
+ Item = Item.replace('OFFSET_OF({})'.format(Offset), LabelDict[Offset])
except:
raise BadExpression('%s not defined' % Offset)
@@ -999,7 +999,7 @@ class ValueExpressionEx(ValueExpression): Item = '0x%x' % TmpValue if type(TmpValue) != type('') else TmpValue
if ItemSize == 0:
ItemValue, ItemSize = ParseFieldValue(Item)
- if Item[0] not in {'"','L','{'} and ItemSize > 1:
+ if Item[0] not in {'"', 'L', '{'} and ItemSize > 1:
raise BadExpression("Byte array number %s should less than 0xFF." % Item)
else:
ItemValue = ParseFieldValue(Item)[0]
diff --git a/BaseTools/Source/Python/Common/Misc.py b/BaseTools/Source/Python/Common/Misc.py index 01171adb9b..fd53b6b046 100644 --- a/BaseTools/Source/Python/Common/Misc.py +++ b/BaseTools/Source/Python/Common/Misc.py @@ -132,7 +132,7 @@ def _parseForGCC(lines, efifilepath, varnames): if Str:
m = pcdPatternGcc.match(Str.strip())
if m is not None:
- varoffset.append((varname, int(m.groups(0)[0], 16) , int(sections[-1][1], 16), sections[-1][0]))
+ varoffset.append((varname, int(m.groups(0)[0], 16), int(sections[-1][1], 16), sections[-1][0]))
if not varoffset:
return []
@@ -1469,7 +1469,7 @@ def AnalyzeDscPcd(Setting, PcdType, DataType=''): # Value, Size = ParseFieldValue(Value)
if Size:
try:
- int(Size,16) if Size.upper().startswith("0X") else int(Size)
+ int(Size, 16) if Size.upper().startswith("0X") else int(Size)
except:
IsValid = False
Size = -1
@@ -1490,7 +1490,7 @@ def AnalyzeDscPcd(Setting, PcdType, DataType=''): if Size:
try:
- int(Size,16) if Size.upper().startswith("0X") else int(Size)
+ int(Size, 16) if Size.upper().startswith("0X") else int(Size)
except:
IsValid = False
Size = -1
@@ -1512,7 +1512,7 @@ def AnalyzeDscPcd(Setting, PcdType, DataType=''): IsValid = (len(FieldList) <= 3)
if Size:
try:
- int(Size,16) if Size.upper().startswith("0X") else int(Size)
+ int(Size, 16) if Size.upper().startswith("0X") else int(Size)
except:
IsValid = False
Size = -1
@@ -1670,7 +1670,7 @@ def ConvertStringToByteArray(Value): Value = eval(Value) # translate escape character
NewValue = '{'
- for Index in range(0,len(Value)):
+ for Index in range(0, len(Value)):
if Unicode:
NewValue = NewValue + str(ord(Value[Index]) % 0x10000) + ','
else:
@@ -1914,28 +1914,28 @@ class PeImageClass(): return Value
class DefaultStore():
- def __init__(self,DefaultStores ):
+ def __init__(self, DefaultStores ):
self.DefaultStores = DefaultStores
- def DefaultStoreID(self,DefaultStoreName):
- for key,value in self.DefaultStores.items():
+ def DefaultStoreID(self, DefaultStoreName):
+ for key, value in self.DefaultStores.items():
if value == DefaultStoreName:
return key
return None
def GetDefaultDefault(self):
if not self.DefaultStores or "0" in self.DefaultStores:
- return "0",TAB_DEFAULT_STORES_DEFAULT
+ return "0", TAB_DEFAULT_STORES_DEFAULT
else:
minvalue = min(int(value_str) for value_str in self.DefaultStores)
return (str(minvalue), self.DefaultStores[str(minvalue)])
- def GetMin(self,DefaultSIdList):
+ def GetMin(self, DefaultSIdList):
if not DefaultSIdList:
return TAB_DEFAULT_STORES_DEFAULT
storeidset = {storeid for storeid, storename in self.DefaultStores.values() if storename in DefaultSIdList}
if not storeidset:
return ""
minid = min(storeidset )
- for sid,name in self.DefaultStores.values():
+ for sid, name in self.DefaultStores.values():
if sid == minid:
return name
class SkuClass():
@@ -1950,7 +1950,7 @@ class SkuClass(): for SkuName in SkuIds:
SkuId = SkuIds[SkuName][0]
- skuid_num = int(SkuId,16) if SkuId.upper().startswith("0X") else int(SkuId)
+ skuid_num = int(SkuId, 16) if SkuId.upper().startswith("0X") else int(SkuId)
if skuid_num > 0xFFFFFFFFFFFFFFFF:
EdkLogger.error("build", PARAMETER_INVALID,
ExtraData = "SKU-ID [%s] value %s exceeds the max value of UINT64"
@@ -2003,9 +2003,9 @@ class SkuClass(): self.__SkuInherit = {}
for item in self.SkuData.values():
self.__SkuInherit[item[1]]=item[2] if item[2] else "DEFAULT"
- return self.__SkuInherit.get(skuname,"DEFAULT")
+ return self.__SkuInherit.get(skuname, "DEFAULT")
- def GetSkuChain(self,sku):
+ def GetSkuChain(self, sku):
if sku == "DEFAULT":
return ["DEFAULT"]
skulist = [sku]
diff --git a/BaseTools/Source/Python/Common/RangeExpression.py b/BaseTools/Source/Python/Common/RangeExpression.py index 4c29bc9ee4..1cf975ba7b 100644 --- a/BaseTools/Source/Python/Common/RangeExpression.py +++ b/BaseTools/Source/Python/Common/RangeExpression.py @@ -17,7 +17,7 @@ from Common.GlobalData import * from CommonDataClass.Exceptions import BadExpression
from CommonDataClass.Exceptions import WrnExpression
import uuid
-from Common.Expression import PcdPattern,BaseExpression
+from Common.Expression import PcdPattern, BaseExpression
from Common.DataType import *
ERR_STRING_EXPR = 'This operator cannot be used in string expression: [%s].'
@@ -167,7 +167,7 @@ class EQOperatorObject(object): raise BadExpression(ERR_SNYTAX % Expr)
rangeId1 = str(uuid.uuid1())
rangeContainer = RangeContainer()
- rangeContainer.push(RangeObject(int(Operand) , int(Operand)))
+ rangeContainer.push(RangeObject(int(Operand), int(Operand)))
SymbolTable[rangeId1] = rangeContainer
return rangeId1
@@ -453,7 +453,7 @@ class RangeExpression(BaseExpression): # [!]*A
def _RelExpr(self):
- if self._IsOperator({"NOT" , "LE", "GE", "LT", "GT", "EQ", "XOR"}):
+ if self._IsOperator({"NOT", "LE", "GE", "LT", "GT", "EQ", "XOR"}):
Token = self._Token
Val = self._NeExpr()
try:
diff --git a/BaseTools/Source/Python/Common/StringUtils.py b/BaseTools/Source/Python/Common/StringUtils.py index 2292a263b9..25dd4b264c 100644 --- a/BaseTools/Source/Python/Common/StringUtils.py +++ b/BaseTools/Source/Python/Common/StringUtils.py @@ -750,7 +750,7 @@ def SplitString(String): # @param StringList: A list for strings to be converted
#
def ConvertToSqlString(StringList):
- return map(lambda s: s.replace("'", "''") , StringList)
+ return map(lambda s: s.replace("'", "''"), StringList)
## Convert To Sql String
#
diff --git a/BaseTools/Source/Python/Common/ToolDefClassObject.py b/BaseTools/Source/Python/Common/ToolDefClassObject.py index dd985ab303..fb95a0353c 100644 --- a/BaseTools/Source/Python/Common/ToolDefClassObject.py +++ b/BaseTools/Source/Python/Common/ToolDefClassObject.py @@ -26,9 +26,9 @@ from Common.StringUtils import NormPath import Common.GlobalData as GlobalData
from Common import GlobalData
from Common.MultipleWorkspace import MultipleWorkspace as mws
-from DataType import TAB_TOD_DEFINES_TARGET,TAB_TOD_DEFINES_TOOL_CHAIN_TAG,\
- TAB_TOD_DEFINES_TARGET_ARCH,TAB_TOD_DEFINES_COMMAND_TYPE\
- ,TAB_TOD_DEFINES_FAMILY,TAB_TOD_DEFINES_BUILDRULEFAMILY
+from DataType import TAB_TOD_DEFINES_TARGET, TAB_TOD_DEFINES_TOOL_CHAIN_TAG,\
+ TAB_TOD_DEFINES_TARGET_ARCH, TAB_TOD_DEFINES_COMMAND_TYPE\
+ , TAB_TOD_DEFINES_FAMILY, TAB_TOD_DEFINES_BUILDRULEFAMILY
##
diff --git a/BaseTools/Source/Python/Common/VpdInfoFile.py b/BaseTools/Source/Python/Common/VpdInfoFile.py index ddabe9fb25..93175d41e9 100644 --- a/BaseTools/Source/Python/Common/VpdInfoFile.py +++ b/BaseTools/Source/Python/Common/VpdInfoFile.py @@ -88,7 +88,7 @@ class VpdInfoFile: #
# @param offset integer value for VPD's offset in specific SKU.
#
- def Add(self, Vpd, skuname,Offset):
+ def Add(self, Vpd, skuname, Offset):
if (Vpd is None):
EdkLogger.error("VpdInfoFile", BuildToolError.ATTRIBUTE_UNKNOWN_ERROR, "Invalid VPD PCD entry.")
@@ -140,7 +140,7 @@ class VpdInfoFile: if PcdValue == "" :
PcdValue = Pcd.DefaultValue
- Content += "%s.%s|%s|%s|%s|%s \n" % (Pcd.TokenSpaceGuidCName, PcdTokenCName, skuname,str(self._VpdArray[Pcd][skuname]).strip(), str(Pcd.MaxDatumSize).strip(),PcdValue)
+ Content += "%s.%s|%s|%s|%s|%s \n" % (Pcd.TokenSpaceGuidCName, PcdTokenCName, skuname, str(self._VpdArray[Pcd][skuname]).strip(), str(Pcd.MaxDatumSize).strip(), PcdValue)
i += 1
return SaveFileOnChange(FilePath, Content, False)
@@ -169,8 +169,8 @@ class VpdInfoFile: # the line must follow output format defined in BPDG spec.
#
try:
- PcdName, SkuId,Offset, Size, Value = Line.split("#")[0].split("|")
- PcdName, SkuId,Offset, Size, Value = PcdName.strip(), SkuId.strip(),Offset.strip(), Size.strip(), Value.strip()
+ PcdName, SkuId, Offset, Size, Value = Line.split("#")[0].split("|")
+ PcdName, SkuId, Offset, Size, Value = PcdName.strip(), SkuId.strip(), Offset.strip(), Size.strip(), Value.strip()
TokenSpaceName, PcdTokenName = PcdName.split(".")
except:
EdkLogger.error("BPDG", BuildToolError.PARSER_ERROR, "Fail to parse VPD information file %s" % FilePath)
@@ -179,7 +179,7 @@ class VpdInfoFile: if (TokenSpaceName, PcdTokenName) not in self._VpdInfo:
self._VpdInfo[(TokenSpaceName, PcdTokenName)] = []
- self._VpdInfo[(TokenSpaceName, PcdTokenName)].append((SkuId,Offset, Value))
+ self._VpdInfo[(TokenSpaceName, PcdTokenName)].append((SkuId, Offset, Value))
for VpdObject in self._VpdArray:
VpdObjectTokenCName = VpdObject.TokenCName
for PcdItem in GlobalData.MixedPcd:
|