@@ -68,18 +68,42 @@ def __init__(self, maxsize: int = 10) -> None:
6868 maxsize: Size of the channel's buffer.
6969 """
7070 self .limit : int = maxsize
71+ """The maximum number of values that can be stored in the channel's buffer.
72+
73+ If the length of channel's buffer reaches the limit, then the sender
74+ blocks at the [send()][frequenz.channels.Sender.send] method until
75+ a value is consumed.
76+ """
77+
7178 self .deque : Deque [T ] = deque (maxlen = maxsize )
79+ """The channel's buffer."""
80+
7281 self .send_cv : Condition = Condition ()
82+ """The condition to wait for free space in the channel's buffer.
83+
84+ If the channel's buffer is full, then the sender waits for values to
85+ get consumed using this condition until there's some free space
86+ available in the channel's buffer.
87+ """
88+
7389 self .recv_cv : Condition = Condition ()
90+ """The condition to wait for values in the channel's buffer.
91+
92+ If the channel's buffer is empty, then the receiver waits for values
93+ using this condition until there's a value available in the channel's
94+ buffer.
95+ """
96+
7497 self .closed : bool = False
98+ """Whether the channel is closed."""
7599
76100 async def close (self ) -> None :
77101 """Close the channel.
78102
79103 Any further attempts to [send()][frequenz.channels.Sender.send] data
80104 will return `False`.
81105
82- Receivers will still be able to drain the pending items on the channel,
106+ Receivers will still be able to drain the pending values on the channel,
83107 but after that, subsequent
84108 [receive()][frequenz.channels.Receiver.receive] calls will return `None`
85109 immediately.
@@ -111,7 +135,7 @@ def new_receiver(self) -> Receiver[T]:
111135class Sender (BaseSender [T ]):
112136 """A sender to send messages to an Anycast channel.
113137
114- Should not be created directly, but through the `Anycast.ggetet_sender ()`
138+ Should not be created directly, but through the `Anycast.new_sender ()`
115139 method.
116140 """
117141
@@ -122,6 +146,7 @@ def __init__(self, chan: Anycast[T]) -> None:
122146 chan: A reference to the channel that this sender belongs to.
123147 """
124148 self ._chan = chan
149+ """The channel that this sender belongs to."""
125150
126151 async def send (self , msg : T ) -> None :
127152 """Send a message across the channel.
@@ -169,6 +194,8 @@ def __init__(self, chan: Anycast[T]) -> None:
169194 chan: A reference to the channel that this receiver belongs to.
170195 """
171196 self ._chan = chan
197+ """The channel that this receiver belongs to."""
198+
172199 self ._next : T | type [_Empty ] = _Empty
173200
174201 async def ready (self ) -> bool :
@@ -211,7 +238,7 @@ def consume(self) -> T:
211238
212239 assert (
213240 self ._next is not _Empty
214- ), "`consume()` must be preceeded by a call to `ready()`"
241+ ), "`consume()` must be preceded by a call to `ready()`"
215242 # mypy doesn't understand that the assert above ensures that self._next is not
216243 # _Sentinel. So we have to use a type ignore here.
217244 next_val : T = self ._next # type: ignore[assignment]
0 commit comments