-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Support filtering the messages on a receiver #303
Conversation
What about adding an |
There is also https://snyk.io/advisor/python/asyncstdlib. Maybe we should start using that? It is strange that this is not part of Python stdlib already. |
If we agree it is a good idea we could add it to repo-config so it is used by default, like we do with |
This gives out |
I do agree, it would be very useful, but I don't think it can replace this PR, because the filter in this PR returns receivers, which we can put in select or any of the many possibilities. |
Right. OK, and I guess it is useful to get a receiver because it can be used in filtered_receiver = as_receiver(a.filter(lambda num: num % 2), original_receiver)
async for selected in select(filtered_receiver, ...):
print(f"An even number: {message}") But if we want to move in that direction, we'll eventually have to remove Will start the review now then... |
|
3becd73
to
e72d19c
Compare
Based on #301 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Not approving until it's not a draft anymore.
Also tests are failing:
|
Signed-off-by: Sahas Subramanian <sahas.subramanian@proton.me>
Signed-off-by: Sahas Subramanian <sahas.subramanian@proton.me>
Signed-off-by: Sahas Subramanian <sahas.subramanian@proton.me>
Fixed the long line |
A new
filter
method is added to theReceiver
interface, which allows the application of a filter function on the messages on a receiver.Example: