mirror of
https://github.com/evennia/evennia.git
synced 2026-03-16 21:06:30 +01:00
issue #2243 -- prefer f-strings over %-interpolation
edited docs to prefer f-strings, then str.format(), and remove %-interpolation additional ad-hoc documentation fixes, as opportunities seen: - replace Built-In Function (BIF) "min" variable with "mins" - prefer BIF str(var) over "%s" % var - reformat some code examples to clarify multiple args passed to functions - change some single-quote strings to double-quotes for consistency - fix mismatched parens misc edits: - add .vscode/ to gitignore
This commit is contained in:
parent
f45051050e
commit
851ca30be5
30 changed files with 207 additions and 193 deletions
|
|
@ -531,10 +531,10 @@ def _set_attribute(caller, raw_string, **kwargs):
|
|||
|
||||
def node_background(caller):
|
||||
text = \
|
||||
"""
|
||||
{} experienced a traumatic event
|
||||
f"""
|
||||
{caller.key} experienced a traumatic event
|
||||
in their childhood. What was it?
|
||||
""".format(caller.key}
|
||||
"""
|
||||
|
||||
options = ({"key": "death",
|
||||
"desc": "A violent death in the family",
|
||||
|
|
@ -580,7 +580,7 @@ def _set_name(caller, raw_string, **kwargs):
|
|||
# a blank input either means OK or Abort
|
||||
if prev_entry:
|
||||
caller.key = prev_entry
|
||||
caller.msg("Set name to {}.".format(prev_entry))
|
||||
caller.msg(f"Set name to {prev_entry}.")
|
||||
return "node_background"
|
||||
else:
|
||||
caller.msg("Aborted.")
|
||||
|
|
@ -644,7 +644,7 @@ def _set_name(caller, raw_string, **kwargs):
|
|||
|
||||
caller.ndb._menutree.charactersheet = {}
|
||||
caller.ndb._menutree.charactersheet['name'] = raw_string
|
||||
caller.msg("You set your name to {}".format(raw_string)
|
||||
caller.msg(f"You set your name to {raw_string}")
|
||||
return "background"
|
||||
|
||||
def node_set_name(caller):
|
||||
|
|
@ -658,7 +658,7 @@ def node_set_name(caller):
|
|||
|
||||
|
||||
def node_view_sheet(caller):
|
||||
text = "Character sheet:\n {}".format(self.ndb._menutree.charactersheet)
|
||||
text = f"Character sheet:\n {self.ndb._menutree.charactersheet}"
|
||||
|
||||
options = ({"key": "Accept",
|
||||
"goto": "finish_chargen"},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue