diff options
author | H. Shay <hillerys@element.io> | 2022-01-04 10:24:57 -0800 |
---|---|---|
committer | H. Shay <hillerys@element.io> | 2022-01-04 10:24:57 -0800 |
commit | 68882a0251fcc3f4f0231b92c3d3d5c66ba454e7 (patch) | |
tree | 420bc1deef48bc8358280bbc30db8431a3bf2e07 | |
parent | run pyupgrade on synapse/_scripts and synapse/api (diff) | |
download | synapse-68882a0251fcc3f4f0231b92c3d3d5c66ba454e7.tar.xz |
run pyupgrade on synapse/app and synapse/appservice
-rw-r--r-- | synapse/app/_base.py | 2 | ||||
-rw-r--r-- | synapse/app/admin_cmd.py | 2 | ||||
-rw-r--r-- | synapse/app/generic_worker.py | 2 | ||||
-rw-r--r-- | synapse/app/homeserver.py | 10 | ||||
-rw-r--r-- | synapse/app/phone_stats_home.py | 2 | ||||
-rw-r--r-- | synapse/appservice/__init__.py | 2 | ||||
-rw-r--r-- | synapse/appservice/api.py | 4 | ||||
-rw-r--r-- | synapse/appservice/scheduler.py | 4 |
8 files changed, 14 insertions, 14 deletions
diff --git a/synapse/app/_base.py b/synapse/app/_base.py index 5fc59c1be1..152d1e5367 100644 --- a/synapse/app/_base.py +++ b/synapse/app/_base.py @@ -183,7 +183,7 @@ def quit_with_error(error_string: str) -> NoReturn: line_length = min(max(len(line) for line in message_lines), 80) + 2 sys.stderr.write("*" * line_length + "\n") for line in message_lines: - sys.stderr.write(" %s\n" % (line.rstrip(),)) + sys.stderr.write(f" {line.rstrip()}\n") sys.stderr.write("*" * line_length + "\n") sys.exit(1) diff --git a/synapse/app/admin_cmd.py b/synapse/app/admin_cmd.py index 42238f7f28..053593e962 100644 --- a/synapse/app/admin_cmd.py +++ b/synapse/app/admin_cmd.py @@ -102,7 +102,7 @@ class FileExfiltrationWriter(ExfiltrationWriter): self.base_directory = directory else: self.base_directory = tempfile.mkdtemp( - prefix="synapse-exfiltrate__%s__" % (user_id,) + prefix=f"synapse-exfiltrate__{user_id}__" ) os.makedirs(self.base_directory, exist_ok=True) diff --git a/synapse/app/generic_worker.py b/synapse/app/generic_worker.py index e256de2003..55440ec1f0 100644 --- a/synapse/app/generic_worker.py +++ b/synapse/app/generic_worker.py @@ -381,7 +381,7 @@ class GenericWorkerServer(HomeServer): bind_addresses, port, SynapseSite( - "synapse.access.http.%s" % (site_tag,), + f"synapse.access.http.{site_tag}", site_tag, listener_config, root_resource, diff --git a/synapse/app/homeserver.py b/synapse/app/homeserver.py index 177ce040e8..b136b60f49 100644 --- a/synapse/app/homeserver.py +++ b/synapse/app/homeserver.py @@ -114,7 +114,7 @@ class SynapseHomeServer(HomeServer): for path, resmodule in additional_resources.items(): handler_cls, config = load_module( resmodule, - ("listeners", site_tag, "additional_resources", "<%s>" % (path,)), + ("listeners", site_tag, "additional_resources", f"<{path}>"), ) handler = handler_cls(config, module_api) if isinstance(handler, Resource): @@ -141,7 +141,7 @@ class SynapseHomeServer(HomeServer): root_resource = OptionsResource() site = SynapseSite( - "synapse.access.%s.%s" % ("https" if tls else "http", site_tag), + "synapse.access.{}.{}".format("https" if tls else "http", site_tag), site_tag, listener_config, create_resource_tree(resources, root_resource), @@ -417,15 +417,15 @@ def format_config_error(e: ConfigError) -> Iterator[str]: yield "Error in configuration" if e.path: - yield " at '%s'" % (".".join(e.path),) + yield " at '{}'".format(".".join(e.path)) - yield ":\n %s" % (e.msg,) + yield f":\n {e.msg}" parent_e = e.__cause__ indent = 1 while parent_e: indent += 1 - yield ":\n%s%s" % (" " * indent, str(parent_e)) + yield ":\n{}{}".format(" " * indent, str(parent_e)) parent_e = parent_e.__cause__ diff --git a/synapse/app/phone_stats_home.py b/synapse/app/phone_stats_home.py index 899dba5c3d..0a9403683b 100644 --- a/synapse/app/phone_stats_home.py +++ b/synapse/app/phone_stats_home.py @@ -143,7 +143,7 @@ async def phone_stats_home( stats["log_level"] = logging.getLevelName(log_level) logger.info( - "Reporting stats to %s: %s" % (hs.config.metrics.report_stats_endpoint, stats) + f"Reporting stats to {hs.config.metrics.report_stats_endpoint}: {stats}" ) try: await hs.get_proxied_http_client().put_json( diff --git a/synapse/appservice/__init__.py b/synapse/appservice/__init__.py index 8c9ff93b2c..e58f5e7f62 100644 --- a/synapse/appservice/__init__.py +++ b/synapse/appservice/__init__.py @@ -339,7 +339,7 @@ class ApplicationService: dict_copy = self.__dict__.copy() dict_copy["token"] = "<redacted>" dict_copy["hs_token"] = "<redacted>" - return "ApplicationService: %s" % (dict_copy,) + return f"ApplicationService: {dict_copy}" class AppServiceTransaction: diff --git a/synapse/appservice/api.py b/synapse/appservice/api.py index def4424af0..5f21b7c2b8 100644 --- a/synapse/appservice/api.py +++ b/synapse/appservice/api.py @@ -149,7 +149,7 @@ class ApplicationServiceApi(SimpleHttpClient): if service.url is None: return [] - uri = "%s%s/thirdparty/%s/%s" % ( + uri = "{}{}/thirdparty/{}/{}".format( service.url, APP_SERVICE_PREFIX, kind, @@ -184,7 +184,7 @@ class ApplicationServiceApi(SimpleHttpClient): return {} async def _get() -> Optional[JsonDict]: - uri = "%s%s/thirdparty/protocol/%s" % ( + uri = "{}{}/thirdparty/protocol/{}".format( service.url, APP_SERVICE_PREFIX, urllib.parse.quote(protocol), diff --git a/synapse/appservice/scheduler.py b/synapse/appservice/scheduler.py index 185e3a5278..da9d6ab794 100644 --- a/synapse/appservice/scheduler.py +++ b/synapse/appservice/scheduler.py @@ -133,7 +133,7 @@ class _ServiceQueuer: return run_as_background_process( - "as-sender-%s" % (service.id,), self._send_request, service + f"as-sender-{service.id}", self._send_request, service ) def enqueue_event(self, service: ApplicationService, event: EventBase) -> None: @@ -282,7 +282,7 @@ class _Recoverer: def recover(self) -> None: def _retry() -> None: run_as_background_process( - "as-recoverer-%s" % (self.service.id,), self.retry + f"as-recoverer-{self.service.id}", self.retry ) delay = 2 ** self.backoff_counter |