redis 5.3.0b4__py3-none-any.whl → 6.0.0b1__py3-none-any.whl

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.
Files changed (42) hide show
  1. redis/__init__.py +2 -11
  2. redis/_parsers/base.py +14 -2
  3. redis/asyncio/client.py +21 -13
  4. redis/asyncio/cluster.py +79 -56
  5. redis/asyncio/connection.py +40 -11
  6. redis/asyncio/lock.py +26 -5
  7. redis/asyncio/sentinel.py +9 -1
  8. redis/asyncio/utils.py +1 -1
  9. redis/auth/token.py +6 -2
  10. redis/backoff.py +15 -0
  11. redis/client.py +80 -59
  12. redis/cluster.py +114 -52
  13. redis/commands/cluster.py +1 -11
  14. redis/commands/core.py +218 -206
  15. redis/commands/helpers.py +0 -70
  16. redis/commands/redismodules.py +0 -20
  17. redis/commands/search/aggregation.py +3 -1
  18. redis/commands/search/commands.py +41 -14
  19. redis/commands/search/dialect.py +3 -0
  20. redis/commands/search/profile_information.py +14 -0
  21. redis/commands/search/query.py +5 -1
  22. redis/connection.py +48 -23
  23. redis/exceptions.py +4 -1
  24. redis/lock.py +24 -4
  25. redis/ocsp.py +2 -1
  26. redis/sentinel.py +1 -1
  27. redis/typing.py +1 -1
  28. redis/utils.py +107 -1
  29. {redis-5.3.0b4.dist-info → redis-6.0.0b1.dist-info}/METADATA +57 -23
  30. {redis-5.3.0b4.dist-info → redis-6.0.0b1.dist-info}/RECORD +33 -40
  31. {redis-5.3.0b4.dist-info → redis-6.0.0b1.dist-info}/WHEEL +1 -2
  32. redis/commands/graph/__init__.py +0 -263
  33. redis/commands/graph/commands.py +0 -313
  34. redis/commands/graph/edge.py +0 -91
  35. redis/commands/graph/exceptions.py +0 -3
  36. redis/commands/graph/execution_plan.py +0 -211
  37. redis/commands/graph/node.py +0 -88
  38. redis/commands/graph/path.py +0 -78
  39. redis/commands/graph/query_result.py +0 -588
  40. redis-5.3.0b4.dist-info/top_level.txt +0 -1
  41. /redis/commands/search/{indexDefinition.py → index_definition.py} +0 -0
  42. {redis-5.3.0b4.dist-info → redis-6.0.0b1.dist-info/licenses}/LICENSE +0 -0
redis/utils.py CHANGED
@@ -1,7 +1,11 @@
1
+ import datetime
1
2
  import logging
2
3
  from contextlib import contextmanager
3
4
  from functools import wraps
4
- from typing import Any, Dict, Mapping, Union
5
+ from typing import Any, Dict, List, Mapping, Optional, Union
6
+
7
+ from redis.exceptions import DataError
8
+ from redis.typing import AbsExpiryT, EncodableT, ExpiryT
5
9
 
6
10
  try:
7
11
  import hiredis # noqa
@@ -122,6 +126,71 @@ def deprecated_function(reason="", version="", name=None):
122
126
  return decorator
123
127
 
124
128
 
129
+ def warn_deprecated_arg_usage(
130
+ arg_name: Union[list, str],
131
+ function_name: str,
132
+ reason: str = "",
133
+ version: str = "",
134
+ stacklevel: int = 2,
135
+ ):
136
+ import warnings
137
+
138
+ msg = (
139
+ f"Call to '{function_name}' function with deprecated"
140
+ f" usage of input argument/s '{arg_name}'."
141
+ )
142
+ if reason:
143
+ msg += f" ({reason})"
144
+ if version:
145
+ msg += f" -- Deprecated since version {version}."
146
+ warnings.warn(msg, category=DeprecationWarning, stacklevel=stacklevel)
147
+
148
+
149
+ def deprecated_args(
150
+ args_to_warn: list = ["*"],
151
+ allowed_args: list = [],
152
+ reason: str = "",
153
+ version: str = "",
154
+ ):
155
+ """
156
+ Decorator to mark specified args of a function as deprecated.
157
+ If '*' is in args_to_warn, all arguments will be marked as deprecated.
158
+ """
159
+
160
+ def decorator(func):
161
+ @wraps(func)
162
+ def wrapper(*args, **kwargs):
163
+ # Get function argument names
164
+ arg_names = func.__code__.co_varnames[: func.__code__.co_argcount]
165
+
166
+ provided_args = dict(zip(arg_names, args))
167
+ provided_args.update(kwargs)
168
+
169
+ provided_args.pop("self", None)
170
+ for allowed_arg in allowed_args:
171
+ provided_args.pop(allowed_arg, None)
172
+
173
+ for arg in args_to_warn:
174
+ if arg == "*" and len(provided_args) > 0:
175
+ warn_deprecated_arg_usage(
176
+ list(provided_args.keys()),
177
+ func.__name__,
178
+ reason,
179
+ version,
180
+ stacklevel=3,
181
+ )
182
+ elif arg in provided_args:
183
+ warn_deprecated_arg_usage(
184
+ arg, func.__name__, reason, version, stacklevel=3
185
+ )
186
+
187
+ return func(*args, **kwargs)
188
+
189
+ return wrapper
190
+
191
+ return decorator
192
+
193
+
125
194
  def _set_info_logger():
