Skip to content

Commit cc09ecd

Browse files
authored
Merge branch 'master' into ps_improve_jsontype_definition
2 parents 3176205 + 8325ce2 commit cc09ecd

File tree

6 files changed

+25
-23
lines changed

6 files changed

+25
-23
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
The Python interface to the Redis key-value store.
44

55
[![CI](https://github.com/redis/redis-py/workflows/CI/badge.svg?branch=master)](https://github.com/redis/redis-py/actions?query=workflow%3ACI+branch%3Amaster)
6-
[![docs](https://readthedocs.org/projects/redis/badge/?version=stable&style=flat)](https://redis-py.readthedocs.io/en/stable/)
6+
[![docs](https://readthedocs.org/projects/redis/badge/?version=stable&style=flat)](https://redis.readthedocs.io/en/stable/)
77
[![MIT licensed](https://img.shields.io/badge/license-MIT-blue.svg)](./LICENSE)
88
[![pypi](https://badge.fury.io/py/redis.svg)](https://pypi.org/project/redis/)
99
[![pre-release](https://img.shields.io/github/v/release/redis/redis-py?include_prereleases&label=latest-prerelease)](https://github.com/redis/redis-py/releases)

docs/examples/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
# Examples
22

3-
Examples of redis-py usage go here. They're being linked to the [generated documentation](https://redis-py.readthedocs.org).
3+
Examples of redis-py usage go here. They're being linked to the [generated documentation](https://redis.readthedocs.org).

docs/examples/opentelemetry/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ This example demonstrates how to monitor Redis using [OpenTelemetry](https://ope
44
[Uptrace](https://github.com/uptrace/uptrace). It requires Docker to start Redis Server and Uptrace.
55

66
See
7-
[Monitoring redis-py performance with OpenTelemetry](https://redis-py.readthedocs.io/en/latest/opentelemetry.html)
7+
[Monitoring redis-py performance with OpenTelemetry](https://redis.readthedocs.io/en/latest/opentelemetry.html)
88
for details.
99

1010
**Step 1**. Download the example using Git:

redis/asyncio/cluster.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2350,10 +2350,11 @@ async def reset(self):
23502350
# watching something
23512351
if self._transaction_connection:
23522352
try:
2353-
# call this manually since our unwatch or
2354-
# immediate_execute_command methods can call reset()
2355-
await self._transaction_connection.send_command("UNWATCH")
2356-
await self._transaction_connection.read_response()
2353+
if self._watching:
2354+
# call this manually since our unwatch or
2355+
# immediate_execute_command methods can call reset()
2356+
await self._transaction_connection.send_command("UNWATCH")
2357+
await self._transaction_connection.read_response()
23572358
# we can safely return the connection to the pool here since we're
23582359
# sure we're no longer WATCHing anything
23592360
self._transaction_node.release(self._transaction_connection)

redis/cluster.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3289,10 +3289,11 @@ def reset(self):
32893289
# watching something
32903290
if self._transaction_connection:
32913291
try:
3292-
# call this manually since our unwatch or
3293-
# immediate_execute_command methods can call reset()
3294-
self._transaction_connection.send_command("UNWATCH")
3295-
self._transaction_connection.read_response()
3292+
if self._watching:
3293+
# call this manually since our unwatch or
3294+
# immediate_execute_command methods can call reset()
3295+
self._transaction_connection.send_command("UNWATCH")
3296+
self._transaction_connection.read_response()
32963297
# we can safely return the connection to the pool here since we're
32973298
# sure we're no longer WATCHing anything
32983299
node = self._nodes_manager.find_connection_owner(

redis/commands/core.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3290,15 +3290,15 @@ class SetCommands(CommandsProtocol):
32903290
see: https://redis.io/topics/data-types#sets
32913291
"""
32923292

3293-
def sadd(self, name: str, *values: FieldT) -> Union[Awaitable[int], int]:
3293+
def sadd(self, name: KeyT, *values: FieldT) -> Union[Awaitable[int], int]:
32943294
"""
32953295
Add ``value(s)`` to set ``name``
32963296
32973297
For more information see https://redis.io/commands/sadd
32983298
"""
32993299
return self.execute_command("SADD", name, *values)
33003300

3301-
def scard(self, name: str) -> Union[Awaitable[int], int]:
3301+
def scard(self, name: KeyT) -> Union[Awaitable[int], int]:
33023302
"""
33033303
Return the number of elements in set ``name``
33043304
@@ -3337,7 +3337,7 @@ def sinter(self, keys: List, *args: List) -> Union[Awaitable[list], list]:
33373337
return self.execute_command("SINTER", *args, keys=args)
33383338

33393339
def sintercard(
3340-
self, numkeys: int, keys: List[str], limit: int = 0
3340+
self, numkeys: int, keys: List[KeyT], limit: int = 0
33413341
) -> Union[Awaitable[int], int]:
33423342
"""
33433343
Return the cardinality of the intersect of multiple sets specified by ``keys``.
@@ -3352,7 +3352,7 @@ def sintercard(
33523352
return self.execute_command("SINTERCARD", *args, keys=keys)
33533353

33543354
def sinterstore(
3355-
self, dest: str, keys: List, *args: List
3355+
self, dest: KeyT, keys: List, *args: List
33563356
) -> Union[Awaitable[int], int]:
33573357
"""
33583358
Store the intersection of sets specified by ``keys`` into a new
@@ -3364,7 +3364,7 @@ def sinterstore(
33643364
return self.execute_command("SINTERSTORE", dest, *args)
33653365

33663366
def sismember(
3367-
self, name: str, value: str
3367+
self, name: KeyT, value: str
33683368
) -> Union[Awaitable[Union[Literal[0], Literal[1]]], Union[Literal[0], Literal[1]]]:
33693369
"""
33703370
Return whether ``value`` is a member of set ``name``:
@@ -3375,7 +3375,7 @@ def sismember(
33753375
"""
33763376
return self.execute_command("SISMEMBER", name, value, keys=[name])
33773377

3378-
def smembers(self, name: str) -> Union[Awaitable[Set], Set]:
3378+
def smembers(self, name: KeyT) -> Union[Awaitable[Set], Set]:
33793379
"""
33803380
Return all members of the set ``name``
33813381
@@ -3384,7 +3384,7 @@ def smembers(self, name: str) -> Union[Awaitable[Set], Set]:
33843384
return self.execute_command("SMEMBERS", name, keys=[name])
33853385

33863386
def smismember(
3387-
self, name: str, values: List, *args: List
3387+
self, name: KeyT, values: List, *args: List
33883388
) -> Union[
33893389
Awaitable[List[Union[Literal[0], Literal[1]]]],
33903390
List[Union[Literal[0], Literal[1]]],
@@ -3400,15 +3400,15 @@ def smismember(
34003400
args = list_or_args(values, args)
34013401
return self.execute_command("SMISMEMBER", name, *args, keys=[name])
34023402

3403-
def smove(self, src: str, dst: str, value: str) -> Union[Awaitable[bool], bool]:
3403+
def smove(self, src: KeyT, dst: KeyT, value: str) -> Union[Awaitable[bool], bool]:
34043404
"""
34053405
Move ``value`` from set ``src`` to set ``dst`` atomically
34063406
34073407
For more information see https://redis.io/commands/smove
34083408
"""
34093409
return self.execute_command("SMOVE", src, dst, value)
34103410

3411-
def spop(self, name: str, count: Optional[int] = None) -> Union[str, List, None]:
3411+
def spop(self, name: KeyT, count: Optional[int] = None) -> Union[str, List, None]:
34123412
"""
34133413
Remove and return a random member of set ``name``
34143414
@@ -3418,7 +3418,7 @@ def spop(self, name: str, count: Optional[int] = None) -> Union[str, List, None]
34183418
return self.execute_command("SPOP", name, *args)
34193419

34203420
def srandmember(
3421-
self, name: str, number: Optional[int] = None
3421+
self, name: KeyT, number: Optional[int] = None
34223422
) -> Union[str, List, None]:
34233423
"""
34243424
If ``number`` is None, returns a random member of set ``name``.
@@ -3432,7 +3432,7 @@ def srandmember(
34323432
args = (number is not None) and [number] or []
34333433
return self.execute_command("SRANDMEMBER", name, *args)
34343434

3435-
def srem(self, name: str, *values: FieldT) -> Union[Awaitable[int], int]:
3435+
def srem(self, name: KeyT, *values: FieldT) -> Union[Awaitable[int], int]:
34363436
"""
34373437
Remove ``values`` from set ``name``
34383438
@@ -3450,7 +3450,7 @@ def sunion(self, keys: List, *args: List) -> Union[Awaitable[List], List]:
34503450
return self.execute_command("SUNION", *args, keys=args)
34513451

34523452
def sunionstore(
3453-
self, dest: str, keys: List, *args: List
3453+
self, dest: KeyT, keys: List, *args: List
34543454
) -> Union[Awaitable[int], int]:
34553455
"""
34563456
Store the union of sets specified by ``keys`` into a new

0 commit comments

Comments
 (0)