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

Commit 4880231

Browse files
committed
Fixed code quality issues
- Consider merging 'isinstance' calls - Remove 'redundant' call - Use 'sys.exit()' calls Signed-off-by: ankitdobhal <[email protected]>
1 parent 7b06f85 commit 4880231

File tree

4 files changed

+4
-3
lines changed

4 files changed

+4
-3
lines changed

changelog.d/9649.misc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fixed some antipattern issues to improve code quality.

scripts/move_remote_media_to_new_store.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def main(src_repo, dest_repo):
5151
parts = line.split("|")
5252
if len(parts) != 2:
5353
print("Unable to parse input line %s" % line, file=sys.stderr)
54-
exit(1)
54+
sys.exit(1)
5555

5656
move_media(parts[0], parts[1], src_paths, dest_paths)
5757

synapse/push/httppusher.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ async def _process_one(self, push_action: dict) -> bool:
290290
if rejected is False:
291291
return False
292292

293-
if isinstance(rejected, list) or isinstance(rejected, tuple):
293+
if isinstance(rejected, (list, tuple)):
294294
for pk in rejected:
295295
if pk != self.pushkey:
296296
# for sanity, we only remove the pushkey if it

synapse/util/frozenutils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def freeze(o):
3636

3737
def unfreeze(o):
3838
if isinstance(o, (dict, frozendict)):
39-
return dict({k: unfreeze(v) for k, v in o.items()})
39+
return {k: unfreeze(v) for k, v in o.items()}
4040

4141
if isinstance(o, (bytes, str)):
4242
return o

0 commit comments

Comments
 (0)