mirror of
https://github.com/zulip/zulip.git
synced 2025-11-04 22:13:26 +00:00
ruff: Fix more of RUF010 Use conversion in f-string.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
@@ -104,7 +104,7 @@ class Equals:
|
|||||||
def schema(self, var_name: str) -> str:
|
def schema(self, var_name: str) -> str:
|
||||||
# Treat Equals as the degenerate case of EnumType, which
|
# Treat Equals as the degenerate case of EnumType, which
|
||||||
# matches how we do things with OpenAPI.
|
# matches how we do things with OpenAPI.
|
||||||
return f"{var_name} in {repr([self.expected_value])}"
|
return f"{var_name} in {[self.expected_value]!r}"
|
||||||
|
|
||||||
|
|
||||||
class NumberType:
|
class NumberType:
|
||||||
|
|||||||
@@ -94,7 +94,7 @@ class QueueClient(Generic[ChannelT], metaclass=ABCMeta):
|
|||||||
)
|
)
|
||||||
|
|
||||||
def _generate_ctag(self, queue_name: str) -> str:
|
def _generate_ctag(self, queue_name: str) -> str:
|
||||||
return f"{queue_name}_{str(random.getrandbits(16))}"
|
return f"{queue_name}_{random.getrandbits(16)}"
|
||||||
|
|
||||||
def _reconnect_consumer_callback(self, queue: str, consumer: Consumer[ChannelT]) -> None:
|
def _reconnect_consumer_callback(self, queue: str, consumer: Consumer[ChannelT]) -> None:
|
||||||
self.log.info("Queue reconnecting saved consumer %r to queue %s", consumer, queue)
|
self.log.info("Queue reconnecting saved consumer %r to queue %s", consumer, queue)
|
||||||
|
|||||||
@@ -1065,7 +1065,7 @@ Output:
|
|||||||
have decided to send a message to a stream without the sender being
|
have decided to send a message to a stream without the sender being
|
||||||
subscribed.
|
subscribed.
|
||||||
|
|
||||||
Please do self.subscribe(<user for {sender.full_name}>, {repr(stream_name)}) first.
|
Please do self.subscribe(<user for {sender.full_name}>, {stream_name!r}) first.
|
||||||
|
|
||||||
Or choose a stream that the user is already subscribed to:
|
Or choose a stream that the user is already subscribed to:
|
||||||
|
|
||||||
@@ -1189,7 +1189,7 @@ Output:
|
|||||||
if actual_count != count: # nocoverage
|
if actual_count != count: # nocoverage
|
||||||
print("\nITEMS:\n")
|
print("\nITEMS:\n")
|
||||||
for index, query in enumerate(queries):
|
for index, query in enumerate(queries):
|
||||||
print(f"#{index + 1}\nsql: {str(query.sql)}\ntime: {query.time}\n")
|
print(f"#{index + 1}\nsql: {query.sql}\ntime: {query.time}\n")
|
||||||
print(f"expected count: {count}\nactual count: {actual_count}")
|
print(f"expected count: {count}\nactual count: {actual_count}")
|
||||||
raise AssertionError(
|
raise AssertionError(
|
||||||
f"""
|
f"""
|
||||||
|
|||||||
@@ -366,7 +366,7 @@ so maybe we shouldn't mark it as intentionally undocumented in the URLs.
|
|||||||
The types for the request parameters in zerver/openapi/zulip.yaml
|
The types for the request parameters in zerver/openapi/zulip.yaml
|
||||||
do not match the types declared in the implementation of {function.__name__}.\n"""
|
do not match the types declared in the implementation of {function.__name__}.\n"""
|
||||||
msg += "=" * 65 + "\n"
|
msg += "=" * 65 + "\n"
|
||||||
msg += "{:<10s}{:^30s}{:>10s}\n".format(
|
msg += "{:<10}{:^30}{:>10}\n".format(
|
||||||
"parameter", "OpenAPI type", "function declaration type"
|
"parameter", "OpenAPI type", "function declaration type"
|
||||||
)
|
)
|
||||||
msg += "=" * 65 + "\n"
|
msg += "=" * 65 + "\n"
|
||||||
@@ -382,7 +382,7 @@ do not match the types declared in the implementation of {function.__name__}.\n"
|
|||||||
if element[0] == vname:
|
if element[0] == vname:
|
||||||
fdvtype = element[1]
|
fdvtype = element[1]
|
||||||
break
|
break
|
||||||
msg += f"{vname:<10s}{str(opvtype):^30s}{str(fdvtype):>10s}\n"
|
msg += f"{vname:<10}{opvtype!s:^30}{fdvtype!s:>10}\n"
|
||||||
raise AssertionError(msg)
|
raise AssertionError(msg)
|
||||||
|
|
||||||
def check_argument_types(
|
def check_argument_types(
|
||||||
|
|||||||
@@ -399,9 +399,9 @@ class PushBouncerNotificationTest(BouncerTestCase):
|
|||||||
logger.output,
|
logger.output,
|
||||||
[
|
[
|
||||||
"INFO:zilencer.views:"
|
"INFO:zilencer.views:"
|
||||||
f"Deduplicating push registrations for server id:{server.id} user id:{hamlet.id} uuid:{str(hamlet.uuid)} and tokens:{sorted([t.token for t in android_tokens[:]])}",
|
f"Deduplicating push registrations for server id:{server.id} user id:{hamlet.id} uuid:{hamlet.uuid} and tokens:{sorted(t.token for t in android_tokens)}",
|
||||||
"INFO:zilencer.views:"
|
"INFO:zilencer.views:"
|
||||||
f"Sending mobile push notifications for remote user 6cde5f7a-1f7e-4978-9716-49f69ebfc9fe:<id:{hamlet.id}><uuid:{str(hamlet.uuid)}>: "
|
f"Sending mobile push notifications for remote user 6cde5f7a-1f7e-4978-9716-49f69ebfc9fe:<id:{hamlet.id}><uuid:{hamlet.uuid}>: "
|
||||||
"2 via FCM devices, 1 via APNs devices",
|
"2 via FCM devices, 1 via APNs devices",
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user