diff options
author | Eric Eastwood <contact@ericeastwood.com> | 2021-02-16 16:32:34 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-16 22:32:34 +0000 |
commit | 0a00b7ff14890987f09112a2ae696c61001e6cf1 (patch) | |
tree | e662b6da7679b47276d8a865e3dc9b531d1cd9bd /contrib/experiments/test_messaging.py | |
parent | Fix OIDC gitiea redirect URL. (#9404) (diff) | |
download | synapse-0a00b7ff14890987f09112a2ae696c61001e6cf1.tar.xz |
Update black, and run auto formatting over the codebase (#9381)
- Update black version to the latest - Run black auto formatting over the codebase - Run autoformatting according to [`docs/code_style.md `](https://github.com/matrix-org/synapse/blob/80d6dc9783aa80886a133756028984dbf8920168/docs/code_style.md) - Update `code_style.md` docs around installing black to use the correct version
Diffstat (limited to 'contrib/experiments/test_messaging.py')
-rw-r--r-- | contrib/experiments/test_messaging.py | 36 |
1 files changed, 13 insertions, 23 deletions
diff --git a/contrib/experiments/test_messaging.py b/contrib/experiments/test_messaging.py index d4c35ff2fc..7fbc7d8fc6 100644 --- a/contrib/experiments/test_messaging.py +++ b/contrib/experiments/test_messaging.py @@ -56,7 +56,7 @@ def excpetion_errback(failure): class InputOutput: - """ This is responsible for basic I/O so that a user can interact with + """This is responsible for basic I/O so that a user can interact with the example app. """ @@ -68,8 +68,7 @@ class InputOutput: self.server = server def on_line(self, line): - """ This is where we process commands. - """ + """This is where we process commands.""" try: m = re.match(r"^join (\S+)$", line) @@ -133,7 +132,7 @@ class IOLoggerHandler(logging.Handler): class Room: - """ Used to store (in memory) the current membership state of a room, and + """Used to store (in memory) the current membership state of a room, and which home servers we should send PDUs associated with the room to. """ @@ -148,8 +147,7 @@ class Room: self.have_got_metadata = False def add_participant(self, participant): - """ Someone has joined the room - """ + """Someone has joined the room""" self.participants.add(participant) self.invited.discard(participant) @@ -160,14 +158,13 @@ class Room: self.oldest_server = server def add_invited(self, invitee): - """ Someone has been invited to the room - """ + """Someone has been invited to the room""" self.invited.add(invitee) self.servers.add(origin_from_ucid(invitee)) class HomeServer(ReplicationHandler): - """ A very basic home server implentation that allows people to join a + """A very basic home server implentation that allows people to join a room and then invite other people. """ @@ -181,8 +178,7 @@ class HomeServer(ReplicationHandler): self.output = output def on_receive_pdu(self, pdu): - """ We just received a PDU - """ + """We just received a PDU""" pdu_type = pdu.pdu_type if pdu_type == "sy.room.message": @@ -199,23 +195,20 @@ class HomeServer(ReplicationHandler): ) def _on_message(self, pdu): - """ We received a message - """ + """We received a message""" self.output.print_line( "#%s %s %s" % (pdu.context, pdu.content["sender"], pdu.content["body"]) ) def _on_join(self, context, joinee): - """ Someone has joined a room, either a remote user or a local user - """ + """Someone has joined a room, either a remote user or a local user""" room = self._get_or_create_room(context) room.add_participant(joinee) self.output.print_line("#%s %s %s" % (context, joinee, "*** JOINED")) def _on_invite(self, origin, context, invitee): - """ Someone has been invited - """ + """Someone has been invited""" room = self._get_or_create_room(context) room.add_invited(invitee) @@ -228,8 +221,7 @@ class HomeServer(ReplicationHandler): @defer.inlineCallbacks def send_message(self, room_name, sender, body): - """ Send a message to a room! - """ + """Send a message to a room!""" destinations = yield self.get_servers_for_context(room_name) try: @@ -247,8 +239,7 @@ class HomeServer(ReplicationHandler): @defer.inlineCallbacks def join_room(self, room_name, sender, joinee): - """ Join a room! - """ + """Join a room!""" self._on_join(room_name, joinee) destinations = yield self.get_servers_for_context(room_name) @@ -269,8 +260,7 @@ class HomeServer(ReplicationHandler): @defer.inlineCallbacks def invite_to_room(self, room_name, sender, invitee): - """ Invite someone to a room! - """ + """Invite someone to a room!""" self._on_invite(self.server_name, room_name, invitee) destinations = yield self.get_servers_for_context(room_name) |