]> git.proxmox.com Git - mirror_edk2.git/blobdiff - BaseTools/Source/Python/Common/RangeExpression.py
BaseTools: Fix old python2 idioms
[mirror_edk2.git] / BaseTools / Source / Python / Common / RangeExpression.py
index 1cf975ba7bef626404f5f8a346c0951839863f80..014c75b8cebde26893395b38f15203da6e00d662 100644 (file)
@@ -97,7 +97,7 @@ class XOROperatorObject(object):
     def __init__(self):     \r
         pass\r
     def Calculate(self, Operand, DataType, SymbolTable): \r
-        if type(Operand) == type('') and not Operand.isalnum():\r
+        if isinstance(Operand, type('')) and not Operand.isalnum():\r
             Expr = "XOR ..."\r
             raise BadExpression(ERR_SNYTAX % Expr)\r
         rangeId = str(uuid.uuid1())\r
@@ -111,7 +111,7 @@ class LEOperatorObject(object):
     def __init__(self):     \r
         pass\r
     def Calculate(self, Operand, DataType, SymbolTable): \r
-        if type(Operand) == type('') and not Operand.isalnum():\r
+        if isinstance(Operand, type('')) and not Operand.isalnum():\r
             Expr = "LE ..."\r
             raise BadExpression(ERR_SNYTAX % Expr)\r
         rangeId1 = str(uuid.uuid1())\r
@@ -123,7 +123,7 @@ class LTOperatorObject(object):
     def __init__(self):     \r
         pass\r
     def Calculate(self, Operand, DataType, SymbolTable):\r
-        if type(Operand) == type('') and not Operand.isalnum():\r
+        if isinstance(Operand, type('')) and not Operand.isalnum():\r
             Expr = "LT ..." \r
             raise BadExpression(ERR_SNYTAX % Expr) \r
         rangeId1 = str(uuid.uuid1())\r
@@ -136,7 +136,7 @@ class GEOperatorObject(object):
     def __init__(self):     \r
         pass\r
     def Calculate(self, Operand, DataType, SymbolTable): \r
-        if type(Operand) == type('') and not Operand.isalnum():\r
+        if isinstance(Operand, type('')) and not Operand.isalnum():\r
             Expr = "GE ..."\r
             raise BadExpression(ERR_SNYTAX % Expr)\r
         rangeId1 = str(uuid.uuid1())\r
@@ -149,7 +149,7 @@ class GTOperatorObject(object):
     def __init__(self):     \r
         pass\r
     def Calculate(self, Operand, DataType, SymbolTable): \r
-        if type(Operand) == type('') and not Operand.isalnum():\r
+        if isinstance(Operand, type('')) and not Operand.isalnum():\r
             Expr = "GT ..."\r
             raise BadExpression(ERR_SNYTAX % Expr)\r
         rangeId1 = str(uuid.uuid1())\r
@@ -162,7 +162,7 @@ class EQOperatorObject(object):
     def __init__(self):     \r
         pass\r
     def Calculate(self, Operand, DataType, SymbolTable): \r
-        if type(Operand) == type('') and not Operand.isalnum():\r
+        if isinstance(Operand, type('')) and not Operand.isalnum():\r
             Expr = "EQ ..."\r
             raise BadExpression(ERR_SNYTAX % Expr)\r
         rangeId1 = str(uuid.uuid1())\r
@@ -350,7 +350,7 @@ class RangeExpression(BaseExpression):
     def __init__(self, Expression, PcdDataType, SymbolTable = {}):\r
         super(RangeExpression, self).__init__(self, Expression, PcdDataType, SymbolTable)\r
         self._NoProcess = False\r
-        if type(Expression) != type(''):\r
+        if not isinstance(Expression, type('')):\r
             self._Expr = Expression\r
             self._NoProcess = True\r
             return\r
@@ -571,7 +571,7 @@ class RangeExpression(BaseExpression):
                 Ex.Pcd = self._Token\r
                 raise Ex\r
             self._Token = RangeExpression(self._Symb[self._Token], self._Symb)(True, self._Depth + 1)\r
-            if type(self._Token) != type(''):\r
+            if not isinstance(self._Token, type('')):\r
                 self._LiteralToken = hex(self._Token)\r
                 return\r
 \r