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

Commit 5d230b3

Browse files
committed
Merge branch 'develop' of github.com:matrix-org/synapse into anoa/improve_test_times
* 'develop' of github.com:matrix-org/synapse: (148 commits) Add script for finding files with unix line terminators (#7965) Convert the remaining media repo code to async / await. (#7947) Convert a synapse.events to async/await. (#7949) Convert groups and visibility code to async / await. (#7951) Convert push to async/await. (#7948) update changelog 1.18.0rc1 Fix error reporting when using `opentracing.trace` (#7961) Fix typing replication not being handled on master (#7959) Remove hacky error handling for inlineDeferreds. (#7950) Convert tests/rest/admin/test_room.py to unix file endings (#7953) Support oEmbed for media previews. (#7920) Convert state resolution to async/await (#7942) Fix up types and comments that refer to Deferreds. (#7945) Do not convert async functions to Deferreds in the interactive_auth_handler (#7944) Convert more of the media code to async/await (#7873) Return an empty body for OPTIONS requests. (#7886) Downgrade warning on client disconnect to INFO (#7928) Convert presence handler helpers to async/await. (#7939) Update the auth providers to be async. (#7935) ...
2 parents 7b0967f + c4ce0da commit 5d230b3

File tree

329 files changed

+10722
-6098
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

329 files changed

+10722
-6098
lines changed

CHANGES.md

Lines changed: 274 additions & 0 deletions

INSTALL.md

Lines changed: 5 additions & 7 deletions

README.rst

Lines changed: 6 additions & 6 deletions

changelog.d/7606.bugfix

Lines changed: 0 additions & 1 deletion
This file was deleted.

changelog.d/7636.misc

Lines changed: 0 additions & 1 deletion
This file was deleted.

changelog.d/7639.feature

Lines changed: 0 additions & 1 deletion
This file was deleted.

changelog.d/7648.bugfix

Lines changed: 0 additions & 1 deletion
This file was deleted.

changelog.d/7652.doc

Lines changed: 0 additions & 1 deletion
This file was deleted.

changelog.d/7657.misc

Lines changed: 0 additions & 1 deletion
This file was deleted.

changelog.d/7659.doc

Lines changed: 0 additions & 1 deletion
This file was deleted.

changelog.d/7663.bugfix

Lines changed: 0 additions & 1 deletion
This file was deleted.

changelog.d/7664.misc

Lines changed: 0 additions & 1 deletion
This file was deleted.

changelog.d/7673.feature

Lines changed: 0 additions & 1 deletion
This file was deleted.

changelog.d/7675.removal

Lines changed: 0 additions & 1 deletion
This file was deleted.

changelog.d/7677.bugfix

Lines changed: 0 additions & 1 deletion
This file was deleted.

changelog.d/7678.misc

Lines changed: 0 additions & 1 deletion
This file was deleted.

changelog.d/7679.misc

Lines changed: 0 additions & 1 deletion
This file was deleted.

changelog.d/7680.misc

Lines changed: 0 additions & 1 deletion
This file was deleted.

changelog.d/7681.misc

Lines changed: 0 additions & 1 deletion
This file was deleted.

changelog.d/7687.bugfix

Lines changed: 0 additions & 1 deletion
This file was deleted.

changelog.d/7688.bugfix

Lines changed: 0 additions & 1 deletion
This file was deleted.

changelog.d/7689.bugfix

Lines changed: 0 additions & 1 deletion
This file was deleted.

changelog.d/7691.bugfix

Lines changed: 0 additions & 1 deletion
This file was deleted.

changelog.d/7692.misc

Lines changed: 0 additions & 1 deletion
This file was deleted.

changelog.d/7697.misc

Lines changed: 0 additions & 1 deletion
This file was deleted.

changelog.d/7698.bugfix

Lines changed: 0 additions & 1 deletion
This file was deleted.

changelog.d/7701.bugfix

Lines changed: 0 additions & 1 deletion
This file was deleted.

changelog.d/7703.misc

Lines changed: 0 additions & 1 deletion
This file was deleted.

changelog.d/7704.misc

Lines changed: 0 additions & 1 deletion
This file was deleted.

changelog.d/7706.feature

Lines changed: 0 additions & 1 deletion
This file was deleted.

changelog.d/7708.bugfix

Lines changed: 0 additions & 1 deletion
This file was deleted.

changelog.d/7711.bugfix

Lines changed: 0 additions & 1 deletion
This file was deleted.

changelog.d/7712.misc

Lines changed: 0 additions & 1 deletion
This file was deleted.

changelog.d/7714.bugfix

Lines changed: 0 additions & 1 deletion
This file was deleted.

changelog.d/7716.feature

Lines changed: 0 additions & 1 deletion
This file was deleted.

changelog.d/7717.bugfix

Lines changed: 0 additions & 1 deletion
This file was deleted.

changelog.d/7718.feature

Lines changed: 0 additions & 1 deletion
This file was deleted.

changelog.d/7724.doc

Lines changed: 0 additions & 1 deletion
This file was deleted.

changelog.d/7725.misc

Lines changed: 0 additions & 1 deletion
This file was deleted.

changelog.d/7727.misc

Lines changed: 0 additions & 1 deletion
This file was deleted.

changelog.d/7730.bugfix

Lines changed: 0 additions & 1 deletion
This file was deleted.

changelog.d/7735.bugfix

Lines changed: 0 additions & 1 deletion
This file was deleted.

changelog.d/7738.misc

Lines changed: 0 additions & 1 deletion
This file was deleted.

changelog.d/7746.bugfix

Lines changed: 0 additions & 1 deletion
This file was deleted.

changelog.d/7947.misc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Convert various parts of the codebase to async/await.

changelog.d/7948.misc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Convert various parts of the codebase to async/await.

changelog.d/7949.misc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Convert various parts of the codebase to async/await.

changelog.d/7951.misc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Convert various parts of the codebase to async/await.

changelog.d/7965.misc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Add a script to detect source code files using non-unix line terminators.

contrib/cmdclient/console.py

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,6 @@
1717
""" Starts a synapse client console. """
1818
from __future__ import print_function
1919

20-
from twisted.internet import reactor, defer, threads
21-
from http import TwistedHttpClient
22-
2320
import argparse
2421
import cmd
2522
import getpass
@@ -28,12 +25,14 @@
2825
import sys
2926
import time
3027
import urllib
31-
import urlparse
28+
from http import TwistedHttpClient
3229

33-
import nacl.signing
3430
import nacl.encoding
31+
import nacl.signing
32+
import urlparse
33+
from signedjson.sign import SignatureVerifyException, verify_signed_json
3534

36-
from signedjson.sign import verify_signed_json, SignatureVerifyException
35+
from twisted.internet import defer, reactor, threads
3736

3837
CONFIG_JSON = "cmdclient_config.json"
3938

@@ -493,7 +492,7 @@ def do_list(self, line):
493492
"list messages <roomid> from=END&to=START&limit=3"
494493
"""
495494
args = self._parse(line, ["type", "roomid", "qp"])
496-
if not "type" in args or not "roomid" in args:
495+
if "type" not in args or "roomid" not in args:
497496
print("Must specify type and room ID.")
498497
return
499498
if args["type"] not in ["members", "messages"]:
@@ -508,7 +507,7 @@ def do_list(self, line):
508507
try:
509508
key_value = key_value_str.split("=")
510509
qp[key_value[0]] = key_value[1]
511-
except:
510+
except Exception:
512511
print("Bad query param: %s" % key_value)
513512
return
514513

@@ -585,7 +584,7 @@ def do_raw(self, line):
585584
parsed_url = urlparse.urlparse(args["path"])
586585
qp.update(urlparse.parse_qs(parsed_url.query))
587586
args["path"] = parsed_url.path
588-
except:
587+
except Exception:
589588
pass
590589

591590
reactor.callFromThread(
@@ -772,10 +771,10 @@ def main(server_url, identity_server_url, username, token, config_path):
772771
syn_cmd.config = json.load(config)
773772
try:
774773
http_client.verbose = "on" == syn_cmd.config["verbose"]
775-
except:
774+
except Exception:
776775
pass
777776
print("Loaded config from %s" % config_path)
778-
except:
777+
except Exception:
779778
pass
780779

781780
# Twisted-specific: Runs the command processor in Twisted's event loop

contrib/cmdclient/http.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@
1414
# limitations under the License.
1515

1616
from __future__ import print_function
17-
from twisted.web.client import Agent, readBody
18-
from twisted.web.http_headers import Headers
19-
from twisted.internet import defer, reactor
20-
21-
from pprint import pformat
2217

2318
import json
2419
import urllib
20+
from pprint import pformat
21+
22+
from twisted.internet import defer, reactor
23+
from twisted.web.client import Agent, readBody
24+
from twisted.web.http_headers import Headers
2525

2626

2727
class HttpClient(object):

contrib/docker/docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ services:
5050
- traefik.http.routers.https-synapse.tls.certResolver=le-ssl
5151

5252
db:
53-
image: docker.io/postgres:10-alpine
53+
image: docker.io/postgres:12-alpine
5454
# Change that password, of course!
5555
environment:
5656
- POSTGRES_USER=synapse

contrib/experiments/test_messaging.py

Lines changed: 21 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -28,27 +28,24 @@
2828
"""
2929

3030

31-
from synapse.federation import ReplicationHandler
32-
33-
from synapse.federation.units import Pdu
34-
35-
from synapse.util import origin_from_ucid
36-
37-
from synapse.app.homeserver import SynapseHomeServer
38-
39-
# from synapse.logging.utils import log_function
40-
41-
from twisted.internet import reactor, defer
42-
from twisted.python import log
43-
4431
import argparse
32+
import curses.wrapper
4533
import json
4634
import logging
4735
import os
4836
import re
4937

5038
import cursesio
51-
import curses.wrapper
39+
40+
from twisted.internet import defer, reactor
41+
from twisted.python import log
42+
43+
from synapse.app.homeserver import SynapseHomeServer
44+
from synapse.federation import ReplicationHandler
45+
from synapse.federation.units import Pdu
46+
from synapse.util import origin_from_ucid
47+
48+
# from synapse.logging.utils import log_function
5249

5350

5451
logger = logging.getLogger("example")
@@ -75,7 +72,7 @@ def on_line(self, line):
7572
"""
7673

7774
try:
78-
m = re.match("^join (\S+)$", line)
75+
m = re.match(r"^join (\S+)$", line)
7976
if m:
8077
# The `sender` wants to join a room.
8178
(room_name,) = m.groups()
@@ -84,7 +81,7 @@ def on_line(self, line):
8481
# self.print_line("OK.")
8582
return
8683

87-
m = re.match("^invite (\S+) (\S+)$", line)
84+
m = re.match(r"^invite (\S+) (\S+)$", line)
8885
if m:
8986
# `sender` wants to invite someone to a room
9087
room_name, invitee = m.groups()
@@ -93,7 +90,7 @@ def on_line(self, line):
9390
# self.print_line("OK.")
9491
return
9592

96-
m = re.match("^send (\S+) (.*)$", line)
93+
m = re.match(r"^send (\S+) (.*)$", line)
9794
if m:
9895
# `sender` wants to message a room
9996
room_name, body = m.groups()
@@ -102,7 +99,7 @@ def on_line(self, line):
10299
# self.print_line("OK.")
103100
return
104101

105-
m = re.match("^backfill (\S+)$", line)
102+
m = re.match(r"^backfill (\S+)$", line)
106103
if m:
107104
# we want to backfill a room
108105
(room_name,) = m.groups()
@@ -201,16 +198,6 @@ def on_receive_pdu(self, pdu):
201198
% (pdu.context, pdu.pdu_type, json.dumps(pdu.content))
202199
)
203200

204-
# def on_state_change(self, pdu):
205-
##self.output.print_line("#%s (state) %s *** %s" %
206-
##(pdu.context, pdu.state_key, pdu.pdu_type)
207-
##)
208-
209-
# if "joinee" in pdu.content:
210-
# self._on_join(pdu.context, pdu.content["joinee"])
211-
# elif "invitee" in pdu.content:
212-
# self._on_invite(pdu.origin, pdu.context, pdu.content["invitee"])
213-
214201
def _on_message(self, pdu):
215202
""" We received a message
216203
"""
@@ -314,7 +301,7 @@ def backfill(self, room_name, limit=5):
314301
return self.replication_layer.backfill(dest, room_name, limit)
315302

316303
def _get_room_remote_servers(self, room_name):
317-
return [i for i in self.joined_rooms.setdefault(room_name).servers]
304+
return list(self.joined_rooms.setdefault(room_name).servers)
318305

319306
def _get_or_create_room(self, room_name):
320307
return self.joined_rooms.setdefault(room_name, Room(room_name))
@@ -334,7 +321,7 @@ def main(stdscr):
334321
user = args.user
335322
server_name = origin_from_ucid(user)
336323

337-
## Set up logging ##
324+
# Set up logging
338325

339326
root_logger = logging.getLogger()
340327

@@ -354,7 +341,7 @@ def main(stdscr):
354341
observer = log.PythonLoggingObserver()
355342
observer.start()
356343

357-
## Set up synapse server
344+
# Set up synapse server
358345

359346
curses_stdio = cursesio.CursesStdIO(stdscr)
360347
input_output = InputOutput(curses_stdio, user)
@@ -368,16 +355,16 @@ def main(stdscr):
368355

369356
input_output.set_home_server(hs)
370357

371-
## Add input_output logger
358+
# Add input_output logger
372359
io_logger = IOLoggerHandler(input_output)
373360
io_logger.setFormatter(formatter)
374361
root_logger.addHandler(io_logger)
375362

376-
## Start! ##
363+
# Start!
377364

378365
try:
379366
port = int(server_name.split(":")[1])
380-
except:
367+
except Exception:
381368
port = 12345
382369

383370
app_hs.get_http_server().start_listening(port)

0 commit comments

Comments
 (0)