Skip to content

Commit 8203d81

Browse files
committed
codebase: Switch from format() to f-strings.
1 parent 3a2c96e commit 8203d81

File tree

1 file changed

+6
-20
lines changed

1 file changed

+6
-20
lines changed

zulip/integrations/codebase/zulip_codebase_mirror

Lines changed: 6 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ user_agent = "Codebase To Zulip Mirroring script (zulip-devel@googlegroups.com)"
4747
# find some form of JSON loader/dumper, with a preference order for speed.
4848
json_implementations = ["ujson", "cjson", "simplejson", "json"]
4949

50-
while len(json_implementations):
50+
while json_implementations:
5151
try:
5252
json = __import__(json_implementations.pop(0))
5353
break
@@ -125,11 +125,8 @@ def handle_event(event: Dict[str, Any]) -> None:
125125
else:
126126
if new_ref:
127127
branch = f"new branch {branch}"
128-
content = "{} pushed {} commit(s) to {} in project {}:\n\n".format(
129-
actor_name,
130-
num_commits,
131-
branch,
132-
project,
128+
content = (
129+
f"{actor_name} pushed {num_commits} commit(s) to {branch} in project {project}:\n\n"
133130
)
134131
for commit in raw_props.get("commits"):
135132
ref = commit.get("ref")
@@ -162,11 +159,8 @@ def handle_event(event: Dict[str, Any]) -> None:
162159

163160
content = ""
164161
if body is not None and len(body) > 0:
165-
content = "{} added a comment to ticket [#{}]({}):\n\n~~~ quote\n{}\n\n".format(
166-
actor_name,
167-
num,
168-
url,
169-
body,
162+
content = (
163+
f"{actor_name} added a comment to ticket [#{num}]({url}):\n\n~~~ quote\n{body}\n\n"
170164
)
171165

172166
if "status_id" in changes:
@@ -228,15 +222,7 @@ def handle_event(event: Dict[str, Any]) -> None:
228222

229223
subject = f"Deployment to {environment}"
230224

231-
content = "{} deployed [{}]({}) [through]({}) [{}]({}) to the **{}** environment.".format(
232-
actor_name,
233-
start_ref,
234-
start_ref_url,
235-
between_url,
236-
end_ref,
237-
end_ref_url,
238-
environment,
239-
)
225+
content = f"{actor_name} deployed [{start_ref}]({start_ref_url}) [through]({between_url}) [{end_ref}]({end_ref_url}) to the **{environment}** environment."
240226
if servers is not None:
241227
content += "\n\nServers deployed to: %s" % (
242228
", ".join(f"`{server}`" for server in servers)

0 commit comments

Comments
 (0)