@@ -308,13 +308,13 @@ class _Sender(Sender[_T]):
308308 method.
309309 """
310310
311- def __init__ (self , chan : Broadcast [_T ]) -> None :
311+ def __init__ (self , channel : Broadcast [_T ]) -> None :
312312 """Initialize this sender.
313313
314314 Args:
315- chan : A reference to the broadcast channel this sender belongs to.
315+ channel : A reference to the broadcast channel this sender belongs to.
316316 """
317- self ._chan : Broadcast [_T ] = chan
317+ self ._channel : Broadcast [_T ] = channel
318318 """The broadcast channel this sender belongs to."""
319319
320320 async def send (self , message : _T ) -> None :
@@ -329,31 +329,31 @@ async def send(self, message: _T) -> None:
329329 set as the cause.
330330 """
331331 # pylint: disable=protected-access
332- if self ._chan ._closed :
332+ if self ._channel ._closed :
333333 raise SenderError ("The channel was closed" , self ) from ChannelClosedError (
334- self ._chan
334+ self ._channel
335335 )
336- self ._chan ._latest = message
336+ self ._channel ._latest = message
337337 stale_refs = []
338- for _hash , recv_ref in self ._chan ._receivers .items ():
338+ for _hash , recv_ref in self ._channel ._receivers .items ():
339339 recv = recv_ref ()
340340 if recv is None :
341341 stale_refs .append (_hash )
342342 continue
343343 recv .enqueue (message )
344344 for _hash in stale_refs :
345- del self ._chan ._receivers [_hash ]
346- async with self ._chan ._recv_cv :
347- self ._chan ._recv_cv .notify_all ()
345+ del self ._channel ._receivers [_hash ]
346+ async with self ._channel ._recv_cv :
347+ self ._channel ._recv_cv .notify_all ()
348348 # pylint: enable=protected-access
349349
350350 def __str__ (self ) -> str :
351351 """Return a string representation of this sender."""
352- return f"{ self ._chan } :{ type (self ).__name__ } "
352+ return f"{ self ._channel } :{ type (self ).__name__ } "
353353
354354 def __repr__ (self ) -> str :
355355 """Return a string representation of this sender."""
356- return f"{ type (self ).__name__ } ({ self ._chan !r} )"
356+ return f"{ type (self ).__name__ } ({ self ._channel !r} )"
357357
358358
359359class _Receiver (Receiver [_T ]):
@@ -364,7 +364,7 @@ class _Receiver(Receiver[_T]):
364364 method.
365365 """
366366
367- def __init__ (self , name : str | None , limit : int , chan : Broadcast [_T ]) -> None :
367+ def __init__ (self , name : str | None , limit : int , channel : Broadcast [_T ]) -> None :
368368 """Initialize this receiver.
369369
370370 Broadcast receivers have their own buffer, and when messages are not
@@ -377,7 +377,7 @@ def __init__(self, name: str | None, limit: int, chan: Broadcast[_T]) -> None:
377377 purposes, it will be shown in the string representation of the
378378 receiver.
379379 limit: Number of messages the receiver can hold in its buffer.
380- chan : a reference to the Broadcast channel that this receiver
380+ channel : a reference to the Broadcast channel that this receiver
381381 belongs to.
382382 """
383383 self ._name : str = name if name is not None else f"{ id (self ):_} "
@@ -386,7 +386,7 @@ def __init__(self, name: str | None, limit: int, chan: Broadcast[_T]) -> None:
386386 Only used for debugging purposes.
387387 """
388388
389- self ._chan : Broadcast [_T ] = chan
389+ self ._channel : Broadcast [_T ] = channel
390390 """The broadcast channel that this receiver belongs to."""
391391
392392 self ._q : deque [_T ] = deque (maxlen = limit )
@@ -439,10 +439,10 @@ async def ready(self) -> bool:
439439 # consumed, then we return immediately.
440440 # pylint: disable=protected-access
441441 while len (self ._q ) == 0 :
442- if self ._chan ._closed :
442+ if self ._channel ._closed :
443443 return False
444- async with self ._chan ._recv_cv :
445- await self ._chan ._recv_cv .wait ()
444+ async with self ._channel ._recv_cv :
445+ await self ._channel ._recv_cv .wait ()
446446 return True
447447 # pylint: enable=protected-access
448448
@@ -455,21 +455,21 @@ def consume(self) -> _T:
455455 Raises:
456456 ReceiverStoppedError: If there is some problem with the receiver.
457457 """
458- if not self ._q and self ._chan ._closed : # pylint: disable=protected-access
459- raise ReceiverStoppedError (self ) from ChannelClosedError (self ._chan )
458+ if not self ._q and self ._channel ._closed : # pylint: disable=protected-access
459+ raise ReceiverStoppedError (self ) from ChannelClosedError (self ._channel )
460460
461461 assert self ._q , "`consume()` must be preceded by a call to `ready()`"
462462 return self ._q .popleft ()
463463
464464 def __str__ (self ) -> str :
465465 """Return a string representation of this receiver."""
466- return f"{ self ._chan } :{ type (self ).__name__ } "
466+ return f"{ self ._channel } :{ type (self ).__name__ } "
467467
468468 def __repr__ (self ) -> str :
469469 """Return a string representation of this receiver."""
470470 limit = self ._q .maxlen
471471 assert limit is not None
472472 return (
473473 f"{ type (self ).__name__ } (name={ self ._name !r} , limit={ limit !r} , "
474- f"{ self ._chan !r} ):<id={ id (self )!r} , used={ len (self ._q )!r} >"
474+ f"{ self ._channel !r} ):<id={ id (self )!r} , used={ len (self ._q )!r} >"
475475 )
0 commit comments