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

Commit

Permalink
Fixed code misc. quality issues (#9649)
Browse files Browse the repository at this point in the history
- Merge 'isinstance' calls.
- Remove unnecessary dict call outside of comprehension.
- Use 'sys.exit()' calls.
  • Loading branch information
powerexploit authored Mar 22, 2021
1 parent d600d45 commit d66f907
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions changelog.d/9649.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fixed some antipattern issues to improve code quality.
2 changes: 1 addition & 1 deletion scripts/move_remote_media_to_new_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def main(src_repo, dest_repo):
parts = line.split("|")
if len(parts) != 2:
print("Unable to parse input line %s" % line, file=sys.stderr)
exit(1)
sys.exit(1)

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

Expand Down
2 changes: 1 addition & 1 deletion synapse/push/httppusher.py
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ async def _process_one(self, push_action: dict) -> bool:
if rejected is False:
return False

if isinstance(rejected, list) or isinstance(rejected, tuple):
if isinstance(rejected, (list, tuple)):
for pk in rejected:
if pk != self.pushkey:
# for sanity, we only remove the pushkey if it
Expand Down
2 changes: 1 addition & 1 deletion synapse/util/frozenutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def freeze(o):

def unfreeze(o):
if isinstance(o, (dict, frozendict)):
return dict({k: unfreeze(v) for k, v in o.items()})
return {k: unfreeze(v) for k, v in o.items()}

if isinstance(o, (bytes, str)):
return o
Expand Down

0 comments on commit d66f907

Please sign in to comment.