ruff: Fix UP032 Use f-string instead of format call.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
(cherry picked from commit e932e2ce52)
This commit is contained in:
Anders Kaseorg
2023-08-02 15:28:59 -07:00
committed by Alex Vandiver
parent 323223db4c
commit 99b37de89f
14 changed files with 51 additions and 75 deletions

View File

@@ -52,7 +52,7 @@ if __name__ == "__main__":
if args.remove:
remove_re = re.compile(
"#<{0}>{{{{.+}}}}<{0}>(\n)?".format(args.username), re.DOTALL | re.MULTILINE
rf"#<{args.username}>{{{{.+}}}}<{args.username}>(\n)?", re.DOTALL | re.MULTILINE
)
with open(authorized_keys, "r+") as f:

View File

@@ -97,8 +97,8 @@ def assert_droplet_does_not_exist(my_token: str, droplet_name: str, recreate: bo
if droplet.name.lower() == droplet_name:
if not recreate:
print(
"Droplet {} already exists. Pass --recreate if you "
"need to recreate the droplet.".format(droplet_name)
f"Droplet {droplet_name} already exists. Pass --recreate if you "
"need to recreate the droplet."
)
sys.exit(1)
else:
@@ -251,8 +251,8 @@ def create_dns_record(my_token: str, record_name: str, ipv4: str, ipv6: str) ->
def print_dev_droplet_instructions(username: str, droplet_domain_name: str) -> None:
print(
"""
COMPLETE! Droplet for GitHub user {0} is available at {1}.
f"""
COMPLETE! Droplet for GitHub user {username} is available at {droplet_domain_name}.
Instructions for use are below. (copy and paste to the user)
@@ -260,16 +260,14 @@ Instructions for use are below. (copy and paste to the user)
Your remote Zulip dev server has been created!
- Connect to your server by running
`ssh zulipdev@{1}` on the command line
`ssh zulipdev@{droplet_domain_name}` on the command line
(Terminal for macOS and Linux, Bash for Git on Windows).
- There is no password; your account is configured to use your SSH keys.
- Once you log in, you should see `(zulip-py3-venv) ~$`.
- To start the dev server, `cd zulip` and then run `./tools/run-dev`.
- While the dev server is running, you can see the Zulip server in your browser at
http://{1}:9991.
""".format(
username, droplet_domain_name
)
http://{droplet_domain_name}:9991.
"""
)
print(

View File

@@ -130,8 +130,8 @@ def custom_headers(headers_json: str) -> Dict[str, str]:
return orjson.loads(headers_json)
except orjson.JSONDecodeError as ve:
raise argparse.ArgumentTypeError(
"Encountered an error while attempting to parse custom headers: {}\n"
"Note: all strings must be enclosed within \"\" instead of ''".format(ve)
f"Encountered an error while attempting to parse custom headers: {ve}\n"
"Note: all strings must be enclosed within \"\" instead of ''"
)
@@ -156,10 +156,8 @@ def send_bot_mock_message(
client.send_message(request)
except KeyError:
print(
"{} contains invalid configuration. "
'Fields "subject" and "body" are required for non-webhook integrations.'.format(
fixture_path
)
f"{fixture_path} contains invalid configuration. "
'Fields "subject" and "body" are required for non-webhook integrations.'
)
sys.exit(1)