Generalized use of f-strings
This commit is contained in:
parent
e4d64839b8
commit
fa0acdbfff
@ -1,7 +1,7 @@
|
|||||||
init -1 python:
|
init -1 python:
|
||||||
def __check_exists(key):
|
def __check_exists(key):
|
||||||
if not key in states.dolls:
|
if not key in states.dolls:
|
||||||
raise KeyError("{!r} character is undefined.".format(key))
|
raise KeyError(f"{key!r} character is undefined.")
|
||||||
|
|
||||||
def get_character_progression(key):
|
def get_character_progression(key):
|
||||||
__check_exists(key)
|
__check_exists(key)
|
||||||
@ -25,32 +25,32 @@ init -1 python:
|
|||||||
|
|
||||||
def get_character_outfit(key, typ="default"):
|
def get_character_outfit(key, typ="default"):
|
||||||
__check_exists(key)
|
__check_exists(key)
|
||||||
return getattr(store, "{}_outfit_{}".format(key[:3], typ))
|
return getattr(store, f"{key[:3]}_outfit_{typ}")
|
||||||
|
|
||||||
def get_character_body(key, typ="default"):
|
def get_character_body(key, typ="default"):
|
||||||
__check_exists(key)
|
__check_exists(key)
|
||||||
return getattr(store, "{}_body_{}".format(key[:3], typ))
|
return getattr(store, f"{key[:3]}_body_{typ}")
|
||||||
|
|
||||||
def get_character_outfit_req(key, item):
|
def get_character_outfit_req(key, item):
|
||||||
__check_exists(key)
|
__check_exists(key)
|
||||||
|
|
||||||
if not isinstance(item, DollOutfit):
|
if not isinstance(item, DollOutfit):
|
||||||
raise TypeError("{!r} is not a DollOutfit instance.".format(item))
|
raise TypeError(f"{item!r} is not a DollOutfit instance.")
|
||||||
|
|
||||||
req = ["{}: {}".format(i.type, i.level) for i in item.group]
|
req = [f"{i.type}: {i.level}" for i in item.group]
|
||||||
has_bra = any(i.type == "bra" for i in item.group)
|
has_bra = any(i.type == "bra" for i in item.group)
|
||||||
has_panties = any(i.type == "panties" for i in item.group)
|
has_panties = any(i.type == "panties" for i in item.group)
|
||||||
|
|
||||||
if not has_bra:
|
if not has_bra:
|
||||||
req += ["NO BRA: {}".format(get_character_requirement(key, "unequip bra"))]
|
req.append(f'NO BRA: {get_character_requirement(key, "unequip bra")}')
|
||||||
|
|
||||||
if not has_panties:
|
if not has_panties:
|
||||||
req += ["NO PANTIES: {}".format(get_character_requirement(key, "unequip panties"))]
|
req.append(f'NO PANTIES: {get_character_requirement(key, "unequip panties")}')
|
||||||
print("\n".join(req))
|
print("\n".join(req))
|
||||||
|
|
||||||
def get_character_tag(key):
|
def get_character_tag(key):
|
||||||
__check_exists(key)
|
__check_exists(key)
|
||||||
return "{}_main".format(key)
|
return f"{key}_main"
|
||||||
|
|
||||||
def get_character_sayer(key):
|
def get_character_sayer(key):
|
||||||
__check_exists(key)
|
__check_exists(key)
|
||||||
@ -58,15 +58,15 @@ init -1 python:
|
|||||||
|
|
||||||
def get_character_gift_label(key):
|
def get_character_gift_label(key):
|
||||||
__check_exists(key)
|
__check_exists(key)
|
||||||
return "give_{}_gift".format(key[:3])
|
return f"give_{key[:3]}_gift"
|
||||||
|
|
||||||
def get_character_potion_check_label(key):
|
def get_character_potion_check_label(key):
|
||||||
__check_exists(key)
|
__check_exists(key)
|
||||||
return "{}_potion_check".format(key[:3])
|
return f"{key[:3]}_potion_check"
|
||||||
|
|
||||||
def get_character_potion_check(key):
|
def get_character_potion_check(key):
|
||||||
__check_exists(key)
|
__check_exists(key)
|
||||||
return getattr(store, "{}_potion_check".format(key[:3]))
|
return getattr(store, f"{key[:3]}_potion_check")
|
||||||
|
|
||||||
def get_character_unlock(key):
|
def get_character_unlock(key):
|
||||||
__check_exists(key)
|
__check_exists(key)
|
||||||
|
Loading…
Reference in New Issue
Block a user