Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve documentation #279

Merged
merged 20 commits into from
Mar 6, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/frequenz/channels/_receiver.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ async def __anext__(self) -> _T_co:
"""Await the next value in the async iteration over received values.

Returns:
The next value received.
The next received value.

Raises:
StopAsyncIteration: If the receiver stopped producing messages.
Expand Down Expand Up @@ -226,7 +226,7 @@ async def receive(self) -> _T_co:
return received

def map(self, call: Callable[[_T_co], _U_co]) -> Receiver[_U_co]:
"""Return a receiver with `call` applied on incoming messages.
"""Map a function on the received values.
llucax marked this conversation as resolved.
Show resolved Hide resolved

Tip:
The returned receiver type won't have all the methods of the original
Expand All @@ -238,7 +238,7 @@ def map(self, call: Callable[[_T_co], _U_co]) -> Receiver[_U_co]:
call: The function to apply on incoming messages.
llucax marked this conversation as resolved.
Show resolved Hide resolved

Returns:
A `Receiver` to read results of the given function from.
A new receiver that applies the function on the received values.
"""
return _Map(self, call)

Expand Down Expand Up @@ -291,13 +291,13 @@ def __init__(

Args:
receiver: The input receiver.
transform: The function to run on the input data.
transform: The function to apply on the input data.
"""
self._receiver: Receiver[_T_co] = receiver
"""The input receiver."""

self._transform: Callable[[_T_co], _U_co] = transform
"""The function to run on the input data."""
"""The function to apply on the input data."""

async def ready(self) -> bool:
"""Wait until the receiver is ready with a value or an error.
Expand Down
2 changes: 1 addition & 1 deletion src/frequenz/channels/_select.py
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ def __repr__(self) -> str:
def selected_from(
selected: Selected[Any], receiver: Receiver[_T]
) -> TypeGuard[Selected[_T]]:
"""Check if the given receiver was selected by [`select()`][frequenz.channels.select].
"""Check whether the given receiver was selected by [`select()`][frequenz.channels.select].

This function is used in conjunction with the
[`Selected`][frequenz.channels.Selected] class to determine which receiver was
Expand Down