From ccaa7754a29728df0a7485932aab4909f6be116a Mon Sep 17 00:00:00 2001 From: Gary Lin Date: Mon, 25 Jun 2018 18:31:33 +0800 Subject: BaseTools: Adjust the spaces around commas and colons Based on "futurize -f lib2to3.fixes.fix_ws_comma" Contributed-under: TianoCore Contribution Agreement 1.1 Cc: Yonghong Zhu Cc: Liming Gao Signed-off-by: Gary Lin Reviewed-by: Yonghong Zhu --- BaseTools/Source/Python/Common/Expression.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'BaseTools/Source/Python/Common/Expression.py') 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] -- cgit v1.2.3