@@ -85,12 +85,25 @@ def __init__(self, name: str, resend_latest: bool = False) -> None:
8585 to wait for the next message on the channel to arrive.
8686 """
8787 self .name : str = name
88+ """The name of the broadcast channel.
89+
90+ Only used for debugging purposes.
91+ """
92+
8893 self ._resend_latest = resend_latest
94+ """Whether to resend the latest value to new receivers."""
8995
9096 self .recv_cv : Condition = Condition ()
97+ """The condition to wait for data in the channel's buffer."""
98+
9199 self .receivers : dict [UUID , weakref .ReferenceType [Receiver [T ]]] = {}
100+ """The receivers attached to the channel, indexed by their UUID."""
101+
92102 self .closed : bool = False
103+ """Whether the channel is closed."""
104+
93105 self ._latest : T | None = None
106+ """The latest value sent to the channel."""
94107
95108 async def close (self ) -> None :
96109 """Close the Broadcast channel.
@@ -167,6 +180,7 @@ def __init__(self, chan: Broadcast[T]) -> None:
167180 chan: A reference to the broadcast channel this sender belongs to.
168181 """
169182 self ._chan = chan
183+ """The broadcast channel this sender belongs to."""
170184
171185 async def send (self , msg : T ) -> None :
172186 """Send a message to all broadcast receivers.
@@ -222,11 +236,26 @@ def __init__(self, uuid: UUID, name: str, maxsize: int, chan: Broadcast[T]) -> N
222236 belongs to.
223237 """
224238 self ._uuid = uuid
239+ """The UUID to identify the receiver in the broadcast channel's list of receivers."""
240+
225241 self ._name = name
242+ """The name to identify the receiver.
243+
244+ Only used for debugging purposes.
245+ """
246+
226247 self ._chan = chan
248+ """The broadcast channel that this receiver belongs to."""
249+
227250 self ._q : Deque [T ] = deque (maxlen = maxsize )
251+ """The receiver's internal message queue."""
228252
229253 self ._active = True
254+ """Whether the receiver is still active.
255+
256+ If this receiver is converted into a Peekable, it will neither be
257+ considered valid nor active.
258+ """
230259
231260 def enqueue (self , msg : T ) -> None :
232261 """Put a message into this receiver's queue.
@@ -343,6 +372,7 @@ def __init__(self, chan: Broadcast[T]) -> None:
343372 chan: The broadcast channel this Peekable will try to peek into.
344373 """
345374 self ._chan = chan
375+ """The broadcast channel this Peekable will try to peek into."""
346376
347377 def peek (self ) -> T | None :
348378 """Return the latest value that was sent to the channel.
0 commit comments