Skip to content

Commit 4a73d85

Browse files
mfgnikMikhail Fedorovdvora-h
authored
Add default None for maxlen at xtrim command (#2188)
* Add default None for maxlen at xtrim command * Fix linter Co-authored-by: Mikhail Fedorov <[email protected]> Co-authored-by: dvora-h <[email protected]>
1 parent bac33d4 commit 4a73d85

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

redis/commands/core.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3842,7 +3842,7 @@ def xrevrange(
38423842
def xtrim(
38433843
self,
38443844
name: KeyT,
3845-
maxlen: Union[int, None],
3845+
maxlen: Union[int, None] = None,
38463846
approximate: bool = True,
38473847
minid: Union[StreamIdT, None] = None,
38483848
limit: Union[int, None] = None,
@@ -3863,6 +3863,9 @@ def xtrim(
38633863
if maxlen is not None and minid is not None:
38643864
raise DataError("Only one of ``maxlen`` or ``minid`` " "may be specified")
38653865

3866+
if maxlen is None and minid is None:
3867+
raise DataError("One of ``maxlen`` or ``minid`` must be specified")
3868+
38663869
if maxlen is not None:
38673870
pieces.append(b"MAXLEN")
38683871
if minid is not None:

0 commit comments

Comments
 (0)