@@ -56,7 +56,7 @@ def excpetion_errback(failure):
56
56
57
57
58
58
class InputOutput :
59
- """ This is responsible for basic I/O so that a user can interact with
59
+ """This is responsible for basic I/O so that a user can interact with
60
60
the example app.
61
61
"""
62
62
@@ -68,8 +68,7 @@ def set_home_server(self, server):
68
68
self .server = server
69
69
70
70
def on_line (self , line ):
71
- """ This is where we process commands.
72
- """
71
+ """This is where we process commands."""
73
72
74
73
try :
75
74
m = re .match (r"^join (\S+)$" , line )
@@ -133,7 +132,7 @@ def emit(self, record):
133
132
134
133
135
134
class Room :
136
- """ Used to store (in memory) the current membership state of a room, and
135
+ """Used to store (in memory) the current membership state of a room, and
137
136
which home servers we should send PDUs associated with the room to.
138
137
"""
139
138
@@ -148,8 +147,7 @@ def __init__(self, room_name):
148
147
self .have_got_metadata = False
149
148
150
149
def add_participant (self , participant ):
151
- """ Someone has joined the room
152
- """
150
+ """Someone has joined the room"""
153
151
self .participants .add (participant )
154
152
self .invited .discard (participant )
155
153
@@ -160,14 +158,13 @@ def add_participant(self, participant):
160
158
self .oldest_server = server
161
159
162
160
def add_invited (self , invitee ):
163
- """ Someone has been invited to the room
164
- """
161
+ """Someone has been invited to the room"""
165
162
self .invited .add (invitee )
166
163
self .servers .add (origin_from_ucid (invitee ))
167
164
168
165
169
166
class HomeServer (ReplicationHandler ):
170
- """ A very basic home server implentation that allows people to join a
167
+ """A very basic home server implentation that allows people to join a
171
168
room and then invite other people.
172
169
"""
173
170
@@ -181,8 +178,7 @@ def __init__(self, server_name, replication_layer, output):
181
178
self .output = output
182
179
183
180
def on_receive_pdu (self , pdu ):
184
- """ We just received a PDU
185
- """
181
+ """We just received a PDU"""
186
182
pdu_type = pdu .pdu_type
187
183
188
184
if pdu_type == "sy.room.message" :
@@ -199,23 +195,20 @@ def on_receive_pdu(self, pdu):
199
195
)
200
196
201
197
def _on_message (self , pdu ):
202
- """ We received a message
203
- """
198
+ """We received a message"""
204
199
self .output .print_line (
205
200
"#%s %s %s" % (pdu .context , pdu .content ["sender" ], pdu .content ["body" ])
206
201
)
207
202
208
203
def _on_join (self , context , joinee ):
209
- """ Someone has joined a room, either a remote user or a local user
210
- """
204
+ """Someone has joined a room, either a remote user or a local user"""
211
205
room = self ._get_or_create_room (context )
212
206
room .add_participant (joinee )
213
207
214
208
self .output .print_line ("#%s %s %s" % (context , joinee , "*** JOINED" ))
215
209
216
210
def _on_invite (self , origin , context , invitee ):
217
- """ Someone has been invited
218
- """
211
+ """Someone has been invited"""
219
212
room = self ._get_or_create_room (context )
220
213
room .add_invited (invitee )
221
214
@@ -228,8 +221,7 @@ def _on_invite(self, origin, context, invitee):
228
221
229
222
@defer .inlineCallbacks
230
223
def send_message (self , room_name , sender , body ):
231
- """ Send a message to a room!
232
- """
224
+ """Send a message to a room!"""
233
225
destinations = yield self .get_servers_for_context (room_name )
234
226
235
227
try :
@@ -247,8 +239,7 @@ def send_message(self, room_name, sender, body):
247
239
248
240
@defer .inlineCallbacks
249
241
def join_room (self , room_name , sender , joinee ):
250
- """ Join a room!
251
- """
242
+ """Join a room!"""
252
243
self ._on_join (room_name , joinee )
253
244
254
245
destinations = yield self .get_servers_for_context (room_name )
@@ -269,8 +260,7 @@ def join_room(self, room_name, sender, joinee):
269
260
270
261
@defer .inlineCallbacks
271
262
def invite_to_room (self , room_name , sender , invitee ):
272
- """ Invite someone to a room!
273
- """
263
+ """Invite someone to a room!"""
274
264
self ._on_invite (self .server_name , room_name , invitee )
275
265
276
266
destinations = yield self .get_servers_for_context (room_name )
0 commit comments