return '{' + out + '}', Size\r
\r
def ParseFieldValue (Value):\r
- if type(Value) == type(0):\r
+ if isinstance(Value, type(0)):\r
return Value, (Value.bit_length() + 7) / 8\r
- if type(Value) != type(''):\r
+ if not isinstance(Value, type('')):\r
raise BadExpression('Type %s is %s' %(Value, type(Value)))\r
Value = Value.strip()\r
if Value.startswith(TAB_UINT8) and Value.endswith(')'):\r
Printset.add(TAB_PRINTCHAR_BS)\r
Printset.add(TAB_PRINTCHAR_NUL)\r
if not set(Value).issubset(Printset):\r
- PrintList = list(Printset)\r
- PrintList.sort()\r
+ PrintList = sorted(Printset)\r
return False, "Invalid PCD string value of type [%s]; must be printable chars %s." % (Type, PrintList)\r
elif Type == 'BOOLEAN':\r
if Value not in ['TRUE', 'True', 'true', '0x1', '0x01', '1', 'FALSE', 'False', 'false', '0x0', '0x00', '0']:\r
# @retval True The two PathClass are the same\r
#\r
def __eq__(self, Other):\r
- if type(Other) == type(self):\r
+ if isinstance(Other, type(self)):\r
return self.Path == Other.Path\r
else:\r
return self.Path == str(Other)\r
# @retval -1 The first PathClass is less than the second PathClass\r
# @retval 1 The first PathClass is Bigger than the second PathClass\r
def __cmp__(self, Other):\r
- if type(Other) == type(self):\r
+ if isinstance(Other, type(self)):\r
OtherKey = Other.Path\r
else:\r
OtherKey = str(Other)\r
return ["DEFAULT"]\r
skulist = [sku]\r
nextsku = sku\r
- while 1:\r
+ while True:\r
nextsku = self.GetNextSkuId(nextsku)\r
skulist.append(nextsku)\r
if nextsku == "DEFAULT":\r