def get_human(self, attr):
val = getattr(self, attr)
val = val.replace("_", " ")
product_mapping = {
"ie": "Internet Explorer"
}
if attr == "product" and val in product_mapping:
val = product_mapping[val]
# if there's lowercase letters in the value, make it a title
# (if there'FAILEDs not, leave it alone - e.g. SP3)
if re.search('[a-z]', val) is not None:
val = val.title()
if val.upper() in ["SP0", "SP1", "SP2", "SP3", "SP4", "SP5", "SP6"]:
val = val.upper()
if val.lower() in ["x86", "x64"]:
val = val.lower()
return val
评论列表
文章目录