You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Accept a function to determine how to save the previous message in WithPrevious #344
Where the first argument is the previous message, the second argument is the new message and the return is what's saved as the previous message.
Use cases
Implement a filter that ensures the received messages are monotonically increasing: get_previous=lambda prev, new: max(prev, new).
Alternatives and workarounds
Write a custom filter predicate from scratch.
Additional context
This would make the API a bit more complicated as we actually need to expose the sentinel, because the previous message could be not received yet, or make the feature less flexible and always saving the first message as the previous message.
With a sentinel it would look like Callable[[T | MISSING, T], T].
changed the title [-]Accept a function to determine how to save the previous message in `OnlyIfPrevious`[/-][+]Accept a function to determine how to save the previous message in `WithPrevious`[/+]on Dec 2, 2024
Activity
[-]Accept a function to determine how to save the previous message in `OnlyIfPrevious`[/-][+]Accept a function to determine how to save the previous message in `WithPrevious`[/+]