diff --git a/synapse/handlers/account.py b/synapse/handlers/account.py
index 37cc3d3ff5..89e944bc17 100644
--- a/synapse/handlers/account.py
+++ b/synapse/handlers/account.py
@@ -118,10 +118,10 @@ class AccountHandler:
}
if self._use_account_validity_in_account_status:
- status[
- "org.matrix.expired"
- ] = await self._account_validity_handler.is_user_expired(
- user_id.to_string()
+ status["org.matrix.expired"] = (
+ await self._account_validity_handler.is_user_expired(
+ user_id.to_string()
+ )
)
return status
diff --git a/synapse/handlers/directory.py b/synapse/handlers/directory.py
index 5f3dc30b63..ad2b0f5fcc 100644
--- a/synapse/handlers/directory.py
+++ b/synapse/handlers/directory.py
@@ -265,9 +265,9 @@ class DirectoryHandler:
async def get_association(self, room_alias: RoomAlias) -> JsonDict:
room_id = None
if self.hs.is_mine(room_alias):
- result: Optional[
- RoomAliasMapping
- ] = await self.get_association_from_room_alias(room_alias)
+ result: Optional[RoomAliasMapping] = (
+ await self.get_association_from_room_alias(room_alias)
+ )
if result:
room_id = result.room_id
diff --git a/synapse/handlers/federation.py b/synapse/handlers/federation.py
index 2b7aad5b58..299588e476 100644
--- a/synapse/handlers/federation.py
+++ b/synapse/handlers/federation.py
@@ -1001,11 +1001,11 @@ class FederationHandler:
)
if include_auth_user_id:
- event_content[
- EventContentFields.AUTHORISING_USER
- ] = await self._event_auth_handler.get_user_which_could_invite(
- room_id,
- state_ids,
+ event_content[EventContentFields.AUTHORISING_USER] = (
+ await self._event_auth_handler.get_user_which_could_invite(
+ room_id,
+ state_ids,
+ )
)
builder = self.event_builder_factory.for_room_version(
diff --git a/synapse/handlers/federation_event.py b/synapse/handlers/federation_event.py
index 83f6a25981..c85deaed56 100644
--- a/synapse/handlers/federation_event.py
+++ b/synapse/handlers/federation_event.py
@@ -1367,9 +1367,9 @@ class FederationEventHandler:
)
if remote_event.is_state() and remote_event.rejected_reason is None:
- state_map[
- (remote_event.type, remote_event.state_key)
- ] = remote_event.event_id
+ state_map[(remote_event.type, remote_event.state_key)] = (
+ remote_event.event_id
+ )
return state_map
diff --git a/synapse/handlers/message.py b/synapse/handlers/message.py
index 7e5bb97f2a..0ce6eeee15 100644
--- a/synapse/handlers/message.py
+++ b/synapse/handlers/message.py
@@ -1654,9 +1654,9 @@ class EventCreationHandler:
expiry_ms=60 * 60 * 1000,
)
- self._external_cache_joined_hosts_updates[
- state_entry.state_group
- ] = None
+ self._external_cache_joined_hosts_updates[state_entry.state_group] = (
+ None
+ )
async def _validate_canonical_alias(
self,
diff --git a/synapse/handlers/presence.py b/synapse/handlers/presence.py
index 21d3c71d8e..37ee625f71 100644
--- a/synapse/handlers/presence.py
+++ b/synapse/handlers/presence.py
@@ -493,9 +493,9 @@ class WorkerPresenceHandler(BasePresenceHandler):
# The number of ongoing syncs on this process, by (user ID, device ID).
# Empty if _presence_enabled is false.
- self._user_device_to_num_current_syncs: Dict[
- Tuple[str, Optional[str]], int
- ] = {}
+ self._user_device_to_num_current_syncs: Dict[Tuple[str, Optional[str]], int] = (
+ {}
+ )
self.notifier = hs.get_notifier()
self.instance_id = hs.get_instance_id()
@@ -818,9 +818,9 @@ class PresenceHandler(BasePresenceHandler):
# Keeps track of the number of *ongoing* syncs on this process. While
# this is non zero a user will never go offline.
- self._user_device_to_num_current_syncs: Dict[
- Tuple[str, Optional[str]], int
- ] = {}
+ self._user_device_to_num_current_syncs: Dict[Tuple[str, Optional[str]], int] = (
+ {}
+ )
# Keeps track of the number of *ongoing* syncs on other processes.
#
diff --git a/synapse/handlers/profile.py b/synapse/handlers/profile.py
index 279d393a5a..e51e282a9f 100644
--- a/synapse/handlers/profile.py
+++ b/synapse/handlers/profile.py
@@ -320,9 +320,9 @@ class ProfileHandler:
server_name = host
if self._is_mine_server_name(server_name):
- media_info: Optional[
- Union[LocalMedia, RemoteMedia]
- ] = await self.store.get_local_media(media_id)
+ media_info: Optional[Union[LocalMedia, RemoteMedia]] = (
+ await self.store.get_local_media(media_id)
+ )
else:
media_info = await self.store.get_cached_remote_media(server_name, media_id)
diff --git a/synapse/handlers/relations.py b/synapse/handlers/relations.py
index 828a4b4cbd..931ac0c813 100644
--- a/synapse/handlers/relations.py
+++ b/synapse/handlers/relations.py
@@ -188,13 +188,13 @@ class RelationsHandler:
if include_original_event:
# Do not bundle aggregations when retrieving the original event because
# we want the content before relations are applied to it.
- return_value[
- "original_event"
- ] = await self._event_serializer.serialize_event(
- event,
- now,
- bundle_aggregations=None,
- config=serialize_options,
+ return_value["original_event"] = (
+ await self._event_serializer.serialize_event(
+ event,
+ now,
+ bundle_aggregations=None,
+ config=serialize_options,
+ )
)
if next_token:
diff --git a/synapse/handlers/room.py b/synapse/handlers/room.py
index 6b116dce8c..3278426ca3 100644
--- a/synapse/handlers/room.py
+++ b/synapse/handlers/room.py
@@ -538,10 +538,10 @@ class RoomCreationHandler:
# deep-copy the power-levels event before we start modifying it
# note that if frozen_dicts are enabled, `power_levels` will be a frozen
# dict so we can't just copy.deepcopy it.
- initial_state[
- (EventTypes.PowerLevels, "")
- ] = power_levels = copy_and_fixup_power_levels_contents(
- initial_state[(EventTypes.PowerLevels, "")]
+ initial_state[(EventTypes.PowerLevels, "")] = power_levels = (
+ copy_and_fixup_power_levels_contents(
+ initial_state[(EventTypes.PowerLevels, "")]
+ )
)
# Resolve the minimum power level required to send any state event
@@ -1362,9 +1362,11 @@ class RoomCreationHandler:
visibility = room_config.get("visibility", "private")
preset_name = room_config.get(
"preset",
- RoomCreationPreset.PRIVATE_CHAT
- if visibility == "private"
- else RoomCreationPreset.PUBLIC_CHAT,
+ (
+ RoomCreationPreset.PRIVATE_CHAT
+ if visibility == "private"
+ else RoomCreationPreset.PUBLIC_CHAT
+ ),
)
try:
preset_config = self._presets_dict[preset_name]
diff --git a/synapse/handlers/room_member.py b/synapse/handlers/room_member.py
index d238c40bcf..9e9f6cd062 100644
--- a/synapse/handlers/room_member.py
+++ b/synapse/handlers/room_member.py
@@ -1236,11 +1236,11 @@ class RoomMemberHandler(metaclass=abc.ABCMeta):
# If this is going to be a local join, additional information must
# be included in the event content in order to efficiently validate
# the event.
- content[
- EventContentFields.AUTHORISING_USER
- ] = await self.event_auth_handler.get_user_which_could_invite(
- room_id,
- state_before_join,
+ content[EventContentFields.AUTHORISING_USER] = (
+ await self.event_auth_handler.get_user_which_could_invite(
+ room_id,
+ state_before_join,
+ )
)
return False, []
diff --git a/synapse/handlers/sync.py b/synapse/handlers/sync.py
index 9122a79b4c..5bb8a1439d 100644
--- a/synapse/handlers/sync.py
+++ b/synapse/handlers/sync.py
@@ -1333,9 +1333,9 @@ class SyncHandler:
and auth_event.state_key == member
):
missing_members.discard(member)
- additional_state_ids[
- (EventTypes.Member, member)
- ] = auth_event.event_id
+ additional_state_ids[(EventTypes.Member, member)] = (
+ auth_event.event_id
+ )
break
if missing_members:
|