mirror of
https://github.com/evennia/evennia.git
synced 2026-03-21 15:26: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
|
|
@ -252,11 +252,10 @@ class CmdTime(Command):
|
|||
def func(self):
|
||||
"""Execute the time command."""
|
||||
# Get the absolute game time
|
||||
year, month, day, hour, min, sec = custom_gametime.custom_gametime(absolute=True)
|
||||
string = "We are in year {year}, day {day}, month {month}."
|
||||
string += "\nIt's {hour:02}:{min:02}:{sec:02}."
|
||||
self.msg(string.format(year=year, month=month, day=day,
|
||||
hour=hour, min=min, sec=sec))
|
||||
year, month, day, hour, mins, secs = custom_gametime.custom_gametime(absolute=True)
|
||||
time_string = f"We are in year {year}, day {day}, month {month}."
|
||||
time_string += f"\nIt's {hour:02}:{mins:02}:{secs:02}."
|
||||
self.msg(time_string)
|
||||
```
|
||||
|
||||
Don't forget to add it in your CharacterCmdSet to see this command:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue