From d4fcd999b7206b7960f0aa01d8f5c71b699df491 Mon Sep 17 00:00:00 2001 From: dvora-h <67596500+dvora-h@users.noreply.github.com> Date: Mon, 4 Apr 2022 13:06:01 +0300 Subject: Add support for BIT|BYTE option (#2068) * Add support for BIT|BYTE option * linters --- redis/commands/core.py | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'redis/commands/core.py') diff --git a/redis/commands/core.py b/redis/commands/core.py index 55ec5ec..e2d45fe 100644 --- a/redis/commands/core.py +++ b/redis/commands/core.py @@ -1363,6 +1363,7 @@ class BasicKeyCommands(CommandsProtocol): key: KeyT, start: Union[int, None] = None, end: Union[int, None] = None, + mode: Optional[str] = None, ) -> ResponseT: """ Returns the count of set bits in the value of ``key``. Optional @@ -1376,6 +1377,8 @@ class BasicKeyCommands(CommandsProtocol): params.append(end) elif (start is not None and end is None) or (end is not None and start is None): raise DataError("Both start and end must be specified") + if mode is not None: + params.append(mode) return self.execute_command("BITCOUNT", *params) def bitfield( @@ -1411,6 +1414,7 @@ class BasicKeyCommands(CommandsProtocol): bit: int, start: Union[int, None] = None, end: Union[int, None] = None, + mode: Optional[str] = None, ) -> ResponseT: """ Return the position of the first bit set to 1 or 0 in a string. @@ -1430,6 +1434,9 @@ class BasicKeyCommands(CommandsProtocol): params.append(end) elif start is None and end is not None: raise DataError("start argument is not set, " "when end is specified") + + if mode is not None: + params.append(mode) return self.execute_command("BITPOS", *params) def copy( -- cgit v1.2.1