Skip to content

Commit 5da37b7

Browse files
committed
docs: Make some minor improvements
A few comments are rephrased or added or removed in the hopes to make the documentation more reable or easier to understand. Signed-off-by: Leandro Lucarella <[email protected]>
1 parent 706b479 commit 5da37b7

File tree

6 files changed

+12
-17
lines changed

6 files changed

+12
-17
lines changed

src/frequenz/channels/base_classes.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414

1515
class Sender(ABC, Generic[T]):
16-
"""A base class for channel Sender."""
16+
"""A channel Sender."""
1717

1818
@abstractmethod
1919
async def send(self, msg: T) -> bool:
@@ -29,7 +29,7 @@ async def send(self, msg: T) -> bool:
2929

3030

3131
class Receiver(ABC, Generic[T]):
32-
"""A base class for channel Receiver."""
32+
"""A channel Receiver."""
3333

3434
@abstractmethod
3535
async def receive(self) -> Optional[T]:
@@ -79,10 +79,6 @@ def into_peekable(self) -> Peekable[T]:
7979
Once this function has been called, the receiver will no longer be
8080
usable, and calling `receive` on the receiver will raise an exception.
8181
82-
This is a default implementation of `into_peekable` that always raises
83-
an exception. This method can be overridden in other implementations
84-
of `Receiver.`
85-
8682
Raises:
8783
NotImplementedError: when a `Receiver` implementation doesn't have
8884
a custom `get_peekable` implementation.
@@ -91,7 +87,7 @@ def into_peekable(self) -> Peekable[T]:
9187

9288

9389
class Peekable(ABC, Generic[T]):
94-
"""A base class for creating Peekables for peeking into channels.
90+
"""A channel peekable.
9591
9692
A Peekable provides a [peek()][frequenz.channels.Peekable] method that
9793
allows the user to get a peek at the latest value in the channel, without
@@ -109,7 +105,7 @@ def peek(self) -> Optional[T]:
109105

110106

111107
class BufferedReceiver(Receiver[T]):
112-
"""A base class for buffered channel receivers."""
108+
"""A channel receiver with a buffer."""
113109

114110
@abstractmethod
115111
def enqueue(self, msg: T) -> None:

src/frequenz/channels/bidirectional.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ async def send(self, msg: T) -> bool:
7878
msg: The value to send.
7979
8080
Returns:
81-
Boolean indicating whether the send was successful.
81+
Whether the send was successful or not.
8282
"""
8383
return await self._sender.send(msg)
8484

src/frequenz/channels/broadcast.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,8 +181,8 @@ async def send(self, msg: T) -> bool:
181181
msg: The message to be broadcast.
182182
183183
Returns:
184-
Boolean indicating whether the message was sent, based on whether
185-
the broadcast channel is open or not.
184+
Whether the message was sent, based on whether the broadcast
185+
channel is open or not.
186186
"""
187187
if self._chan.closed:
188188
return False

src/frequenz/channels/select.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ async def ready(self) -> bool:
9090
async iterators have closed.
9191
9292
Returns:
93-
Boolean indicating whether there are further messages or not.
93+
Whether there are further messages or not.
9494
"""
9595
if self._ready_count > 0:
9696
if self._ready_count == self._prev_ready_count:

src/frequenz/channels/utils/file_watcher.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class EventType(Enum):
2121

2222

2323
class FileWatcher(Receiver[pathlib.Path]):
24-
"""A channel receiver that watches for file events using watchfiles."""
24+
"""A channel receiver that watches for file events."""
2525

2626
def __init__(
2727
self,
@@ -32,9 +32,8 @@ def __init__(
3232
3333
Args:
3434
paths: Paths to watch for changes.
35-
event_types: Types of events to watch for. Available types are:
36-
CREATE, MODIFY, DELETE. By default, watcher will watch for all
37-
types of events.
35+
event_types: Types of events to watch for or `None` to watch for
36+
all event types.
3837
"""
3938
if event_types is None:
4039
event_types = {EventType.CREATE, EventType.MODIFY, EventType.DELETE}

src/frequenz/channels/utils/timer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ class Timer(Receiver[datetime]):
5252
"""
5353

5454
def __init__(self, interval: float) -> None:
55-
"""Create a `LocalTimer` instance.
55+
"""Create a `Timer` instance.
5656
5757
Args:
5858
interval: number of seconds between messages.

0 commit comments

Comments
 (0)