@@ -168,7 +168,7 @@ async def send(self, channel, message):
168
168
"""
169
169
# Typecheck
170
170
assert isinstance (message , dict ), "message is not a dict"
171
- assert self .valid_channel_name (channel ), "Channel name not valid"
171
+ assert self .require_valid_channel_name (channel ), "Channel name not valid"
172
172
# Make sure the message does not contain reserved keys
173
173
assert "__asgi_channel__" not in message
174
174
# If it's a process-local channel, strip off local part and stick full name in message
@@ -255,12 +255,12 @@ async def receive(self, channel):
255
255
"""
256
256
# Make sure the channel name is valid then get the non-local part
257
257
# and thus its index
258
- assert self .valid_channel_name (channel )
258
+ assert self .require_valid_channel_name (channel )
259
259
if "!" in channel :
260
260
real_channel = self .non_local_name (channel )
261
- assert real_channel .endswith (
262
- self . client_prefix + "! "
263
- ), "Wrong client prefix"
261
+ assert real_channel .endswith (self . client_prefix + "!" ), (
262
+ "Wrong client prefix "
263
+ )
264
264
# Enter receiving section
265
265
loop = asyncio .get_running_loop ()
266
266
self .receive_count += 1
@@ -376,7 +376,9 @@ async def receive_single(self, channel):
376
376
Receives a single message off of the channel and returns it.
377
377
"""
378
378
# Check channel name
379
- assert self .valid_channel_name (channel , receive = True ), "Channel name invalid"
379
+ assert self .require_valid_channel_name (channel , receive = True ), (
380
+ "Channel name invalid"
381
+ )
380
382
# Work out the connection to use
381
383
if "!" in channel :
382
384
assert channel .endswith ("!" )
@@ -481,8 +483,8 @@ async def group_add(self, group, channel):
481
483
Adds the channel name to a group.
482
484
"""
483
485
# Check the inputs
484
- assert self .valid_group_name (group ), "Group name not valid"
485
- assert self .valid_channel_name (channel ), "Channel name not valid"
486
+ assert self .require_valid_group_name (group ), "Group name not valid"
487
+ assert self .require_valid_channel_name (channel ), "Channel name not valid"
486
488
# Get a connection to the right shard
487
489
group_key = self ._group_key (group )
488
490
connection = self .connection (self .consistent_hash (group ))
@@ -507,7 +509,7 @@ async def group_send(self, group, message):
507
509
"""
508
510
Sends a message to the entire group.
509
511
"""
510
- assert self .valid_group_name (group ), "Group name not valid"
512
+ assert self .require_valid_group_name (group ), "Group name not valid"
511
513
# Retrieve list of all channel names
512
514
key = self ._group_key (group )
513
515
connection = self .connection (self .consistent_hash (group ))
0 commit comments