@@ -168,7 +168,7 @@ async def send(self, channel, message):
168168 """
169169 # Typecheck
170170 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"
172172 # Make sure the message does not contain reserved keys
173173 assert "__asgi_channel__" not in message
174174 # 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):
255255 """
256256 # Make sure the channel name is valid then get the non-local part
257257 # and thus its index
258- assert self .valid_channel_name (channel )
258+ assert self .require_valid_channel_name (channel )
259259 if "!" in channel :
260260 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+ )
264264 # Enter receiving section
265265 loop = asyncio .get_running_loop ()
266266 self .receive_count += 1
@@ -376,7 +376,9 @@ async def receive_single(self, channel):
376376 Receives a single message off of the channel and returns it.
377377 """
378378 # 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+ )
380382 # Work out the connection to use
381383 if "!" in channel :
382384 assert channel .endswith ("!" )
@@ -481,8 +483,8 @@ async def group_add(self, group, channel):
481483 Adds the channel name to a group.
482484 """
483485 # 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"
486488 # Get a connection to the right shard
487489 group_key = self ._group_key (group )
488490 connection = self .connection (self .consistent_hash (group ))
@@ -507,7 +509,7 @@ async def group_send(self, group, message):
507509 """
508510 Sends a message to the entire group.
509511 """
510- assert self .valid_group_name (group ), "Group name not valid"
512+ assert self .require_valid_group_name (group ), "Group name not valid"
511513 # Retrieve list of all channel names
512514 key = self ._group_key (group )
513515 connection = self .connection (self .consistent_hash (group ))
0 commit comments