coredis 5.0.0__tar.gz → 5.0.0rc2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of coredis might be problematic. Click here for more details.
- {coredis-5.0.0 → coredis-5.0.0rc2}/HISTORY.rst +0 -27
- {coredis-5.0.0/coredis.egg-info → coredis-5.0.0rc2}/PKG-INFO +2 -1
- {coredis-5.0.0 → coredis-5.0.0rc2}/coredis/_protocols.py +23 -0
- {coredis-5.0.0 → coredis-5.0.0rc2}/coredis/_utils.py +4 -0
- {coredis-5.0.0 → coredis-5.0.0rc2}/coredis/_version.py +3 -3
- {coredis-5.0.0 → coredis-5.0.0rc2}/coredis/commands/core.py +8 -50
- {coredis-5.0.0 → coredis-5.0.0rc2}/coredis/commands/script.py +16 -12
- {coredis-5.0.0 → coredis-5.0.0rc2}/coredis/pipeline.py +6 -5
- {coredis-5.0.0 → coredis-5.0.0rc2}/coredis/response/_callbacks/vector_sets.py +11 -44
- {coredis-5.0.0 → coredis-5.0.0rc2}/coredis/sentinel.py +0 -10
- {coredis-5.0.0 → coredis-5.0.0rc2}/coredis/tokens.py +0 -5
- {coredis-5.0.0 → coredis-5.0.0rc2/coredis.egg-info}/PKG-INFO +2 -1
- {coredis-5.0.0 → coredis-5.0.0rc2}/pyproject.toml +1 -1
- {coredis-5.0.0 → coredis-5.0.0rc2}/requirements/dev.txt +1 -1
- {coredis-5.0.0 → coredis-5.0.0rc2}/setup.py +1 -0
- {coredis-5.0.0 → coredis-5.0.0rc2}/LICENSE +0 -0
- {coredis-5.0.0 → coredis-5.0.0rc2}/MANIFEST.in +0 -0
- {coredis-5.0.0 → coredis-5.0.0rc2}/README.md +0 -0
- {coredis-5.0.0 → coredis-5.0.0rc2}/coredis/__init__.py +0 -0
- {coredis-5.0.0 → coredis-5.0.0rc2}/coredis/_json.py +0 -0
- {coredis-5.0.0 → coredis-5.0.0rc2}/coredis/_packer.py +0 -0
- {coredis-5.0.0 → coredis-5.0.0rc2}/coredis/_py_311_typing.py +0 -0
- {coredis-5.0.0 → coredis-5.0.0rc2}/coredis/_py_312_typing.py +0 -0
- {coredis-5.0.0 → coredis-5.0.0rc2}/coredis/_sidecar.py +0 -0
- {coredis-5.0.0 → coredis-5.0.0rc2}/coredis/cache.py +0 -0
- {coredis-5.0.0 → coredis-5.0.0rc2}/coredis/client/__init__.py +0 -0
- {coredis-5.0.0 → coredis-5.0.0rc2}/coredis/client/basic.py +0 -0
- {coredis-5.0.0 → coredis-5.0.0rc2}/coredis/client/cluster.py +0 -0
- {coredis-5.0.0 → coredis-5.0.0rc2}/coredis/commands/__init__.py +0 -0
- {coredis-5.0.0 → coredis-5.0.0rc2}/coredis/commands/_key_spec.py +0 -0
- {coredis-5.0.0 → coredis-5.0.0rc2}/coredis/commands/_utils.py +0 -0
- {coredis-5.0.0 → coredis-5.0.0rc2}/coredis/commands/_validators.py +0 -0
- {coredis-5.0.0 → coredis-5.0.0rc2}/coredis/commands/_wrappers.py +0 -0
- {coredis-5.0.0 → coredis-5.0.0rc2}/coredis/commands/bitfield.py +0 -0
- {coredis-5.0.0 → coredis-5.0.0rc2}/coredis/commands/constants.py +0 -0
- {coredis-5.0.0 → coredis-5.0.0rc2}/coredis/commands/function.py +0 -0
- {coredis-5.0.0 → coredis-5.0.0rc2}/coredis/commands/monitor.py +0 -0
- {coredis-5.0.0 → coredis-5.0.0rc2}/coredis/commands/pubsub.py +0 -0
- {coredis-5.0.0 → coredis-5.0.0rc2}/coredis/commands/request.py +0 -0
- {coredis-5.0.0 → coredis-5.0.0rc2}/coredis/commands/sentinel.py +0 -0
- {coredis-5.0.0 → coredis-5.0.0rc2}/coredis/config.py +0 -0
- {coredis-5.0.0 → coredis-5.0.0rc2}/coredis/connection.py +0 -0
- {coredis-5.0.0 → coredis-5.0.0rc2}/coredis/constants.py +0 -0
- {coredis-5.0.0 → coredis-5.0.0rc2}/coredis/credentials.py +0 -0
- {coredis-5.0.0 → coredis-5.0.0rc2}/coredis/exceptions.py +0 -0
- {coredis-5.0.0 → coredis-5.0.0rc2}/coredis/experimental/__init__.py +0 -0
- {coredis-5.0.0 → coredis-5.0.0rc2}/coredis/globals.py +0 -0
- {coredis-5.0.0 → coredis-5.0.0rc2}/coredis/modules/__init__.py +0 -0
- {coredis-5.0.0 → coredis-5.0.0rc2}/coredis/modules/autocomplete.py +0 -0
- {coredis-5.0.0 → coredis-5.0.0rc2}/coredis/modules/base.py +0 -0
- {coredis-5.0.0 → coredis-5.0.0rc2}/coredis/modules/filters.py +0 -0
- {coredis-5.0.0 → coredis-5.0.0rc2}/coredis/modules/graph.py +0 -0
- {coredis-5.0.0 → coredis-5.0.0rc2}/coredis/modules/json.py +0 -0
- {coredis-5.0.0 → coredis-5.0.0rc2}/coredis/modules/response/__init__.py +0 -0
- {coredis-5.0.0 → coredis-5.0.0rc2}/coredis/modules/response/_callbacks/__init__.py +0 -0
- {coredis-5.0.0 → coredis-5.0.0rc2}/coredis/modules/response/_callbacks/autocomplete.py +0 -0
- {coredis-5.0.0 → coredis-5.0.0rc2}/coredis/modules/response/_callbacks/graph.py +0 -0
- {coredis-5.0.0 → coredis-5.0.0rc2}/coredis/modules/response/_callbacks/json.py +0 -0
- {coredis-5.0.0 → coredis-5.0.0rc2}/coredis/modules/response/_callbacks/search.py +0 -0
- {coredis-5.0.0 → coredis-5.0.0rc2}/coredis/modules/response/_callbacks/timeseries.py +0 -0
- {coredis-5.0.0 → coredis-5.0.0rc2}/coredis/modules/response/types.py +0 -0
- {coredis-5.0.0 → coredis-5.0.0rc2}/coredis/modules/search.py +0 -0
- {coredis-5.0.0 → coredis-5.0.0rc2}/coredis/modules/timeseries.py +0 -0
- {coredis-5.0.0 → coredis-5.0.0rc2}/coredis/parser.py +0 -0
- {coredis-5.0.0 → coredis-5.0.0rc2}/coredis/pool/__init__.py +0 -0
- {coredis-5.0.0 → coredis-5.0.0rc2}/coredis/pool/basic.py +0 -0
- {coredis-5.0.0 → coredis-5.0.0rc2}/coredis/pool/cluster.py +0 -0
- {coredis-5.0.0 → coredis-5.0.0rc2}/coredis/pool/nodemanager.py +0 -0
- {coredis-5.0.0 → coredis-5.0.0rc2}/coredis/py.typed +0 -0
- {coredis-5.0.0 → coredis-5.0.0rc2}/coredis/recipes/__init__.py +0 -0
- {coredis-5.0.0 → coredis-5.0.0rc2}/coredis/recipes/credentials/__init__.py +0 -0
- {coredis-5.0.0 → coredis-5.0.0rc2}/coredis/recipes/credentials/iam_provider.py +0 -0
- {coredis-5.0.0 → coredis-5.0.0rc2}/coredis/recipes/locks/__init__.py +0 -0
- {coredis-5.0.0 → coredis-5.0.0rc2}/coredis/recipes/locks/extend.lua +0 -0
- {coredis-5.0.0 → coredis-5.0.0rc2}/coredis/recipes/locks/lua_lock.py +0 -0
- {coredis-5.0.0 → coredis-5.0.0rc2}/coredis/recipes/locks/release.lua +0 -0
- {coredis-5.0.0 → coredis-5.0.0rc2}/coredis/response/__init__.py +0 -0
- {coredis-5.0.0 → coredis-5.0.0rc2}/coredis/response/_callbacks/__init__.py +0 -0
- {coredis-5.0.0 → coredis-5.0.0rc2}/coredis/response/_callbacks/acl.py +0 -0
- {coredis-5.0.0 → coredis-5.0.0rc2}/coredis/response/_callbacks/cluster.py +0 -0
- {coredis-5.0.0 → coredis-5.0.0rc2}/coredis/response/_callbacks/command.py +0 -0
- {coredis-5.0.0 → coredis-5.0.0rc2}/coredis/response/_callbacks/connection.py +0 -0
- {coredis-5.0.0 → coredis-5.0.0rc2}/coredis/response/_callbacks/geo.py +0 -0
- {coredis-5.0.0 → coredis-5.0.0rc2}/coredis/response/_callbacks/hash.py +0 -0
- {coredis-5.0.0 → coredis-5.0.0rc2}/coredis/response/_callbacks/keys.py +0 -0
- {coredis-5.0.0 → coredis-5.0.0rc2}/coredis/response/_callbacks/module.py +0 -0
- {coredis-5.0.0 → coredis-5.0.0rc2}/coredis/response/_callbacks/script.py +0 -0
- {coredis-5.0.0 → coredis-5.0.0rc2}/coredis/response/_callbacks/sentinel.py +0 -0
- {coredis-5.0.0 → coredis-5.0.0rc2}/coredis/response/_callbacks/server.py +0 -0
- {coredis-5.0.0 → coredis-5.0.0rc2}/coredis/response/_callbacks/sets.py +0 -0
- {coredis-5.0.0 → coredis-5.0.0rc2}/coredis/response/_callbacks/sorted_set.py +0 -0
- {coredis-5.0.0 → coredis-5.0.0rc2}/coredis/response/_callbacks/streams.py +0 -0
- {coredis-5.0.0 → coredis-5.0.0rc2}/coredis/response/_callbacks/strings.py +0 -0
- {coredis-5.0.0 → coredis-5.0.0rc2}/coredis/response/_utils.py +0 -0
- {coredis-5.0.0 → coredis-5.0.0rc2}/coredis/response/types.py +0 -0
- {coredis-5.0.0 → coredis-5.0.0rc2}/coredis/retry.py +0 -0
- {coredis-5.0.0 → coredis-5.0.0rc2}/coredis/speedups.c +0 -0
- {coredis-5.0.0 → coredis-5.0.0rc2}/coredis/speedups.pyi +0 -0
- {coredis-5.0.0 → coredis-5.0.0rc2}/coredis/stream.py +0 -0
- {coredis-5.0.0 → coredis-5.0.0rc2}/coredis/typing.py +0 -0
- {coredis-5.0.0 → coredis-5.0.0rc2}/coredis.egg-info/SOURCES.txt +0 -0
- {coredis-5.0.0 → coredis-5.0.0rc2}/coredis.egg-info/dependency_links.txt +0 -0
- {coredis-5.0.0 → coredis-5.0.0rc2}/coredis.egg-info/requires.txt +0 -0
- {coredis-5.0.0 → coredis-5.0.0rc2}/coredis.egg-info/top_level.txt +0 -0
- {coredis-5.0.0 → coredis-5.0.0rc2}/requirements/ci.txt +0 -0
- {coredis-5.0.0 → coredis-5.0.0rc2}/requirements/dev_extra.txt +0 -0
- {coredis-5.0.0 → coredis-5.0.0rc2}/requirements/docs.txt +0 -0
- {coredis-5.0.0 → coredis-5.0.0rc2}/requirements/main.txt +0 -0
- {coredis-5.0.0 → coredis-5.0.0rc2}/requirements/publishing.txt +0 -0
- {coredis-5.0.0 → coredis-5.0.0rc2}/requirements/recipes.txt +0 -0
- {coredis-5.0.0 → coredis-5.0.0rc2}/requirements/test.txt +0 -0
- {coredis-5.0.0 → coredis-5.0.0rc2}/setup.cfg +0 -0
- {coredis-5.0.0 → coredis-5.0.0rc2}/versioneer.py +0 -0
|
@@ -3,32 +3,6 @@
|
|
|
3
3
|
Changelog
|
|
4
4
|
=========
|
|
5
5
|
|
|
6
|
-
v5.0.0
|
|
7
|
-
------
|
|
8
|
-
Release Date: 2025-07-16
|
|
9
|
-
|
|
10
|
-
* Features
|
|
11
|
-
|
|
12
|
-
* Add support for using custom types with redis commands
|
|
13
|
-
by registering serializers and deserializers
|
|
14
|
-
* Allow stacking pipeline commands synchronously
|
|
15
|
-
* Expose statically typed responses for pipeline commands
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
* Compatibility
|
|
19
|
-
|
|
20
|
-
* Redis command methods are no longer coroutines and instead
|
|
21
|
-
synchronous methods that return subclasses of ``Awaitable``
|
|
22
|
-
(``CommandRequest``) which can be awaited as before.
|
|
23
|
-
* Add support for redis 8.0 vector set commands
|
|
24
|
-
* Add support for redis 8.0 hash expiry commands
|
|
25
|
-
* Remove deprecated pubsub ``listen`` and threaded worker APIs
|
|
26
|
-
* Remove support for KeyDB
|
|
27
|
-
|
|
28
|
-
* Performance
|
|
29
|
-
|
|
30
|
-
* Streamline client side cache shrinking
|
|
31
|
-
|
|
32
6
|
v5.0.0rc2
|
|
33
7
|
---------
|
|
34
8
|
Release Date: 2025-07-10
|
|
@@ -1998,4 +1972,3 @@ v1.0.1
|
|
|
1998
1972
|
|
|
1999
1973
|
|
|
2000
1974
|
|
|
2001
|
-
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: coredis
|
|
3
|
-
Version: 5.0.
|
|
3
|
+
Version: 5.0.0rc2
|
|
4
4
|
Summary: Python async client for Redis key-value store
|
|
5
5
|
Home-page: https://github.com/alisaifee/coredis
|
|
6
6
|
Author: Ali-Akber Saifee
|
|
@@ -14,6 +14,7 @@ Project-URL: Documentation, https://coredis.readthedocs.org
|
|
|
14
14
|
Keywords: Redis,key-value store,asyncio
|
|
15
15
|
Classifier: Development Status :: 5 - Production/Stable
|
|
16
16
|
Classifier: Intended Audience :: Developers
|
|
17
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
17
18
|
Classifier: Operating System :: OS Independent
|
|
18
19
|
Classifier: Programming Language :: Python
|
|
19
20
|
Classifier: Programming Language :: Python :: 3.10
|
|
@@ -10,10 +10,14 @@ from coredis.typing import (
|
|
|
10
10
|
Awaitable,
|
|
11
11
|
Callable,
|
|
12
12
|
ExecutionParameters,
|
|
13
|
+
KeyT,
|
|
14
|
+
Parameters,
|
|
13
15
|
Protocol,
|
|
14
16
|
R,
|
|
15
17
|
RedisCommandP,
|
|
18
|
+
RedisValueT,
|
|
16
19
|
ResponseType,
|
|
20
|
+
StringT,
|
|
17
21
|
TypeVar,
|
|
18
22
|
Unpack,
|
|
19
23
|
ValueT,
|
|
@@ -43,6 +47,25 @@ class AbstractExecutor(Protocol):
|
|
|
43
47
|
) -> CommandRequest[R]: ...
|
|
44
48
|
|
|
45
49
|
|
|
50
|
+
@runtime_checkable
|
|
51
|
+
class SupportsScript(Protocol[T_co]): # noqa
|
|
52
|
+
def evalsha(
|
|
53
|
+
self,
|
|
54
|
+
sha1: StringT,
|
|
55
|
+
keys: Parameters[KeyT] | None = ...,
|
|
56
|
+
args: Parameters[RedisValueT] | None = ...,
|
|
57
|
+
) -> CommandRequest[ResponseType]: ...
|
|
58
|
+
|
|
59
|
+
def evalsha_ro(
|
|
60
|
+
self,
|
|
61
|
+
sha1: StringT,
|
|
62
|
+
keys: Parameters[KeyT] | None = ...,
|
|
63
|
+
args: Parameters[RedisValueT] | None = ...,
|
|
64
|
+
) -> CommandRequest[ResponseType]: ...
|
|
65
|
+
|
|
66
|
+
def script_load(self, script: StringT) -> CommandRequest[T_co]: ...
|
|
67
|
+
|
|
68
|
+
|
|
46
69
|
@runtime_checkable
|
|
47
70
|
class ConnectionP(Protocol):
|
|
48
71
|
decode_responses: bool
|
|
@@ -120,6 +120,10 @@ def b(x: ResponseType, encoding: str | None = None) -> bytes:
|
|
|
120
120
|
return _v.encode(encoding) if encoding else _v.encode()
|
|
121
121
|
|
|
122
122
|
|
|
123
|
+
def defaultvalue(value: U | None, default: T) -> U | T:
|
|
124
|
+
return default if value is None else value
|
|
125
|
+
|
|
126
|
+
|
|
123
127
|
def nativestr(x: ResponseType, encoding: str = "utf-8") -> str:
|
|
124
128
|
if isinstance(x, (str, bytes)):
|
|
125
129
|
return x if isinstance(x, str) else x.decode(encoding, "replace")
|
|
@@ -8,11 +8,11 @@ import json
|
|
|
8
8
|
|
|
9
9
|
version_json = '''
|
|
10
10
|
{
|
|
11
|
-
"date": "2025-07-
|
|
11
|
+
"date": "2025-07-10T16:37:52-0700",
|
|
12
12
|
"dirty": false,
|
|
13
13
|
"error": null,
|
|
14
|
-
"full-revisionid": "
|
|
15
|
-
"version": "5.0.
|
|
14
|
+
"full-revisionid": "500ec3f7c2c644928da3459bf3242872e672728c",
|
|
15
|
+
"version": "5.0.0rc2"
|
|
16
16
|
}
|
|
17
17
|
''' # END VERSION_JSON
|
|
18
18
|
|
|
@@ -7,7 +7,7 @@ from typing import overload
|
|
|
7
7
|
from deprecated.sphinx import versionadded
|
|
8
8
|
|
|
9
9
|
from coredis._json import json
|
|
10
|
-
from coredis._utils import dict_to_flat_list, tuples_to_flat_list
|
|
10
|
+
from coredis._utils import defaultvalue, dict_to_flat_list, tuples_to_flat_list
|
|
11
11
|
from coredis.commands import CommandMixin
|
|
12
12
|
from coredis.commands._utils import (
|
|
13
13
|
normalized_milliseconds,
|
|
@@ -5269,8 +5269,8 @@ class CoreCommands(CommandMixin[AnyStr]):
|
|
|
5269
5269
|
"""
|
|
5270
5270
|
|
|
5271
5271
|
command_arguments: CommandArgList = [
|
|
5272
|
-
start
|
|
5273
|
-
end
|
|
5272
|
+
defaultvalue(start, "-"),
|
|
5273
|
+
defaultvalue(end, "+"),
|
|
5274
5274
|
]
|
|
5275
5275
|
|
|
5276
5276
|
if count is not None:
|
|
@@ -5298,8 +5298,8 @@ class CoreCommands(CommandMixin[AnyStr]):
|
|
|
5298
5298
|
IDs interval, in reverse order (from greater to smaller IDs) compared to XRANGE
|
|
5299
5299
|
"""
|
|
5300
5300
|
command_arguments: CommandArgList = [
|
|
5301
|
-
end
|
|
5302
|
-
start
|
|
5301
|
+
defaultvalue(end, "+"),
|
|
5302
|
+
defaultvalue(start, "-"),
|
|
5303
5303
|
]
|
|
5304
5304
|
|
|
5305
5305
|
if count is not None:
|
|
@@ -8110,37 +8110,6 @@ class CoreCommands(CommandMixin[AnyStr]):
|
|
|
8110
8110
|
filter_ef: int | None = ...,
|
|
8111
8111
|
truth: bool | None = ...,
|
|
8112
8112
|
) -> CommandRequest[dict[AnyStr, float]]: ...
|
|
8113
|
-
@overload
|
|
8114
|
-
def vsim(
|
|
8115
|
-
self,
|
|
8116
|
-
key: KeyT,
|
|
8117
|
-
*,
|
|
8118
|
-
element: StringT | None = ...,
|
|
8119
|
-
values: Parameters[float] | bytes | None = ...,
|
|
8120
|
-
withattribs: Literal[True],
|
|
8121
|
-
count: int | None = ...,
|
|
8122
|
-
epsilon: float | None = ...,
|
|
8123
|
-
ef: int | None = ...,
|
|
8124
|
-
filter: StringT | None = ...,
|
|
8125
|
-
filter_ef: int | None = ...,
|
|
8126
|
-
truth: bool | None = ...,
|
|
8127
|
-
) -> CommandRequest[dict[AnyStr, JsonType]]: ...
|
|
8128
|
-
@overload
|
|
8129
|
-
def vsim(
|
|
8130
|
-
self,
|
|
8131
|
-
key: KeyT,
|
|
8132
|
-
*,
|
|
8133
|
-
element: StringT | None = ...,
|
|
8134
|
-
values: Parameters[float] | bytes | None = ...,
|
|
8135
|
-
withscores: Literal[True],
|
|
8136
|
-
withattribs: Literal[True],
|
|
8137
|
-
count: int | None = ...,
|
|
8138
|
-
epsilon: float | None = ...,
|
|
8139
|
-
ef: int | None = ...,
|
|
8140
|
-
filter: StringT | None = ...,
|
|
8141
|
-
filter_ef: int | None = ...,
|
|
8142
|
-
truth: bool | None = ...,
|
|
8143
|
-
) -> CommandRequest[dict[AnyStr, tuple[float, JsonType]]]: ...
|
|
8144
8113
|
|
|
8145
8114
|
@versionadded(version="5.0.0")
|
|
8146
8115
|
@mutually_exclusive_parameters("values", "element", required=True)
|
|
@@ -8148,7 +8117,6 @@ class CoreCommands(CommandMixin[AnyStr]):
|
|
|
8148
8117
|
CommandName.VSIM,
|
|
8149
8118
|
version_introduced="8.0.0",
|
|
8150
8119
|
group=CommandGroup.VECTOR_SET,
|
|
8151
|
-
arguments={"withattribs": {"version_introduced": "8.1.240"}},
|
|
8152
8120
|
)
|
|
8153
8121
|
def vsim(
|
|
8154
8122
|
self,
|
|
@@ -8157,19 +8125,13 @@ class CoreCommands(CommandMixin[AnyStr]):
|
|
|
8157
8125
|
element: StringT | None = None,
|
|
8158
8126
|
values: Parameters[float] | bytes | None = None,
|
|
8159
8127
|
withscores: bool | None = None,
|
|
8160
|
-
withattribs: bool | None = None,
|
|
8161
8128
|
count: int | None = None,
|
|
8162
8129
|
epsilon: float | None = None,
|
|
8163
8130
|
ef: int | None = None,
|
|
8164
8131
|
filter: StringT | None = None,
|
|
8165
8132
|
filter_ef: int | None = None,
|
|
8166
8133
|
truth: bool | None = None,
|
|
8167
|
-
) -> CommandRequest[
|
|
8168
|
-
tuple[AnyStr, ...]
|
|
8169
|
-
| dict[AnyStr, float]
|
|
8170
|
-
| dict[AnyStr, JsonType]
|
|
8171
|
-
| dict[AnyStr, tuple[float, JsonType]]
|
|
8172
|
-
]:
|
|
8134
|
+
) -> CommandRequest[tuple[AnyStr, ...] | dict[AnyStr, float]]:
|
|
8173
8135
|
"""
|
|
8174
8136
|
Return elements similar to a given vector or element
|
|
8175
8137
|
|
|
@@ -8178,7 +8140,6 @@ class CoreCommands(CommandMixin[AnyStr]):
|
|
|
8178
8140
|
:param values: either a byte representation of a 32-bit floating point (FP32) blob of values
|
|
8179
8141
|
or a sequence of doubles representing the vector to use as the similarity reference.
|
|
8180
8142
|
:param withscores: whether to return similarity scores for each result
|
|
8181
|
-
:param withattribs: whether to include attributes for for each result
|
|
8182
8143
|
:param count: number of results to limit to
|
|
8183
8144
|
:param epsilon: distance threshold; results with distance greater than this are
|
|
8184
8145
|
excluded.
|
|
@@ -8187,8 +8148,7 @@ class CoreCommands(CommandMixin[AnyStr]):
|
|
|
8187
8148
|
:param filter_ef: limits the number of filtering attempts
|
|
8188
8149
|
:param truth: forces an exact linear scan of all elements bypassing the HSNW graph
|
|
8189
8150
|
:return: the matching elements or a mapping of the matching elements to their scores
|
|
8190
|
-
if :paramref:`withscores` is ``True``
|
|
8191
|
-
is ``True``
|
|
8151
|
+
if :paramref:`withscores` is ``True``
|
|
8192
8152
|
"""
|
|
8193
8153
|
command_arguments: CommandArgList = [key]
|
|
8194
8154
|
if values is not None:
|
|
@@ -8202,8 +8162,6 @@ class CoreCommands(CommandMixin[AnyStr]):
|
|
|
8202
8162
|
|
|
8203
8163
|
if withscores:
|
|
8204
8164
|
command_arguments.append(PureToken.WITHSCORES)
|
|
8205
|
-
if withattribs:
|
|
8206
|
-
command_arguments.append(PureToken.WITHATTRIBS)
|
|
8207
8165
|
if count is not None:
|
|
8208
8166
|
command_arguments.extend([PrefixToken.COUNT, count])
|
|
8209
8167
|
if ef is not None:
|
|
@@ -8219,7 +8177,7 @@ class CoreCommands(CommandMixin[AnyStr]):
|
|
|
8219
8177
|
return self.create_request(
|
|
8220
8178
|
CommandName.VSIM,
|
|
8221
8179
|
*command_arguments,
|
|
8222
|
-
callback=VSimCallback[AnyStr](withscores=withscores
|
|
8180
|
+
callback=VSimCallback[AnyStr](withscores=withscores),
|
|
8223
8181
|
)
|
|
8224
8182
|
|
|
8225
8183
|
@versionadded(version="5.0.0")
|
|
@@ -8,7 +8,9 @@ from typing import TYPE_CHECKING, Any, cast
|
|
|
8
8
|
|
|
9
9
|
from deprecated.sphinx import versionadded
|
|
10
10
|
|
|
11
|
+
from coredis._protocols import SupportsScript
|
|
11
12
|
from coredis._utils import b
|
|
13
|
+
from coredis.commands import CommandRequest
|
|
12
14
|
from coredis.exceptions import NoScriptError
|
|
13
15
|
from coredis.retry import ConstantRetryPolicy, retryable
|
|
14
16
|
from coredis.typing import (
|
|
@@ -23,7 +25,6 @@ from coredis.typing import (
|
|
|
23
25
|
RedisValueT,
|
|
24
26
|
ResponseType,
|
|
25
27
|
StringT,
|
|
26
|
-
ValueT,
|
|
27
28
|
add_runtime_checks,
|
|
28
29
|
safe_beartype,
|
|
29
30
|
)
|
|
@@ -52,7 +53,7 @@ class Script(Generic[AnyStr]):
|
|
|
52
53
|
|
|
53
54
|
def __init__(
|
|
54
55
|
self,
|
|
55
|
-
registered_client:
|
|
56
|
+
registered_client: SupportsScript[AnyStr] | None = None,
|
|
56
57
|
script: StringT | None = None,
|
|
57
58
|
readonly: bool = False,
|
|
58
59
|
):
|
|
@@ -65,7 +66,7 @@ class Script(Generic[AnyStr]):
|
|
|
65
66
|
:param readonly: If ``True`` the script will be called with
|
|
66
67
|
:meth:`coredis.Redis.evalsha_ro` instead of :meth:`coredis.Redis.evalsha`
|
|
67
68
|
"""
|
|
68
|
-
self.registered_client:
|
|
69
|
+
self.registered_client: SupportsScript[AnyStr] | None = registered_client
|
|
69
70
|
self.script: StringT
|
|
70
71
|
if not script:
|
|
71
72
|
raise RuntimeError("No script provided")
|
|
@@ -76,10 +77,10 @@ class Script(Generic[AnyStr]):
|
|
|
76
77
|
def __call__(
|
|
77
78
|
self,
|
|
78
79
|
keys: Parameters[KeyT] | None = None,
|
|
79
|
-
args: Parameters[
|
|
80
|
-
client:
|
|
80
|
+
args: Parameters[RedisValueT] | None = None,
|
|
81
|
+
client: SupportsScript[AnyStr] | None = None,
|
|
81
82
|
readonly: bool | None = None,
|
|
82
|
-
) ->
|
|
83
|
+
) -> CommandRequest[ResponseType]:
|
|
83
84
|
"""
|
|
84
85
|
Executes the script registered in :paramref:`Script.script` using
|
|
85
86
|
:meth:`coredis.Redis.evalsha`. Additionally, if the script was not yet
|
|
@@ -112,16 +113,19 @@ class Script(Generic[AnyStr]):
|
|
|
112
113
|
cast(Pipeline[AnyStr], client).scripts.add(self)
|
|
113
114
|
return method(self.sha, keys=keys, args=args)
|
|
114
115
|
else:
|
|
115
|
-
return
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
116
|
+
return cast(
|
|
117
|
+
CommandRequest[ResponseType],
|
|
118
|
+
retryable(
|
|
119
|
+
ConstantRetryPolicy((NoScriptError,), 1, 0),
|
|
120
|
+
failure_hook=lambda _: client.script_load(self.script),
|
|
121
|
+
)(method)(self.sha, keys=keys, args=args),
|
|
122
|
+
)
|
|
119
123
|
|
|
120
124
|
async def execute(
|
|
121
125
|
self,
|
|
122
126
|
keys: Parameters[KeyT] | None = None,
|
|
123
|
-
args: Parameters[
|
|
124
|
-
client:
|
|
127
|
+
args: Parameters[RedisValueT] | None = None,
|
|
128
|
+
client: SupportsScript[AnyStr] | None = None,
|
|
125
129
|
readonly: bool | None = None,
|
|
126
130
|
) -> ResponseType:
|
|
127
131
|
"""
|
|
@@ -89,6 +89,8 @@ def wrap_pipeline_method(
|
|
|
89
89
|
def wrapper(*args: P.args, **kwargs: P.kwargs) -> Awaitable[R]:
|
|
90
90
|
return func(*args, **kwargs)
|
|
91
91
|
|
|
92
|
+
wrapper.__annotations__ = wrapper.__annotations__.copy()
|
|
93
|
+
wrapper.__annotations__["return"] = kls
|
|
92
94
|
wrapper.__doc__ = textwrap.dedent(wrapper.__doc__ or "")
|
|
93
95
|
wrapper.__doc__ = f"""
|
|
94
96
|
.. note:: Pipeline variant of :meth:`coredis.Redis.{func.__name__}` that does not execute
|
|
@@ -163,12 +165,13 @@ class PipelineCommandRequest(CommandRequest[CommandResponseT]):
|
|
|
163
165
|
if hasattr(self, "response"):
|
|
164
166
|
return self.response.__await__()
|
|
165
167
|
elif self.parent:
|
|
168
|
+
parent = self.parent
|
|
166
169
|
|
|
167
170
|
async def _transformed() -> CommandResponseT:
|
|
168
|
-
if (
|
|
169
|
-
return
|
|
171
|
+
if hasattr(parent, "response"):
|
|
172
|
+
return self.callback(await parent.response)
|
|
170
173
|
else:
|
|
171
|
-
return
|
|
174
|
+
return await parent # type: ignore[no-any-return]
|
|
172
175
|
|
|
173
176
|
return _transformed().__await__()
|
|
174
177
|
else:
|
|
@@ -538,8 +541,6 @@ class Pipeline(Client[AnyStr], metaclass=PipelineMeta):
|
|
|
538
541
|
) -> None:
|
|
539
542
|
"""
|
|
540
543
|
Queue a command for execution on the next `execute()` call.
|
|
541
|
-
|
|
542
|
-
:meta private:
|
|
543
544
|
"""
|
|
544
545
|
self.command_stack.append(command)
|
|
545
546
|
|
|
@@ -1,69 +1,36 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
|
-
from coredis._json import json
|
|
4
3
|
from coredis._utils import nativestr
|
|
5
4
|
from coredis.response._callbacks import ResponseCallback
|
|
6
5
|
from coredis.response._utils import flat_pairs_to_dict
|
|
7
6
|
from coredis.response.types import VectorData
|
|
8
|
-
from coredis.typing import AnyStr,
|
|
7
|
+
from coredis.typing import AnyStr, ResponsePrimitive, StringT
|
|
9
8
|
|
|
10
9
|
|
|
11
10
|
class VSimCallback(
|
|
12
11
|
ResponseCallback[
|
|
13
12
|
list[AnyStr],
|
|
14
|
-
list[AnyStr] | dict[AnyStr, float
|
|
15
|
-
tuple[AnyStr, ...]
|
|
16
|
-
| dict[AnyStr, float]
|
|
17
|
-
| dict[AnyStr, JsonType]
|
|
18
|
-
| dict[AnyStr, tuple[float, JsonType]],
|
|
13
|
+
list[AnyStr] | dict[AnyStr, float],
|
|
14
|
+
tuple[AnyStr, ...] | dict[AnyStr, float],
|
|
19
15
|
],
|
|
20
16
|
):
|
|
21
17
|
def transform(
|
|
22
18
|
self,
|
|
23
19
|
response: list[AnyStr],
|
|
24
|
-
) ->
|
|
25
|
-
|
|
26
|
-
| dict[AnyStr, float]
|
|
27
|
-
| dict[AnyStr, JsonType]
|
|
28
|
-
| dict[AnyStr, tuple[float, JsonType]]
|
|
29
|
-
):
|
|
30
|
-
withscores, withattribs = self.options.get("withscores"), self.options.get("withattribs")
|
|
31
|
-
if withscores or withattribs:
|
|
20
|
+
) -> tuple[AnyStr, ...] | dict[AnyStr, float]:
|
|
21
|
+
if self.options.get("withscores"):
|
|
32
22
|
it = iter(response)
|
|
33
|
-
|
|
34
|
-
case True, None | False:
|
|
35
|
-
return dict(list(zip(it, map(float, it))))
|
|
36
|
-
case None | False, True:
|
|
37
|
-
return dict(list(zip(it, map(json.loads, it))))
|
|
38
|
-
case True, True:
|
|
39
|
-
return dict(
|
|
40
|
-
list(zip(it, map(lambda x: (float(x[0]), json.loads(x[1])), zip(it, it))))
|
|
41
|
-
)
|
|
23
|
+
return dict(list(zip(it, map(float, it))))
|
|
42
24
|
else:
|
|
43
|
-
return
|
|
25
|
+
return tuple(response)
|
|
44
26
|
|
|
45
27
|
def transform_3(
|
|
46
28
|
self,
|
|
47
|
-
response: list[AnyStr]
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
| dict[AnyStr, list[float | AnyStr]],
|
|
51
|
-
) -> (
|
|
52
|
-
tuple[AnyStr, ...]
|
|
53
|
-
| dict[AnyStr, float]
|
|
54
|
-
| dict[AnyStr, JsonType]
|
|
55
|
-
| dict[AnyStr, tuple[float, JsonType]]
|
|
56
|
-
):
|
|
57
|
-
withscores, withattribs = self.options.get("withscores"), self.options.get("withattribs")
|
|
58
|
-
if withscores or withattribs:
|
|
29
|
+
response: list[AnyStr] | dict[AnyStr, float],
|
|
30
|
+
) -> tuple[AnyStr, ...] | dict[AnyStr, float]:
|
|
31
|
+
if self.options.get("withscores"):
|
|
59
32
|
assert isinstance(response, dict)
|
|
60
|
-
|
|
61
|
-
case None | False, True:
|
|
62
|
-
return {k: json.loads(v) for k, v in response.items()}
|
|
63
|
-
case True, True:
|
|
64
|
-
return {k: (v[0], json.loads(v[1])) for k, v in response.items()}
|
|
65
|
-
case _:
|
|
66
|
-
return response
|
|
33
|
+
return response
|
|
67
34
|
else:
|
|
68
35
|
return tuple(response)
|
|
69
36
|
|
|
@@ -24,7 +24,6 @@ from coredis.typing import (
|
|
|
24
24
|
Iterable,
|
|
25
25
|
Literal,
|
|
26
26
|
StringT,
|
|
27
|
-
TypeAdapter,
|
|
28
27
|
)
|
|
29
28
|
|
|
30
29
|
|
|
@@ -196,7 +195,6 @@ class Sentinel(Generic[AnyStr]):
|
|
|
196
195
|
sentinel_kwargs: dict[str, Any] | None = ...,
|
|
197
196
|
decode_responses: Literal[False] = ...,
|
|
198
197
|
cache: AbstractCache | None = None,
|
|
199
|
-
type_adapter: TypeAdapter | None = ...,
|
|
200
198
|
**connection_kwargs: Any,
|
|
201
199
|
) -> None: ...
|
|
202
200
|
|
|
@@ -208,7 +206,6 @@ class Sentinel(Generic[AnyStr]):
|
|
|
208
206
|
sentinel_kwargs: dict[str, Any] | None = ...,
|
|
209
207
|
decode_responses: Literal[True] = ...,
|
|
210
208
|
cache: AbstractCache | None = None,
|
|
211
|
-
type_adapter: TypeAdapter | None = None,
|
|
212
209
|
**connection_kwargs: Any,
|
|
213
210
|
) -> None: ...
|
|
214
211
|
|
|
@@ -219,7 +216,6 @@ class Sentinel(Generic[AnyStr]):
|
|
|
219
216
|
sentinel_kwargs: dict[str, Any] | None = None,
|
|
220
217
|
decode_responses: bool = False,
|
|
221
218
|
cache: AbstractCache | None = None,
|
|
222
|
-
type_adapter: TypeAdapter | None = None,
|
|
223
219
|
**connection_kwargs: Any,
|
|
224
220
|
) -> None:
|
|
225
221
|
"""
|
|
@@ -240,9 +236,6 @@ class Sentinel(Generic[AnyStr]):
|
|
|
240
236
|
and ``protocol_version`` options specified in :paramref:`connection_kwargs` will be used.
|
|
241
237
|
:param cache: If provided the cache will be shared between both primaries and replicas
|
|
242
238
|
returned by this sentinel.
|
|
243
|
-
:param type_adapter: The adapter to use for serializing / deserializing customs types
|
|
244
|
-
when interacting with redis commands. If provided this adapter will be used for both
|
|
245
|
-
primaries and replicas returned by this sentinel.
|
|
246
239
|
:param connection_kwargs: are keyword arguments that will be used when
|
|
247
240
|
establishing a connection to a Redis server (i.e. are passed on to the
|
|
248
241
|
constructor of :class:`Redis` for all primary and replicas).
|
|
@@ -267,7 +260,6 @@ class Sentinel(Generic[AnyStr]):
|
|
|
267
260
|
self.min_other_sentinels = min_other_sentinels
|
|
268
261
|
self.connection_kwargs = connection_kwargs
|
|
269
262
|
self.__cache = cache
|
|
270
|
-
self.__type_adapter = type_adapter
|
|
271
263
|
self.connection_kwargs["decode_responses"] = self.sentinel_kwargs["decode_responses"] = (
|
|
272
264
|
decode_responses
|
|
273
265
|
)
|
|
@@ -414,7 +406,6 @@ class Sentinel(Generic[AnyStr]):
|
|
|
414
406
|
**connection_kwargs,
|
|
415
407
|
),
|
|
416
408
|
cache=self.__cache,
|
|
417
|
-
type_adapter=self.__type_adapter,
|
|
418
409
|
)
|
|
419
410
|
|
|
420
411
|
@overload
|
|
@@ -470,5 +461,4 @@ class Sentinel(Generic[AnyStr]):
|
|
|
470
461
|
**connection_kwargs,
|
|
471
462
|
),
|
|
472
463
|
cache=self.__cache,
|
|
473
|
-
type_adapter=self.__type_adapter,
|
|
474
464
|
)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: coredis
|
|
3
|
-
Version: 5.0.
|
|
3
|
+
Version: 5.0.0rc2
|
|
4
4
|
Summary: Python async client for Redis key-value store
|
|
5
5
|
Home-page: https://github.com/alisaifee/coredis
|
|
6
6
|
Author: Ali-Akber Saifee
|
|
@@ -14,6 +14,7 @@ Project-URL: Documentation, https://coredis.readthedocs.org
|
|
|
14
14
|
Keywords: Redis,key-value store,asyncio
|
|
15
15
|
Classifier: Development Status :: 5 - Production/Stable
|
|
16
16
|
Classifier: Intended Audience :: Developers
|
|
17
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
17
18
|
Classifier: Operating System :: OS Independent
|
|
18
19
|
Classifier: Programming Language :: Python
|
|
19
20
|
Classifier: Programming Language :: Python :: 3.10
|
|
@@ -147,6 +147,7 @@ setup(
|
|
|
147
147
|
classifiers=[
|
|
148
148
|
"Development Status :: 5 - Production/Stable",
|
|
149
149
|
"Intended Audience :: Developers",
|
|
150
|
+
"License :: OSI Approved :: MIT License",
|
|
150
151
|
"Operating System :: OS Independent",
|
|
151
152
|
"Programming Language :: Python",
|
|
152
153
|
"Programming Language :: Python :: 3.10",
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|