Skip to content

Commit 706b479

Browse files
committed
docs: Improve formatting of some symbols
Signed-off-by: Leandro Lucarella <[email protected]>
1 parent c991873 commit 706b479

File tree

6 files changed

+19
-18
lines changed

6 files changed

+19
-18
lines changed

src/frequenz/channels/anycast.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ async def receive(self) -> Optional[T]:
171171
will receive each message.
172172
173173
Returns:
174-
None, if the channel is closed, a message otherwise.
174+
`None`, if the channel is closed, a message otherwise.
175175
"""
176176
while len(self._chan.deque) == 0:
177177
if self._chan.closed:

src/frequenz/channels/base_classes.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,14 @@ async def receive(self) -> Optional[T]:
3636
"""Receive a message from the channel.
3737
3838
Returns:
39-
None, if the channel is closed, a message otherwise.
39+
`None`, if the channel is closed, a message otherwise.
4040
"""
4141

4242
def __aiter__(self) -> Receiver[T]:
4343
"""Initialize the async iterator over received values.
4444
4545
Returns:
46-
self, since no extra setup is needed for the iterator
46+
`self`, since no extra setup is needed for the iterator.
4747
"""
4848
return self
4949

@@ -69,7 +69,7 @@ def map(self, call: Callable[[T], U]) -> Receiver[U]:
6969
call: function to apply on incoming messages.
7070
7171
Returns:
72-
A receiver to read results of the given function from.
72+
A `Receiver` to read results of the given function from.
7373
"""
7474
return _Map(self, call)
7575

@@ -123,7 +123,8 @@ def enqueue(self, msg: T) -> None:
123123
class _Map(Receiver[U], Generic[T, U]):
124124
"""Apply a transform function on a channel receiver.
125125
126-
Has two generic types -
126+
Has two generic types:
127+
127128
- The input type: value type in the input receiver.
128129
- The output type: return type of the transform method.
129130
"""
@@ -143,7 +144,7 @@ async def receive(self) -> Optional[U]:
143144
"""Return a transformed message received from the input channel.
144145
145146
Returns:
146-
None, if the channel is closed, a message otherwise.
147+
`None`, if the channel is closed, a message otherwise.
147148
"""
148149
msg = await self._recv.receive()
149150
if msg is None:

src/frequenz/channels/bidirectional.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ def client_handle(self) -> BidirectionalHandle[T, U]:
4747

4848
@property
4949
def service_handle(self) -> BidirectionalHandle[U, T]:
50-
"""Get a BidirectionalHandle for the service to use.
50+
"""Get a `BidirectionalHandle` for the service to use.
5151
5252
Returns:
5353
Object to send/receive messages with.
@@ -86,6 +86,6 @@ async def receive(self) -> Optional[U]:
8686
"""Receive a value from the other side.
8787
8888
Returns:
89-
Received value, or None if the channels are closed.
89+
Received value, or `None` if the channels are closed.
9090
"""
9191
return await self._receiver.receive()

src/frequenz/channels/broadcast.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
class Broadcast(Generic[T]):
2323
"""A channel to broadcast messages to multiple receivers.
2424
25-
Broadcast channels can have multiple senders and multiple receivers. Each
25+
`Broadcast` channels can have multiple senders and multiple receivers. Each
2626
message sent through any of the senders is received by all of the
2727
receivers.
2828
@@ -272,7 +272,7 @@ async def receive(self) -> Optional[T]:
272272
EOFError: when the receiver has been converted into a `Peekable`.
273273
274274
Returns:
275-
None, if the channel is closed, a message otherwise.
275+
`None`, if the channel is closed, a message otherwise.
276276
"""
277277
if not self._active:
278278
raise EOFError("This receiver is no longer active.")

src/frequenz/channels/select.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class Select:
3636
messages coming in the additional async iterators are dropped, and
3737
a warning message is logged.
3838
39-
[Receiver][frequenz.channels.Receiver]s also function as AsyncIterator.
39+
[Receiver][frequenz.channels.Receiver]s also function as `AsyncIterator`.
4040
4141
Example:
4242
For example, if there are two async iterators that you want to
@@ -86,8 +86,8 @@ def __del__(self) -> None:
8686
async def ready(self) -> bool:
8787
"""Wait until there is a message in any of the async iterators.
8888
89-
Returns True if there is a message available, and False if all async
90-
iterators have closed.
89+
Returns `True` if there is a message available, and `False` if all
90+
async iterators have closed.
9191
9292
Returns:
9393
Boolean indicating whether there are further messages or not.
@@ -138,17 +138,17 @@ async def ready(self) -> bool:
138138
return True
139139

140140
def __getattr__(self, name: str) -> Optional[Any]:
141-
"""Return the latest unread message from a AsyncIterator, if available.
141+
"""Return the latest unread message from a `AsyncIterator`, if available.
142142
143143
Args:
144144
name: Name of the channel.
145145
146146
Returns:
147-
Latest unread message for the specified AsyncIterator, or None.
147+
Latest unread message for the specified `AsyncIterator`, or `None`.
148148
149149
Raises:
150-
KeyError: when the name was not specified when creating the Select
151-
instance.
150+
KeyError: when the name was not specified when creating the
151+
`Select` instance.
152152
"""
153153
result = self._result[name]
154154
if result is None:

src/frequenz/channels/utils/timer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ def stop(self) -> None:
7070
7171
Once `stop` has been called, all subsequent calls to
7272
[receive()][frequenz.channels.Timer.receive] will immediately return
73-
None.
73+
`None`.
7474
"""
7575
self._stopped = True
7676

0 commit comments

Comments
 (0)