Skip to content

Commit

Permalink
Add default None for maxlen at xtrim command (#2188)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
3 people authored May 31, 2022
1 parent bac33d4 commit 4a73d85
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion redis/commands/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -3842,7 +3842,7 @@ def xrevrange(
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,
Expand All @@ -3863,6 +3863,9 @@ def xtrim(
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:
Expand Down

0 comments on commit 4a73d85

Please sign in to comment.