-
Notifications
You must be signed in to change notification settings - Fork 53
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
Python: adds ZPOPMIN command #975
Conversation
|
||
Args: | ||
key (str): The key of the sorted set. | ||
count (Optional[int]): If not specified or None, pops one member. |
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.
missing the description of this arg. something like
Count: "Specifies the quantity of members to pop. If not specified, pops one member."
If `count` is higher than the sorted set's cardinality, returns all members and their scores. | ||
|
||
Returns: | ||
Map[str, float]: A map of the removed members and their scores, ordered from the one with the lowest score to the one with the highest. |
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.
Map or Mapping?
return cast( | ||
Mapping[str, float], | ||
await self._execute_command( | ||
RequestType.ZPopMin, [key, str(count)] if count else [key] |
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.
what happens if count == 0 or a negative value? is it acceptable by redis?
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.
count == 0 returns an empty map, negative value will raise an error, Ill add a check
@@ -1024,6 +1024,25 @@ def zcount( | |||
""" | |||
self.append_command(RequestType.Zcount, [key, min_score.value, max_score.value]) | |||
|
|||
def zpopmin(self, key: str, count: Optional[int] = None): |
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.
same comments
873ca72
to
778d67a
Compare
778d67a
to
441c588
Compare
Issue #, if available:
Description of changes:
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.