Skip to content

Commit f603b47

Browse files
llucaxdaniel-zullo-frequenzshsms
authored
Apply suggestions from code review
Co-authored-by: daniel-zullo-frequenz <[email protected]> Co-authored-by: Sahas Subramanian <[email protected]> Signed-off-by: Leandro Lucarella <[email protected]>
1 parent b32bf3b commit f603b47

File tree

7 files changed

+12
-12
lines changed

7 files changed

+12
-12
lines changed

src/frequenz/channels/_broadcast.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ def is_closed(self) -> bool:
246246
return self._closed
247247

248248
async def close(self) -> None:
249-
"""Close this Broadcast channel.
249+
"""Close this channel.
250250
251251
Any further attempts to [send()][frequenz.channels.Sender.send] data
252252
will return `False`.
@@ -277,7 +277,7 @@ def new_receiver(self, *, name: str | None = None, limit: int = 50) -> Receiver[
277277
limit: Number of messages the receiver can hold in its buffer.
278278
279279
Returns:
280-
The new receiver attached to this channel.
280+
A new receiver attached to this channel.
281281
"""
282282
recv: _Receiver[_T] = _Receiver(name, limit, self)
283283
self._receivers[hash(recv)] = weakref.ref(recv)

src/frequenz/channels/_exceptions.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@
7070

7171

7272
class Error(RuntimeError):
73-
"""An error originated in this library.
73+
"""An error that originated in this library.
7474
7575
This is useful if you want to catch all exceptions generated by this library.
7676
"""
@@ -85,7 +85,7 @@ def __init__(self, message: str):
8585

8686

8787
class ChannelError(Error):
88-
"""An error originated in a channel.
88+
"""An error that originated in a channel.
8989
9090
All exceptions generated by channels inherit from this exception.
9191
"""

src/frequenz/channels/_merge.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ class Merger(Receiver[_T]):
104104
"""
105105

106106
def __init__(self, *receivers: Receiver[_T], name: str | None) -> None:
107-
"""Iinitialize this merger.
107+
"""Initialize this merger.
108108
109109
Args:
110110
*receivers: The receivers to merge.

src/frequenz/channels/_receiver.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ async def receive(self) -> _T_co:
226226
return received
227227

228228
def map(self, call: Callable[[_T_co], _U_co]) -> Receiver[_U_co]:
229-
"""Map a function on the received values.
229+
"""Apply a mapping function on the received values.
230230
231231
Tip:
232232
The returned receiver type won't have all the methods of the original
@@ -235,7 +235,7 @@ def map(self, call: Callable[[_T_co], _U_co]) -> Receiver[_U_co]:
235235
original receiver and use that instead.
236236
237237
Args:
238-
call: The function to apply on incoming messages.
238+
call: The function to be applied on incoming messages.
239239
240240
Returns:
241241
A new receiver that applies the function on the received values.
@@ -244,7 +244,7 @@ def map(self, call: Callable[[_T_co], _U_co]) -> Receiver[_U_co]:
244244

245245

246246
class ReceiverError(Error, Generic[_T_co]):
247-
"""An error originated in a [Receiver][frequenz.channels.Receiver].
247+
"""An error that originated in a [Receiver][frequenz.channels.Receiver].
248248
249249
All exceptions generated by receivers inherit from this exception.
250250
"""
@@ -322,7 +322,7 @@ def consume(self) -> _U_co: # noqa: DOC502
322322
323323
Raises:
324324
ReceiverStoppedError: If the receiver stopped producing messages.
325-
ReceiverError: If there is some problem with the receiver.
325+
ReceiverError: If there is a problem with the receiver.
326326
"""
327327
return self._transform(
328328
self._receiver.consume()

src/frequenz/channels/_select.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ def selected_from(
285285

286286

287287
class SelectError(BaseException):
288-
"""An error originated in a [`select()`][frequenz.channels.select] operation.
288+
"""An error that happened during a [`select()`][frequenz.channels.select] operation.
289289
290290
This exception is raised when a `select()` iteration fails. It is raised as
291291
a single exception when one receiver fails during normal operation (while calling

src/frequenz/channels/_sender.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ async def send(self, msg: _T_contra) -> None:
7373

7474

7575
class SenderError(Error, Generic[_T_contra]):
76-
"""An error originated in a [Sender][frequenz.channels.Sender].
76+
"""An error that originated in a [Sender][frequenz.channels.Sender].
7777
7878
All exceptions generated by senders inherit from this exception.
7979
"""

src/frequenz/channels/timer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -720,7 +720,7 @@ def __str__(self) -> str:
720720
return f"{type(self).__name__}({self.interval})"
721721

722722
def __repr__(self) -> str:
723-
"""Return a string representation of this timer."""
723+
"""Return a string with the internal representation of this timer."""
724724
return (
725725
f"{type(self).__name__}<{self.interval=}, {self.missed_tick_policy=}, "
726726
f"{self.loop=}, {self.is_running=}>"

0 commit comments

Comments
 (0)