126
195
  """
127
196
  Set up a logger that log info logs to stdout.
@@ -192,3 +261,40 @@ def ensure_string(key):
192
261
  return key
193
262
  else:
194
263
  raise TypeError("Key must be either a string or bytes")
264
+
265
+
266
+ def extract_expire_flags(
267
+ ex: Optional[ExpiryT] = None,
268
+ px: Optional[ExpiryT] = None,
269
+ exat: Optional[AbsExpiryT] = None,
270
+ pxat: Optional[AbsExpiryT] = None,
271
+ ) -> List[EncodableT]:
272
+ exp_options: list[EncodableT] = []
273
+ if ex is not None:
274
+ exp_options.append("EX")
275
+ if isinstance(ex, datetime.timedelta):
276
+ exp_options.append(int(ex.total_seconds()))
277
+ elif isinstance(ex, int):
278
+ exp_options.append(ex)
279
+ elif isinstance(ex, str) and ex.isdigit():
280
+ exp_options.append(int(ex))
281
+ else:
282
+ raise DataError("ex must be datetime.timedelta or int")
283
+ elif px is not None:
284
+ exp_options.append("PX")
285
+ if isinstance(px, datetime.timedelta):
286
+ exp_options.append(int(px.total_seconds() * 1000))
287
+ elif isinstance(px, int):
288
+ exp_options.append(px)
289
+ else:
290
+ raise DataError("px must be datetime.timedelta or int")
291
+ elif exat is not None:
292
+ if isinstance(exat, datetime.datetime):
293
+ exat = int(exat.timestamp())
294
+ exp_options.extend(["EXAT", exat])
295
+ elif pxat is not None:
296
+ if isinstance(pxat, datetime.datetime):
297
+ pxat = int(pxat.timestamp() * 1000)
298
+ exp_options.extend(["PXAT", pxat])
299
+
300
+ return exp_options
@@ -1,17 +1,16 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: redis
3
- Version: 5.3.0b4
3
+ Version: 6.0.0b1
4
4
  Summary: Python client for Redis database and key-value store
5
- Home-page: https://github.com/redis/redis-py
6
- Author: Redis Inc.
7
- Author-email: oss@redis.com
8
- License: MIT
9
- Project-URL: Documentation, https://redis.readthedocs.io/en/latest/
10
5
  Project-URL: Changes, https://github.com/redis/redis-py/releases
11
6
  Project-URL: Code, https://github.com/redis/redis-py
7
+ Project-URL: Documentation, https://redis.readthedocs.io/en/latest/
8
+ Project-URL: Homepage, https://github.com/redis/redis-py
12
9
  Project-URL: Issue tracker, https://github.com/redis/redis-py/issues
13
- Keywords: Redis,key-value store,database
14
- Platform: UNKNOWN
10
+ Author-email: "Redis Inc." <oss@redis.com>
11
+ License-Expression: MIT
12
+ License-File: LICENSE
13
+ Keywords: Redis,database,key-value-store
15
14
  Classifier: Development Status :: 5 - Production/Stable
16
15
  Classifier: Environment :: Console
17
16
  Classifier: Intended Audience :: Developers
@@ -25,19 +24,20 @@ Classifier: Programming Language :: Python :: 3.9
25
24
  Classifier: Programming Language :: Python :: 3.10
26
25
  Classifier: Programming Language :: Python :: 3.11
27
26
  Classifier: Programming Language :: Python :: 3.12
27
+ Classifier: Programming Language :: Python :: 3.13
28
28
  Classifier: Programming Language :: Python :: Implementation :: CPython
29
29
  Classifier: Programming Language :: Python :: Implementation :: PyPy
30
30
  Requires-Python: >=3.8
31
- Description-Content-Type: text/markdown
32
- License-File: LICENSE
33
- Requires-Dist: PyJWT~=2.9.0
34
- Requires-Dist: async-timeout>=4.0.3; python_full_version < "3.11.3"
31
+ Requires-Dist: async-timeout>=4.0.3; python_full_version < '3.11.3'
35
32
  Provides-Extra: hiredis
36
- Requires-Dist: hiredis>=3.0.0; extra == "hiredis"
33
+ Requires-Dist: hiredis>=3.0.0; extra == 'hiredis'
34
+ Provides-Extra: jwt
35
+ Requires-Dist: pyjwt~=2.9.0; extra == 'jwt'
37
36
  Provides-Extra: ocsp
38
- Requires-Dist: cryptography>=36.0.1; extra == "ocsp"
39
- Requires-Dist: pyopenssl==23.2.1; extra == "ocsp"
40
- Requires-Dist: requests>=2.31.0; extra == "ocsp"
37
+ Requires-Dist: cryptography>=36.0.1; extra == 'ocsp'
38
+ Requires-Dist: pyopenssl>=20.0.1; extra == 'ocsp'
39
+ Requires-Dist: requests>=2.31.0; extra == 'ocsp'
40
+ Description-Content-Type: text/markdown
41
41
 
42
42
  # redis-py
43
43
 
@@ -54,13 +54,13 @@ The Python interface to the Redis key-value store.
54
54
 
55
55
  ---------------------------------------------
56
56
 
57
- **Note: ** redis-py 5.0 will be the last version of redis-py to support Python 3.7, as it has reached [end of life](https://devguide.python.org/versions/). redis-py 5.1 will support Python 3.8+.
57
+ **Note:** redis-py 5.0 will be the last version of redis-py to support Python 3.7, as it has reached [end of life](https://devguide.python.org/versions/). redis-py 5.1 will support Python 3.8+.
58
58
 
59
59
  ---------------------------------------------
60
60
 
61
61
  ## How do I Redis?
62
62
 
63
- [Learn for free at Redis University](https://redis.io/university/)
63
+ [Learn for free at Redis University](https://redis.io/learn/university)
64
64
 
65
65
  [Try the Redis Cloud](https://redis.io/try-free/)
66
66
 
@@ -95,7 +95,7 @@ Looking for a high-level library to handle object mapping? See [redis-om-python]
95
95
 
96
96
  ## Supported Redis Versions
97
97
 
98
- The most recent version of this library supports redis version [5.0](https://github.com/redis/redis/blob/5.0/00-RELEASENOTES), [6.0](https://github.com/redis/redis/blob/6.0/00-RELEASENOTES), [6.2](https://github.com/redis/redis/blob/6.2/00-RELEASENOTES), [7.0](https://github.com/redis/redis/blob/7.0/00-RELEASENOTES), [7.2](https://github.com/redis/redis/blob/7.2/00-RELEASENOTES) and [7.4](https://github.com/redis/redis/blob/7.4/00-RELEASENOTES).
98
+ The most recent version of this library supports redis version [7.2](https://github.com/redis/redis/blob/7.2/00-RELEASENOTES), [7.4](https://github.com/redis/redis/blob/7.4/00-RELEASENOTES) and [8.0](https://github.com/redis/redis/blob/8.0/00-RELEASENOTES).
99
99
 
100
100
  The table below highlights version compatibility of the most-recent library versions and redis versions.
101
101
 
@@ -103,7 +103,8 @@ The table below highlights version compatibility of the most-recent library vers
103
103
  |-----------------|-------------------|
104
104
  | 3.5.3 | <= 6.2 Family of releases |
105
105
  | >= 4.5.0 | Version 5.0 to 7.0 |
106
- | >= 5.0.0 | Version 5.0 to current |
106
+ | >= 5.0.0 | Version 5.0 to 7.4 |
107
+ | >= 6.0.0 | Version 7.2 to current |
107
108
 
108
109
 
109
110
  ## Usage
@@ -193,8 +194,42 @@ The following example shows how to utilize [Redis Pub/Sub](https://redis.io/docs
193
194
  {'pattern': None, 'type': 'subscribe', 'channel': b'my-second-channel', 'data': 1}
194
195
  ```
195
196
 
197
+ ### Redis’ search and query capabilities default dialect
198
+
199
+ Release 6.0.0 introduces a client-side default dialect for Redis’ search and query capabilities.
200
+ By default, the client now overrides the server-side dialect with version 2, automatically appending *DIALECT 2* to commands like *FT.AGGREGATE* and *FT.SEARCH*.
196
201
 
197
- --------------------------
202
+ **Important**: Be aware that the query dialect may impact the results returned. If needed, you can revert to a different dialect version by configuring the client accordingly.
203
+
204
+ ``` python
205
+ >>> from redis.commands.search.field import TextField
206
+ >>> from redis.commands.search.query import Query
207
+ >>> from redis.commands.search.index_definition import IndexDefinition
208
+ >>> import redis
209
+
210
+ >>> r = redis.Redis(host='localhost', port=6379, db=0)
211
+ >>> r.ft().create_index(
212
+ >>> (TextField("name"), TextField("lastname")),
213
+ >>> definition=IndexDefinition(prefix=["test:"]),
214
+ >>> )
215
+
216
+ >>> r.hset("test:1", "name", "James")
217
+ >>> r.hset("test:1", "lastname", "Brown")
218
+
219
+ >>> # Query with default DIALECT 2
220
+ >>> query = "@name: James Brown"
221
+ >>> q = Query(query)
222
+ >>> res = r.ft().search(q)
223
+
224
+ >>> # Query with explicit DIALECT 1
225
+ >>> query = "@name: James Brown"
226
+ >>> q = Query(query).dialect(1)
227
+ >>> res = r.ft().search(q)
228
+ ```
229
+
230
+ You can find further details in the [query dialect documentation](https://redis.io/docs/latest/develop/interact/search-and-query/advanced-concepts/dialects/).
231
+
232
+ ---------------------------------------------
198
233
 
199
234
  ### Author
200
235
 
@@ -211,4 +246,3 @@ Special thanks to:
211
246
  - Paul Hubbard for initial packaging support.
212
247
 
213
248
  [![Redis](./docs/_static/logo-redis.svg)](https://redis.io)
214
-
@@ -1,22 +1,22 @@
1
- redis/__init__.py,sha256=WlARnwwst8oaEyjXV5XTcmSGyEKVCn3S9N1MrHyJ8U8,2015
2
- redis/backoff.py,sha256=N2CZXkB3cdoHeMZ01r0zVry0bRKe8mk0ybi8hE7PvzU,3177
1
+ redis/__init__.py,sha256=6Q6GUD5kP-_gx4CNPPxvNEXkk9JopqQmfzDW3S4hpyA,1824
2
+ redis/backoff.py,sha256=d22h74LEatJiFd_5o8HvFW3biFBotYOFZHddHt45ydc,3663
3
3
  redis/cache.py,sha256=68rJDNogvNwgdgBel6zSX9QziL11qsKIMhmvQvHvznM,9549
4
- redis/client.py,sha256=MMDn5Qh6rcBx2sDFU4O_Jid5TdzhA3-91_sxzmOBWAM,61055
5
- redis/cluster.py,sha256=4UBn9HoGjKGUZ-ILROSVw-4I3Kg_9YW8r0X4COKwPsI,95882
6
- redis/connection.py,sha256=UXrGt2T_1ebCGnpTmIzafZRLiZyqMJi4LOsRFkaFVHU,64750
4
+ redis/client.py,sha256=sFmv_c0vWpZiepzTPSbpao7aO4A-Wu0bX9bq7lAKiXA,62201
5
+ redis/cluster.py,sha256=m7ucCyLYd7J3ke5vxfCy60KCogrE2D_QTVBnwFwuga8,98748
6
+ redis/connection.py,sha256=lv9eC3jXSBTUwCqrrFbcQtiyz8rj3c9V4lmAPpc5Zhk,65508
7
7
  redis/crc.py,sha256=Z3kXFtkY2LdgefnQMud1xr4vG5UYvA9LCMqNMX1ywu4,729
8
8
  redis/credentials.py,sha256=GOnO3-LSW34efHaIrUbS742Mw8l70mRzF6UrKiKZsMY,1828
9
9
  redis/event.py,sha256=urOK241IdgmCQ3fq7GqXRstZ2vcXRV14bBBMdN3latk,12129
10
- redis/exceptions.py,sha256=OmOGoS9EPInuTZPJT0BuDeIYuYrtRGEUT_Pu6NtEQNI,5211
11
- redis/lock.py,sha256=3JOC3AmYJ10zbq0blOtV4uNwuEhw4K7xuJ6nM-qv5Ig,11976
12
- redis/ocsp.py,sha256=4b1s43x-DJ859zRKtwGTIbNys_dyGv5YyOdWnOvigyM,11451
10
+ redis/exceptions.py,sha256=wWrzT28g_P7PMISyP2zUsYd4oFBUycSD1L5ln2_pD7o,5216
11
+ redis/lock.py,sha256=GrvPSxaOqKo7iAL2oi5ZUEPsOkxAXHVE_Tp1ejgO2fY,12760
12
+ redis/ocsp.py,sha256=teYSmKnCtk6B3jJLdNYbZN4OE0mxgspt2zUPbkIQzio,11452
13
13
  redis/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
14
14
  redis/retry.py,sha256=JiIDxeD890vgi_me8pwypO1LixwhU0Fv3A5NEay8SAY,2206
15
- redis/sentinel.py,sha256=ya1aPeAvUcY9qXMSpV_wA3081vUqkIqcyXG9SqAvU88,14661
16
- redis/typing.py,sha256=skQl2VuyL7fPpg2BRDlGYMmwDQ2BLwwxxR8u_V1Kbm4,2138
17
- redis/utils.py,sha256=oTonIc6DbbB-ZT-mL14ChhcFk2y4qnK3UNORMKPj2oI,4787
15
+ redis/sentinel.py,sha256=mDIC_TKbkgRBP0JrLyBs0NkVi6-aWkBIMuqqMWgKFbk,14661
16
+ redis/typing.py,sha256=k7F_3Vtsexeb7mUl6txlwrY1veGDLEhtcHe9FwIJOOo,2149
17
+ redis/utils.py,sha256=i7fltyT2JDVk6zqBZFeYlOcl3tXzJNq8kcDZZ8aXesE,8098
18
18
  redis/_parsers/__init__.py,sha256=qkfgV2X9iyvQAvbLdSelwgz0dCk9SGAosCvuZC9-qDc,550
19
- redis/_parsers/base.py,sha256=0j3qIhLjQZOzYGc4n1IesNegckomVhvDsEZD6-yb3Ns,7475
19
+ redis/_parsers/base.py,sha256=WtCbM2CaOgHk7uxwWXA2KXDlZqfYA1EJrVX_NvdOZNk,7801
20
20
  redis/_parsers/commands.py,sha256=pmR4hl4u93UvCmeDgePHFc6pWDr4slrKEvCsdMmtj_M,11052
21
21
  redis/_parsers/encoders.py,sha256=X0jvTp-E4TZUlZxV5LJJ88TuVrF1vly5tuC0xjxGaSc,1734
22
22
  redis/_parsers/helpers.py,sha256=X5wkGDtuzseeCz23_t3FJpzy1ltIvh7zO1uD3cypiOs,29184
@@ -25,35 +25,27 @@ redis/_parsers/resp2.py,sha256=f22kH-_ZP2iNtOn6xOe65MSy_fJpu8OEn1u_hgeeojI,4813
25
25
  redis/_parsers/resp3.py,sha256=jHtL1LYJegJ_LiNTsjzIvS-kZyNR58jZ_YV4cRfwuN0,11127
26
26
  redis/_parsers/socket.py,sha256=CKD8QW_wFSNlIZzxlbNduaGpiv0I8wBcsGuAIojDfJg,5403
27
27
  redis/asyncio/__init__.py,sha256=uoDD8XYVi0Kj6mcufYwLDUTQXmBRx7a0bhKF9stZr7I,1489
28
- redis/asyncio/client.py,sha256=xxifh7JrWJkSPpbem1qVXV6sCvAQRlq4VCYrkj84yvQ,61176
29
- redis/asyncio/cluster.py,sha256=c3dhOQjMUdXQO0WJCOn6-DTPxk-mbcgw52OpiSDrfG8,65243
30
- redis/asyncio/connection.py,sha256=w4yYr2Pzx_8Q7uJbeEyqZrjrqBpXaEZFYHZC5Zuv5HA,47203
31
- redis/asyncio/lock.py,sha256=lLasXEO2E1CskhX5ZZoaSGpmwZP1Q782R3HAUNG3wD4,11967
28
+ redis/asyncio/client.py,sha256=-U9sPfD2TD5jaW_fKOlcVzPKzYLshOnocRrFv74dRw8,61525
29
+ redis/asyncio/cluster.py,sha256=Kb6xptqeiSpal6PH3KItJpfyFLjrZJ0Y3BoClDQ4kCc,66868
30
+ redis/asyncio/connection.py,sha256=UI6CQX1TQz8yW5yqa-iv96tHn7fkuOOs13sdLglsr3Y,48061
31
+ redis/asyncio/lock.py,sha256=GxgV6EsyKpMjh74KtaOPxh4fNPuwApz6Th46qhvrAws,12801
32
32
  redis/asyncio/retry.py,sha256=SnPPOlo5gcyIFtkC4DY7HFvmDgUaILsJ3DeHioogdB8,2219
33
- redis/asyncio/sentinel.py,sha256=QBpsrdlhZlFqENy_rK1IuasSicox55_xSvP_IywbhbQ,14293
34
- redis/asyncio/utils.py,sha256=Yxc5YQumhLjtDDwCS4mgxI6yy2Z21AzLlFxVbxCohic,704
33
+ redis/asyncio/sentinel.py,sha256=HS5UbVlvrGuOcvQoFBHDXvf2YkYjUnKEhkxS_RG-oRk,14540
34
+ redis/asyncio/utils.py,sha256=31xFzXczDgSRyf6hSjiwue1eDQ_XlP_OJdp5dKxW_aE,718
35
35
  redis/auth/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
36
36
  redis/auth/err.py,sha256=WYkbuDIzwp1S-eAvsya6QMlO6g9QIXbzMITOsTWX0xk,694
37
37
  redis/auth/idp.py,sha256=IMDIIb9q72vbIwtFN8vPdaAKZVTdh0HuC5uj5ufqmw4,631
38
- redis/auth/token.py,sha256=DslJx_wN8yPcrmcF-Ui8E5emcamP6OUwi9PTGSvsXQw,3125
38
+ redis/auth/token.py,sha256=qYwAgxFW3S93QDUqp1BTsj7Pj9ZohnixGeOX0s7AsjY,3317
39
39
  redis/auth/token_manager.py,sha256=ShBsYXiBZBJBOMB_Y-pXfLwEOAmc9s1okaCECinNZ7g,12018
40
40
  redis/commands/__init__.py,sha256=cTUH-MGvaLYS0WuoytyqtN1wniw2A1KbkUXcpvOSY3I,576
41
- redis/commands/cluster.py,sha256=BBHSyXfl3OETIJs4JC5DrcfzqgF2Kt4WMEcd0WMILOU,31598
42
- redis/commands/core.py,sha256=YlCzD44YJnFzdEKIFDBloPh1ivgHKcFMZsxPzamE9JM,238528
43
- redis/commands/helpers.py,sha256=Bpl9cmtPRPoQ1zkjYsulHs5bEUahcPD0gTIOee0fkJ0,4870
44
- redis/commands/redismodules.py,sha256=7TfVzLj319mhsA6WEybsOdIPk4pC-1hScJg3H5hv3T4,2454
41
+ redis/commands/cluster.py,sha256=vdWdpl4mP51oqfYBZHg5CUXt6jPaNp7aCLHyTieDrt8,31248
42
+ redis/commands/core.py,sha256=Ca_OhsXzLov3NTaSjIJvRGxzYmePKbdRxowrEbdh91w,238477
43
+ redis/commands/helpers.py,sha256=f1BDIVgfjyE8xTyTjcVH_vffaNTSd6r1ScN_CcJFbmk,2950
44
+ redis/commands/redismodules.py,sha256=y9gxuqY7PmUjpeKLzjQFcN_gZ2IVs36jxq7sSnvG9Nc,1966
45
45
  redis/commands/sentinel.py,sha256=hRcIQ9x9nEkdcCsJzo6Ves6vk-3tsfQqfJTT_v3oLY0,4110
46
46
  redis/commands/bf/__init__.py,sha256=qk4DA9KsMiP4WYqYeP1T5ScBwctsVtlLyMhrYIyq1Zc,8019
47
47
  redis/commands/bf/commands.py,sha256=xeKt8E7G8HB-l922J0DLg07CEIZTVNGx_2Lfyw1gIck,21283
48
48
  redis/commands/bf/info.py,sha256=_OB2v_hAPI9mdVNiBx8jUtH2MhMoct9ZRm-e8In6wQo,3355
49
- redis/commands/graph/__init__.py,sha256=obrFOuwUpNgJA_3NsyRxdqXYzLw4oQRkBxBoMCPAtOw,7235
50
- redis/commands/graph/commands.py,sha256=DMLwSQRUiCTv_hipwm7v5Uq79Sgau-Ao7I6OyIb45co,10374
51
- redis/commands/graph/edge.py,sha256=_TljVB4a1pPS9pb8_Cvw8rclbBOOI__-fY9fybU4djQ,2460
52
- redis/commands/graph/exceptions.py,sha256=kRDBsYLgwIaM4vqioO_Bp_ugWvjfqCH7DIv4Gpc9HCM,107
53
- redis/commands/graph/execution_plan.py,sha256=Pxr8_zhPWT_EdZSgGrbiWw8wFL6q5JF7O-Z6Xzm55iw,6742
54
- redis/commands/graph/node.py,sha256=Pasfsl5dF6WqT9KCNFAKKwGubyK_2ORCoAQE4VtnXkQ,2400
55
- redis/commands/graph/path.py,sha256=m6Gz4DYfMIQ8VReDLHlnQw_KI2rVdepWYk_AU0_x_GM,2080
56
- redis/commands/graph/query_result.py,sha256=ALDXsFNJbnZ8zivX2Xd2_-pP8ka0pYym2HQ-MRTePIQ,17521
57
49
  redis/commands/json/__init__.py,sha256=llpDQz2kBNnJyfQfuh0-2oY-knMb6gAS0ADtPmaTKsM,4854
58
50
  redis/commands/json/_util.py,sha256=b_VQTh10FyLl8BtREfJfDagOJCyd6wTQQs8g63pi5GI,116
59
51
  redis/commands/json/commands.py,sha256=8CRierNqK_VfFoaa9s0rr28uZmqs7nQaAuz4qo0UYZY,15747
@@ -61,12 +53,14 @@ redis/commands/json/decoders.py,sha256=a_IoMV_wgeJyUifD4P6HTcM9s6FhricwmzQcZRmc-
61
53
  redis/commands/json/path.py,sha256=0zaO6_q_FVMk1Bkhkb7Wcr8AF2Tfr69VhkKy1IBVhpA,393
62
54
  redis/commands/search/__init__.py,sha256=happQFVF0j7P87p7LQsUK5AK0kuem9cA-xvVRdQWpos,5744
63
55
  redis/commands/search/_util.py,sha256=9Mp72OO5Ib5UbfN7uXb-iB7hQCm1jQLV90ms2P9XSGU,219
64
- redis/commands/search/aggregation.py,sha256=Ed9iezAj504gGQnqcmKrG0X_9Y9Jd1ddg2CRvDWcJ4s,11512
65
- redis/commands/search/commands.py,sha256=3zrkg9FXuscD6IuBdd7zu6B1Q-qED2s6pmbYBep0pyA,37429
56
+ redis/commands/search/aggregation.py,sha256=CcZSZyquLWLrcSblwgt-bSyMvm-TQS9B7N8QI_ahCBU,11582
57
+ redis/commands/search/commands.py,sha256=U7NZY_s8LDMBRVO9Es2-9P1loIZJ7og4qx3TUgnDOiw,38285
58
+ redis/commands/search/dialect.py,sha256=-7M6kkr33x0FkMtKmUsbeRAE6qxLUbqdJCqIo0UKIXo,105
66
59
  redis/commands/search/document.py,sha256=g2R-PRgq-jN33_GLXzavvse4cpIHBMfjPfPK7tnE9Gc,413
67
60
  redis/commands/search/field.py,sha256=ZWHYTtrLi-zZojohqXoidfllxP0SiadBW6hnGkBw7mM,5891
68
- redis/commands/search/indexDefinition.py,sha256=VL2CMzjxN0HEIaTn88evnHX1fCEmytbik4vAmiiYSC8,2489
69
- redis/commands/search/query.py,sha256=sRobDr4A1Ssql8WEYigGwFcDlxVoLstQ04A-z8ctYe0,12082
61
+ redis/commands/search/index_definition.py,sha256=VL2CMzjxN0HEIaTn88evnHX1fCEmytbik4vAmiiYSC8,2489
62
+ redis/commands/search/profile_information.py,sha256=w9SbMiHbcZ1TpsZMe8cMIyO1hGkm5GhnZ_Gqg1feLtc,249
63
+ redis/commands/search/query.py,sha256=MbSs-cY7hG1OEkO-i6LJ_Ui1D3d2VyDTXPrmb-rty7w,12199
70
64
  redis/commands/search/querystring.py,sha256=dE577kOqkCErNgO-IXI4xFVHI8kQE-JiH5ZRI_CKjHE,7597
71
65
  redis/commands/search/reducers.py,sha256=Scceylx8BjyqS-TJOdhNW63n6tecL9ojt4U5Sqho5UY,4220
72
66
  redis/commands/search/result.py,sha256=iuqmwOeCNo_7N4a_YxxDzVdOTpbwfF1T2uuq5sTqzMo,2624
@@ -75,8 +69,7 @@ redis/commands/timeseries/__init__.py,sha256=gkz6wshEzzQQryBOnrAqqQzttS-AHfXmuN_
75
69
  redis/commands/timeseries/commands.py,sha256=8Z2BEyP23qTYCJR_e9zdG11yWmIDwGBMO2PJNLtK2BA,47147
76
70
  redis/commands/timeseries/info.py,sha256=meZYdu7IV9KaUWMKZs9qW4vo3Q9MwhdY-EBtKQzls5o,3223
77
71
  redis/commands/timeseries/utils.py,sha256=NLwSOS5Dz9N8dYQSzEyBIvrItOWwfQ0xgDj8un6x3dU,1319
78
- redis-5.3.0b4.dist-info/LICENSE,sha256=pXslClvwPXr-VbdAYzE_Ktt7ANVGwKsUmok5gzP-PMg,1074
79
- redis-5.3.0b4.dist-info/METADATA,sha256=htJiEL0Mc-swfu0WAiCCZGdnKfxW2UwUbasut_xFq6o,9168
80
- redis-5.3.0b4.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
81
- redis-5.3.0b4.dist-info/top_level.txt,sha256=OMAefszlde6ZoOtlM35AWzpRIrwtcqAMHGlRit-w2-4,6
82
- redis-5.3.0b4.dist-info/RECORD,,
72
+ redis-6.0.0b1.dist-info/METADATA,sha256=RRAjsLblR6FuHuafiPdggI22QVT943Bq439D5zAARhk,10510
73
+ redis-6.0.0b1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
74
+ redis-6.0.0b1.dist-info/licenses/LICENSE,sha256=pXslClvwPXr-VbdAYzE_Ktt7ANVGwKsUmok5gzP-PMg,1074
75
+ redis-6.0.0b1.dist-info/RECORD,,
@@ -1,5 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: bdist_wheel (0.45.1)
2
+ Generator: hatchling 1.27.0
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
-
@@ -1,263 +0,0 @@
1
- import warnings
2
-
3
- from ..helpers import quote_string, random_string, stringify_param_value
4
- from .commands import AsyncGraphCommands, GraphCommands
5
- from .edge import Edge # noqa
6
- from .node import Node # noqa
7
- from .path import Path # noqa
8
-
9
- DB_LABELS = "DB.LABELS"
10
- DB_RAELATIONSHIPTYPES = "DB.RELATIONSHIPTYPES"
11
- DB_PROPERTYKEYS = "DB.PROPERTYKEYS"
12
-
13
-
14
- class Graph(GraphCommands):
15
- """
16
- Graph, collection of nodes and edges.
17
- """
18
-
19
- def __init__(self, client, name=random_string()):
20
- """
21
- Create a new graph.
22
- """
23
- warnings.warn(
24
- DeprecationWarning(
25
- "RedisGraph support is deprecated as of Redis Stack 7.2 \
26
- (https://redis.com/blog/redisgraph-eol/)"
27
- )
28
- )
29
- self.NAME = name # Graph key
30
- self.client = client
31
- self.execute_command = client.execute_command
32
-
33
- self.nodes = {}
34
- self.edges = []
35
- self._labels = [] # List of node labels.
36
- self._properties = [] # List of properties.
37
- self._relationship_types = [] # List of relation types.
38
- self.version = 0 # Graph version
39
-
40
- @property
41
- def name(self):
42
- return self.NAME
43
-
44
- def _clear_schema(self):
45
- self._labels = []
46
- self._properties = []
47
- self._relationship_types = []
48
-
49
- def _refresh_schema(self):
50
- self._clear_schema()
51
- self._refresh_labels()
52
- self._refresh_relations()
53
- self._refresh_attributes()
54
-
55
- def _refresh_labels(self):
56
- lbls = self.labels()
57
-
58
- # Unpack data.
59
- self._labels = [l[0] for _, l in enumerate(lbls)]
60
-
61
- def _refresh_relations(self):
62
- rels = self.relationship_types()
63
-
64
- # Unpack data.
65
- self._relationship_types = [r[0] for _, r in enumerate(rels)]
66
-
67
- def _refresh_attributes(self):
68
- props = self.property_keys()
69
-
70
- # Unpack data.
71
- self._properties = [p[0] for _, p in enumerate(props)]
72
-
73
- def get_label(self, idx):
74
- """
75
- Returns a label by it's index
76
-
77
- Args:
78
-
79
- idx:
80
- The index of the label
81
- """
82
- try:
83
- label = self._labels[idx]
84
- except IndexError:
85
- # Refresh labels.
86
- self._refresh_labels()
87
- label = self._labels[idx]
88
- return label
89
-
90
- def get_relation(self, idx):
91
- """
92
- Returns a relationship type by it's index
93
-
94
- Args:
95
-
96
- idx:
97
- The index of the relation
98
- """
99
- try:
100
- relationship_type = self._relationship_types[idx]
101
- except IndexError:
102
- # Refresh relationship types.
103
- self._refresh_relations()
104
- relationship_type = self._relationship_types[idx]
105
- return relationship_type
106
-
107
- def get_property(self, idx):
108
- """
109
- Returns a property by it's index
110
-
111
- Args:
112
-
113
- idx:
114
- The index of the property
115
- """
116
- try:
117
- p = self._properties[idx]
118
- except IndexError:
119
- # Refresh properties.
120
- self._refresh_attributes()
121
- p = self._properties[idx]
122
- return p
123
-
124
- def add_node(self, node):
125
- """
126
- Adds a node to the graph.
127
- """
128
- if node.alias is None:
129
- node.alias = random_string()
130
- self.nodes[node.alias] = node
131
-
132
- def add_edge(self, edge):
133
- """
134
- Adds an edge to the graph.
135
- """
136
- if not (self.nodes[edge.src_node.alias] and self.nodes[edge.dest_node.alias]):
137
- raise AssertionError("Both edge's end must be in the graph")
138
-
139
- self.edges.append(edge)
140
-
141
- def _build_params_header(self, params):
142
- if params is None:
143
- return ""
144
- if not isinstance(params, dict):
145
- raise TypeError("'params' must be a dict")
146
- # Header starts with "CYPHER"
147
- params_header = "CYPHER "
148
- for key, value in params.items():
149
- params_header += str(key) + "=" + stringify_param_value(value) + " "
150
- return params_header
151
-
152
- # Procedures.
153
- def call_procedure(self, procedure, *args, read_only=False, **kwagrs):
154
- args = [quote_string(arg) for arg in args]
155
- q = f"CALL {procedure}({','.join(args)})"
156
-
157
- y = kwagrs.get("y", None)
158
- if y is not None:
159
- q += f"YIELD {','.join(y)}"
160
-
161
- return self.query(q, read_only=read_only)
162
-
163
- def labels(self):
164
- return self.call_procedure(DB_LABELS, read_only=True).result_set
165
-
166
- def relationship_types(self):
167
- return self.call_procedure(DB_RAELATIONSHIPTYPES, read_only=True).result_set
168
-
169
- def property_keys(self):
170
- return self.call_procedure(DB_PROPERTYKEYS, read_only=True).result_set
171
-
172
-
173
- class AsyncGraph(Graph, AsyncGraphCommands):
174
- """Async version for Graph"""
175
-
176
- async def _refresh_labels(self):
177
- lbls = await self.labels()
178
-
179
- # Unpack data.
180
- self._labels = [l[0] for _, l in enumerate(lbls)]
181
-
182
- async def _refresh_attributes(self):
183
- props = await self.property_keys()
184
-
185
- # Unpack data.
186
- self._properties = [p[0] for _, p in enumerate(props)]
187
-
188
- async def _refresh_relations(self):
189
- rels = await self.relationship_types()
190
-
191
- # Unpack data.
192
- self._relationship_types = [r[0] for _, r in enumerate(rels)]
193
-
194
- async def get_label(self, idx):
195
- """
196
- Returns a label by it's index
197
-
198
- Args:
199
-
200
- idx:
201
- The index of the label
202
- """
203
- try:
204
- label = self._labels[idx]
205
- except IndexError:
206
- # Refresh labels.
207
- await self._refresh_labels()
208
- label = self._labels[idx]
209
- return label
210
-
211
- async def get_property(self, idx):
212
- """
213
- Returns a property by it's index
214
-
215
- Args:
216
-
217
- idx:
218
- The index of the property
219
- """
220
- try:
221
- p = self._properties[idx]
222
- except IndexError:
223
- # Refresh properties.
224
- await self._refresh_attributes()
225
- p = self._properties[idx]
226
- return p
227
-
228
- async def get_relation(self, idx):
229
- """
230
- Returns a relationship type by it's index
231
-
232
- Args:
233
-
234
- idx:
235
- The index of the relation
236
- """
237
- try:
238
- relationship_type = self._relationship_types[idx]
239
- except IndexError:
240
- # Refresh relationship types.
241
- await self._refresh_relations()
242
- relationship_type = self._relationship_types[idx]
243
- return relationship_type
244
-
245
- async def call_procedure(self, procedure, *args, read_only=False, **kwagrs):
246
- args = [quote_string(arg) for arg in args]
247
- q = f"CALL {procedure}({','.join(args)})"
248
-
249
- y = kwagrs.get("y", None)
250
- if y is not None:
251
- f"YIELD {','.join(y)}"
252
- return await self.query(q, read_only=read_only)
253
-
254
- async def labels(self):
255
- return (await self.call_procedure(DB_LABELS, read_only=True)).result_set
256
-
257
- async def property_keys(self):
258
- return (await self.call_procedure(DB_PROPERTYKEYS, read_only=True)).result_set
259
-
260
- async def relationship_types(self):
261
- return (
262
- await self.call_procedure(DB_RAELATIONSHIPTYPES, read_only=True)
263
- ).result_set