Skip to content
This repository was archived by the owner on Apr 26, 2024. It is now read-only.

Commit 400bc06

Browse files
committed
linting
1 parent a1de642 commit 400bc06

File tree

6 files changed

+25
-27
lines changed

6 files changed

+25
-27
lines changed

synapse/config/repository.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,12 @@ def read_config(self, config, **kwargs):
9494
self.max_spider_size = self.parse_size(config.get("max_spider_size", "10M"))
9595

9696
if self.enable_media_repo:
97-
self.media_store_path = self.ensure_directory(config.get("media_store_path", "media_store"))
98-
self.uploads_path = self.ensure_directory(config.get("uploads_path", "uploads"))
97+
self.media_store_path = self.ensure_directory(
98+
config.get("media_store_path", "media_store")
99+
)
100+
self.uploads_path = self.ensure_directory(
101+
config.get("uploads_path", "uploads")
102+
)
99103
else:
100104
self.media_store_path = None
101105
self.uploads_path = None

synapse/federation/federation_client.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1011,21 +1011,21 @@ def get_room_complexity(self, destination, room_id):
10111011
"""
10121012
try:
10131013
complexity = yield self.transport_layer.get_room_complexity(
1014-
destination=destination,
1015-
room_id=room_id
1014+
destination=destination, room_id=room_id
10161015
)
10171016
defer.returnValue(complexity)
10181017
except CodeMessageException as e:
10191018
# We didn't manage to get it -- probably a 404. We are okay if other
10201019
# servers don't give it to us.
10211020
logger.debug(
10221021
"Failed to fetch room complexity via %s for %s, got a %d",
1023-
destination, room_id, e.code
1022+
destination,
1023+
room_id,
1024+
e.code,
10241025
)
10251026
except Exception:
10261027
logger.exception(
1027-
"Failed to fetch room complexity via %s for %s",
1028-
destination, room_id
1028+
"Failed to fetch room complexity via %s for %s", destination, room_id
10291029
)
10301030

10311031
# If we don't manage to find it, return None. It's not an error if a

synapse/federation/transport/client.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -945,14 +945,9 @@ def get_room_complexity(self, destination, room_id):
945945
destination (str): The remote server
946946
room_id (str): The room ID to ask about.
947947
"""
948-
path = _create_path(
949-
FEDERATION_UNSTABLE_PREFIX, "/rooms/%s/complexity", room_id
950-
)
948+
path = _create_path(FEDERATION_UNSTABLE_PREFIX, "/rooms/%s/complexity", room_id)
951949

952-
return self.client.get_json(
953-
destination=destination,
954-
path=path
955-
)
950+
return self.client.get_json(destination=destination, path=path)
956951

957952

958953
def _create_path(federation_prefix, path, *args):

synapse/handlers/room_member.py

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1030,8 +1030,9 @@ def _remote_join(self, requester, remote_room_hosts, room_id, user, content):
10301030
)
10311031
if too_complex is True:
10321032
raise SynapseError(
1033-
code=400, msg=ROOM_COMPLEXITY_TOO_GREAT,
1034-
errcode=Codes.RESOURCE_LIMIT_EXCEEDED
1033+
code=400,
1034+
msg=ROOM_COMPLEXITY_TOO_GREAT,
1035+
errcode=Codes.RESOURCE_LIMIT_EXCEEDED,
10351036
)
10361037

10371038
# We don't do an auth check if we are doing an invite
@@ -1058,18 +1059,14 @@ def _remote_join(self, requester, remote_room_hosts, room_id, user, content):
10581059
return
10591060

10601061
# The room is too large. Leave.
1061-
requester = types.create_requester(
1062-
user, None, False, None
1063-
)
1062+
requester = types.create_requester(user, None, False, None)
10641063
yield self.update_membership(
1065-
requester=requester,
1066-
target=user,
1067-
room_id=room_id,
1068-
action="leave"
1064+
requester=requester, target=user, room_id=room_id, action="leave"
10691065
)
10701066
raise SynapseError(
1071-
code=400, msg=ROOM_COMPLEXITY_TOO_GREAT,
1072-
errcode=Codes.RESOURCE_LIMIT_EXCEEDED
1067+
code=400,
1068+
msg=ROOM_COMPLEXITY_TOO_GREAT,
1069+
errcode=Codes.RESOURCE_LIMIT_EXCEEDED,
10731070
)
10741071

10751072
@defer.inlineCallbacks

synapse/storage/events_worker.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -683,7 +683,9 @@ def get_current_state_event_counts(self, room_id):
683683
Deferred[int]
684684
"""
685685
return self.runInteraction(
686-
"get_current_state_event_counts", self._get_current_state_event_counts_txn, room_id
686+
"get_current_state_event_counts",
687+
self._get_current_state_event_counts_txn,
688+
room_id,
687689
)
688690

689691
def _get_current_state_event_counts_txn(self, txn, room_id):

tests/federation/test_complexity.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class RoomComplexityTests(unittest.HomeserverTestCase):
3636
login.register_servlets,
3737
]
3838

39-
def default_config(self, name='test'):
39+
def default_config(self, name="test"):
4040
config = super().default_config(name=name)
4141
config["limit_large_remote_room_joins"] = True
4242
config["limit_large_remote_room_complexity"] = 0.05

0 commit comments

Comments
 (0)