summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormfgnik <31517000+mfgnik@users.noreply.github.com>2022-05-31 13:46:12 +0300
committerGitHub <noreply@github.com>2022-05-31 13:46:12 +0300
commit4a73d85c78ce0ca36e5100b7ee0047b773cec23f (patch)
tree3b7f906ddf480a93ea5a32f9e146f3f8aeafe910
parentbac33d4a92892ca7982b461347151bff5a661f0d (diff)
downloadredis-py-4a73d85c78ce0ca36e5100b7ee0047b773cec23f.tar.gz
Add default None for maxlen at xtrim command (#2188)
* Add default None for maxlen at xtrim command * Fix linter Co-authored-by: Mikhail Fedorov <mfgnik@yandex.team.ru> Co-authored-by: dvora-h <67596500+dvora-h@users.noreply.github.com>
-rw-r--r--redis/commands/core.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/redis/commands/core.py b/redis/commands/core.py
index 771fed9..ab246a7 100644
--- a/redis/commands/core.py
+++ b/redis/commands/core.py
@@ -3842,7 +3842,7 @@ class StreamCommands(CommandsProtocol):
def xtrim(
self,
name: KeyT,
- maxlen: Union[int, None],
+ maxlen: Union[int, None] = None,
approximate: bool = True,
minid: Union[StreamIdT, None] = None,
limit: Union[int, None] = None,
@@ -3863,6 +3863,9 @@ class StreamCommands(CommandsProtocol):
if maxlen is not None and minid is not None:
raise DataError("Only one of ``maxlen`` or ``minid`` " "may be specified")
+ if maxlen is None and minid is None:
+ raise DataError("One of ``maxlen`` or ``minid`` must be specified")
+
if maxlen is not None:
pieces.append(b"MAXLEN")
if minid is not None: