From 72a37d7ad260f4039337269146ddf7ae9bdaf161 Mon Sep 17 00:00:00 2001 From: Mikhail Fedorov Date: Wed, 18 May 2022 17:01:47 +0300 Subject: [PATCH 1/2] Add default None for maxlen at xtrim command --- redis/commands/core.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/redis/commands/core.py b/redis/commands/core.py index 3569d20e0a..394bdbcb71 100644 --- a/redis/commands/core.py +++ b/redis/commands/core.py @@ -3888,7 +3888,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, @@ -3909,6 +3909,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: From 8a53aad434eff52c4194479f46a410fcd22209c9 Mon Sep 17 00:00:00 2001 From: Mikhail Fedorov Date: Wed, 18 May 2022 17:55:08 +0300 Subject: [PATCH 2/2] Fix linter --- redis/commands/search/commands.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/redis/commands/search/commands.py b/redis/commands/search/commands.py index 5a9f6fec54..10b57624cd 100644 --- a/redis/commands/search/commands.py +++ b/redis/commands/search/commands.py @@ -167,7 +167,7 @@ def dropindex(self, delete_documents=False): ### Parameters: - **delete_documents**: If `True`, all documents will be deleted. - + For more information see `FT.DROPINDEX `_. """ # noqa keep_str = "" if delete_documents else "KEEPDOCS"