diff options
author | dvora-h <67596500+dvora-h@users.noreply.github.com> | 2022-04-04 13:06:01 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-04 13:06:01 +0300 |
commit | d4fcd999b7206b7960f0aa01d8f5c71b699df491 (patch) | |
tree | abf20d8acb44677c3970b56a7764d0357859d6b2 /redis/commands/core.py | |
parent | 7b7c6c8867a66493c51ed6525c6a0863f437f530 (diff) | |
download | redis-py-d4fcd999b7206b7960f0aa01d8f5c71b699df491.tar.gz |
Add support for BIT|BYTE option (#2068)
* Add support for BIT|BYTE option
* linters
Diffstat (limited to 'redis/commands/core.py')
-rw-r--r-- | redis/commands/core.py | 7 |
1 files changed, 7 insertions, 0 deletions
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( |