-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Backport from master (5.3.0b5) (#3506)
* Fixed flacky TokenManager test (#3468) * Fixed flacky TokenManager test * Fixed additional flacky test * Removed token count assertion * Skipped test on version 3.9 * Fix incorrect attribute reuse (#3456) add CacheEntry Co-authored-by: zhousheng06 <[email protected]> Co-authored-by: Vladyslav Vildanov <[email protected]> * Expand type for EncodedT (#3472) As of PEP 688, type checkers will no longer implicitly consider bytearray to be compatible with bytes * Moved self._lock initialisation to Pool constructor (#3473) * Moved self._lock initialisation to Pool constructor * Added test case * Codestyle fixes * Added correct annotations * DOC-4423: add TCEs for various command pages (#3476) Co-authored-by: Vladyslav Vildanov <[email protected]> * DOC-4345 added testable JSON search examples for home page (#3407) * DOC-4345 added testable JSON search examples for home page * DOC-4345 avoid possible non-deterministic results in tests * DOC-4345 close connection at end of example * DOC-4345 remove unnecessary blank lines * Adding unit text fixes to improve compatibility with MacOS. (#3486) * Adding unit text fixes to improve compatibility with MacOS. * Applying review comments * Unifying the exception msg validation pattern for both test_connection.py files --------- Co-authored-by: Vladyslav Vildanov <[email protected]> * Add return type to `close` functions (#3496) * Add types to ConnectionPool.from_url (#3495) Co-authored-by: Vladyslav Vildanov <[email protected]> * Add types to execute method of pipelines (#3494) Co-authored-by: Vladyslav Vildanov <[email protected]> * DOC-4796 fixed capped lists example (#3493) Co-authored-by: Vladyslav Vildanov <[email protected]> * typing for client __init__ (#3357) * typing for client __init__ * typing with string literals * retry_on_error more specific typing * retry typing * fix lint --------- Co-authored-by: Vladyslav Vildanov <[email protected]> * test: Updated CredentialProvider test infrastructure (#3502) * test: Updated CredentialProvider test infrastructure * Added linter exclusion * Updated dev dependency * Codestyle fixes * Updated async test infra * Added missing constant * Updated package version * Updated testing versions and docs * Updated server versions * Fixed test --------- Co-authored-by: zs-neo <[email protected]> Co-authored-by: zhousheng06 <[email protected]> Co-authored-by: Shantanu <[email protected]> Co-authored-by: David Dougherty <[email protected]> Co-authored-by: andy-stark-redis <[email protected]> Co-authored-by: petyaslavova <[email protected]> Co-authored-by: Patrick Arminio <[email protected]> Co-authored-by: Artur Mostowski <[email protected]>
- Loading branch information
1 parent
8056198
commit 28964c1
Showing
26 changed files
with
670 additions
and
203 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,4 +16,4 @@ uvloop | |
vulture>=2.3.0 | ||
wheel>=0.30.0 | ||
numpy>=1.24.0 | ||
redis-entraid==0.1.0b1 | ||
redis-entraid==0.3.0b1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# EXAMPLE: cmds_cnxmgmt | ||
# HIDE_START | ||
import redis | ||
|
||
r = redis.Redis(decode_responses=True) | ||
# HIDE_END | ||
|
||
# STEP_START auth1 | ||
# REMOVE_START | ||
r.config_set("requirepass", "temp_pass") | ||
# REMOVE_END | ||
res1 = r.auth(password="temp_pass") | ||
print(res1) # >>> True | ||
|
||
res2 = r.auth(password="temp_pass", username="default") | ||
print(res2) # >>> True | ||
|
||
# REMOVE_START | ||
assert res1 == True | ||
assert res2 == True | ||
r.config_set("requirepass", "") | ||
# REMOVE_END | ||
# STEP_END | ||
|
||
# STEP_START auth2 | ||
# REMOVE_START | ||
r.acl_setuser("test-user", enabled=True, passwords=["+strong_password"], commands=["+acl"]) | ||
# REMOVE_END | ||
res = r.auth(username="test-user", password="strong_password") | ||
print(res) # >>> True | ||
|
||
# REMOVE_START | ||
assert res == True | ||
r.acl_deluser("test-user") | ||
# REMOVE_END | ||
# STEP_END |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,123 @@ | ||
# EXAMPLE: cmds_list | ||
# HIDE_START | ||
import redis | ||
|
||
r = redis.Redis(decode_responses=True) | ||
# HIDE_END | ||
|
||
# STEP_START lpush | ||
res1 = r.lpush("mylist", "world") | ||
print(res1) # >>> 1 | ||
|
||
res2 = r.lpush("mylist", "hello") | ||
print(res2) # >>> 2 | ||
|
||
res3 = r.lrange("mylist", 0, -1) | ||
print(res3) # >>> [ "hello", "world" ] | ||
|
||
# REMOVE_START | ||
assert res3 == [ "hello", "world" ] | ||
r.delete("mylist") | ||
# REMOVE_END | ||
# STEP_END | ||
|
||
# STEP_START lrange | ||
res4 = r.rpush("mylist", "one"); | ||
print(res4) # >>> 1 | ||
|
||
res5 = r.rpush("mylist", "two") | ||
print(res5) # >>> 2 | ||
|
||
res6 = r.rpush("mylist", "three") | ||
print(res6) # >>> 3 | ||
|
||
res7 = r.lrange('mylist', 0, 0) | ||
print(res7) # >>> [ 'one' ] | ||
|
||
res8 = r.lrange('mylist', -3, 2) | ||
print(res8) # >>> [ 'one', 'two', 'three' ] | ||
|
||
res9 = r.lrange('mylist', -100, 100) | ||
print(res9) # >>> [ 'one', 'two', 'three' ] | ||
|
||
res10 = r.lrange('mylist', 5, 10) | ||
print(res10) # >>> [] | ||
|
||
# REMOVE_START | ||
assert res7 == [ 'one' ] | ||
assert res8 == [ 'one', 'two', 'three' ] | ||
assert res9 == [ 'one', 'two', 'three' ] | ||
assert res10 == [] | ||
r.delete('mylist') | ||
# REMOVE_END | ||
# STEP_END | ||
|
||
# STEP_START llen | ||
res11 = r.lpush("mylist", "World") | ||
print(res11) # >>> 1 | ||
|
||
res12 = r.lpush("mylist", "Hello") | ||
print(res12) # >>> 2 | ||
|
||
res13 = r.llen("mylist") | ||
print(res13) # >>> 2 | ||
|
||
# REMOVE_START | ||
assert res13 == 2 | ||
r.delete("mylist") | ||
# REMOVE_END | ||
# STEP_END | ||
|
||
# STEP_START rpush | ||
res14 = r.rpush("mylist", "hello") | ||
print(res14) # >>> 1 | ||
|
||
res15 = r.rpush("mylist", "world") | ||
print(res15) # >>> 2 | ||
|
||
res16 = r.lrange("mylist", 0, -1) | ||
print(res16) # >>> [ "hello", "world" ] | ||
|
||
# REMOVE_START | ||
assert res16 == [ "hello", "world" ] | ||
r.delete("mylist") | ||
# REMOVE_END | ||
# STEP_END | ||
|
||
# STEP_START lpop | ||
res17 = r.rpush("mylist", *["one", "two", "three", "four", "five"]) | ||
print(res17) # >>> 5 | ||
|
||
res18 = r.lpop("mylist") | ||
print(res18) # >>> "one" | ||
|
||
res19 = r.lpop("mylist", 2) | ||
print(res19) # >>> ['two', 'three'] | ||
|
||
res17 = r.lrange("mylist", 0, -1) | ||
print(res17) # >>> [ "four", "five" ] | ||
|
||
# REMOVE_START | ||
assert res17 == [ "four", "five" ] | ||
r.delete("mylist") | ||
# REMOVE_END | ||
# STEP_END | ||
|
||
# STEP_START rpop | ||
res18 = r.rpush("mylist", *["one", "two", "three", "four", "five"]) | ||
print(res18) # >>> 5 | ||
|
||
res19 = r.rpop("mylist") | ||
print(res19) # >>> "five" | ||
|
||
res20 = r.rpop("mylist", 2) | ||
print(res20) # >>> ['four', 'three'] | ||
|
||
res21 = r.lrange("mylist", 0, -1) | ||
print(res21) # >>> [ "one", "two" ] | ||
|
||
# REMOVE_START | ||
assert res21 == [ "one", "two" ] | ||
r.delete("mylist") | ||
# REMOVE_END | ||
# STEP_END |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# EXAMPLE: cmds_servermgmt | ||
# HIDE_START | ||
import redis | ||
|
||
r = redis.Redis(decode_responses=True) | ||
# HIDE_END | ||
|
||
# STEP_START flushall | ||
# REMOVE_START | ||
r.set("foo", "1") | ||
r.set("bar", "2") | ||
r.set("baz", "3") | ||
# REMOVE_END | ||
res1 = r.flushall(asynchronous=False) | ||
print(res1) # >>> True | ||
|
||
res2 = r.keys() | ||
print(res2) # >>> [] | ||
|
||
# REMOVE_START | ||
assert res1 == True | ||
assert res2 == [] | ||
# REMOVE_END | ||
# STEP_END | ||
|
||
# STEP_START info | ||
res3 = r.info() | ||
print(res3) | ||
# >>> {'redis_version': '7.4.0', 'redis_git_sha1': 'c9d29f6a',...} | ||
# STEP_END |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# EXAMPLE: cmds_set | ||
# HIDE_START | ||
import redis | ||
|
||
r = redis.Redis(decode_responses=True) | ||
# HIDE_END | ||
|
||
# STEP_START sadd | ||
res1 = r.sadd("myset", "Hello", "World") | ||
print(res1) # >>> 2 | ||
|
||
res2 = r.sadd("myset", "World") | ||
print(res2) # >>> 0 | ||
|
||
res3 = r.smembers("myset") | ||
print(res3) # >>> {'Hello', 'World'} | ||
|
||
# REMOVE_START | ||
assert res3 == {'Hello', 'World'} | ||
r.delete('myset') | ||
# REMOVE_END | ||
# STEP_END | ||
|
||
# STEP_START smembers | ||
res4 = r.sadd("myset", "Hello", "World") | ||
print(res4) # >>> 2 | ||
|
||
res5 = r.smembers("myset") | ||
print(res5) # >>> {'Hello', 'World'} | ||
|
||
# REMOVE_START | ||
assert res5 == {'Hello', 'World'} | ||
r.delete('myset') | ||
# REMOVE_END | ||
# STEP_END |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.