redis 5.1.1__py3-none-any.whl → 5.2.1__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.
redis/_parsers/helpers.py CHANGED
@@ -396,13 +396,20 @@ def parse_slowlog_get(response, **options):
396
396
  # an O(N) complexity) instead of the command.
397
397
  if isinstance(item[3], list):
398
398
  result["command"] = space.join(item[3])
399
- result["client_address"] = item[4]
400
- result["client_name"] = item[5]
399
+
400
+ # These fields are optional, depends on environment.
401
+ if len(item) >= 6:
402
+ result["client_address"] = item[4]
403
+ result["client_name"] = item[5]
401
404
  else:
402
405
  result["complexity"] = item[3]
403
406
  result["command"] = space.join(item[4])
404
- result["client_address"] = item[5]
405
- result["client_name"] = item[6]
407
+
408
+ # These fields are optional, depends on environment.
409
+ if len(item) >= 7:
410
+ result["client_address"] = item[5]
411
+ result["client_name"] = item[6]
412
+
406
413
  return result
407
414
 
408
415
  return [parse_item(item) for item in response]
@@ -214,7 +214,13 @@ class AbstractConnection:
214
214
  _warnings.warn(
215
215
  f"unclosed Connection {self!r}", ResourceWarning, source=self
216
216
  )
217
- self._close()
217
+
218
+ try:
219
+ asyncio.get_running_loop()
220
+ self._close()
221
+ except RuntimeError:
222
+ # No actions been taken if pool already closed.
223
+ pass
218
224
 
219
225
  def _close(self):
220
226
  """
redis/asyncio/sentinel.py CHANGED
@@ -29,11 +29,7 @@ class SentinelManagedConnection(Connection):
29
29
  super().__init__(**kwargs)
30
30
 
31
31
  def __repr__(self):
32
- pool = self.connection_pool
33
- s = (
34
- f"<{self.__class__.__module__}.{self.__class__.__name__}"
35
- f"(service={pool.service_name}"
36
- )
32
+ s = f"<{self.__class__.__module__}.{self.__class__.__name__}"
37
33
  if self.host:
38
34
  host_info = f",host={self.host},port={self.port}"
39
35
  s += host_info
@@ -112,6 +112,7 @@ class AggregateRequest:
112
112
  self._cursor = []
113
113
  self._dialect = None
114
114
  self._add_scores = False
115
+ self._scorer = "TFIDF"
115
116
 
116
117
  def load(self, *fields: List[str]) -> "AggregateRequest":
117
118
  """
@@ -300,6 +301,17 @@ class AggregateRequest:
300
301
  self._add_scores = True
301
302
  return self
302
303
 
304
+ def scorer(self, scorer: str) -> "AggregateRequest":
305
+ """
306
+ Use a different scoring function to evaluate document relevance.
307
+ Default is `TFIDF`.
308
+
309
+ :param scorer: The scoring function to use
310
+ (e.g. `TFIDF.DOCNORM` or `BM25`)
311
+ """
312
+ self._scorer = scorer
313
+ return self
314
+
303
315
  def verbatim(self) -> "AggregateRequest":
304
316
  self._verbatim = True
305
317
  return self
@@ -323,6 +335,9 @@ class AggregateRequest:
323
335
  if self._verbatim:
324
336
  ret.append("VERBATIM")
325
337
 
338
+ if self._scorer:
339
+ ret.extend(["SCORER", self._scorer])
340
+
326
341
  if self._add_scores:
327
342
  ret.append("ADDSCORES")
328
343
 
@@ -332,6 +347,7 @@ class AggregateRequest:
332
347
  if self._loadall:
333
348
  ret.append("LOAD")
334
349
  ret.append("*")
350
+
335
351
  elif self._loadfields:
336
352
  ret.append("LOAD")
337
353
  ret.append(str(len(self._loadfields)))
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: redis
3
- Version: 5.1.1
3
+ Version: 5.2.1
4
4
  Summary: Python client for Redis database and key-value store
5
5
  Home-page: https://github.com/redis/redis-py
6
6
  Author: Redis Inc.
@@ -18,7 +18,7 @@ redis/_parsers/__init__.py,sha256=qkfgV2X9iyvQAvbLdSelwgz0dCk9SGAosCvuZC9-qDc,55
18
18
  redis/_parsers/base.py,sha256=0j3qIhLjQZOzYGc4n1IesNegckomVhvDsEZD6-yb3Ns,7475
19
19
  redis/_parsers/commands.py,sha256=pmR4hl4u93UvCmeDgePHFc6pWDr4slrKEvCsdMmtj_M,11052
20
20
  redis/_parsers/encoders.py,sha256=X0jvTp-E4TZUlZxV5LJJ88TuVrF1vly5tuC0xjxGaSc,1734
21
- redis/_parsers/helpers.py,sha256=XFKGPQUlh5gJfE6D0rJ_qgJDFEKX9aX5vV3NouHv-00,28973
21
+ redis/_parsers/helpers.py,sha256=X5wkGDtuzseeCz23_t3FJpzy1ltIvh7zO1uD3cypiOs,29184
22
22
  redis/_parsers/hiredis.py,sha256=qL1iCkWlxI63PiP99u_MY5-V6zKaesW2fD-IMNtc0QI,8189
23
23
  redis/_parsers/resp2.py,sha256=f22kH-_ZP2iNtOn6xOe65MSy_fJpu8OEn1u_hgeeojI,4813
24
24
  redis/_parsers/resp3.py,sha256=jHtL1LYJegJ_LiNTsjzIvS-kZyNR58jZ_YV4cRfwuN0,11127
@@ -26,10 +26,10 @@ redis/_parsers/socket.py,sha256=CKD8QW_wFSNlIZzxlbNduaGpiv0I8wBcsGuAIojDfJg,5403
26
26
  redis/asyncio/__init__.py,sha256=uoDD8XYVi0Kj6mcufYwLDUTQXmBRx7a0bhKF9stZr7I,1489
27
27
  redis/asyncio/client.py,sha256=WIkebQoxn8GUMv2UmhQ4s81Cal6INwMc5mUohfNSTRk,59630
28
28
  redis/asyncio/cluster.py,sha256=qgBglEl7410K5M1CJxPH1-G3Mv2ed-S134uSJ2mmxng,63177
29
- redis/asyncio/connection.py,sha256=8xn0-RpgHyc3LIM-TjM538QZ0MHv_1j92dNLzD8MJsE,44878
29
+ redis/asyncio/connection.py,sha256=sErywuQxjauJVB5rx2P1AsEKD0T2Z9sTyfzF2ekrIp8,45061
30
30
  redis/asyncio/lock.py,sha256=lLasXEO2E1CskhX5ZZoaSGpmwZP1Q782R3HAUNG3wD4,11967
31
31
  redis/asyncio/retry.py,sha256=SnPPOlo5gcyIFtkC4DY7HFvmDgUaILsJ3DeHioogdB8,2219
32
- redis/asyncio/sentinel.py,sha256=KOfuEsUZjwtL4jVEfpxh8jvzsCbC3fXzjSLiSghs1MY,14397
32
+ redis/asyncio/sentinel.py,sha256=QBpsrdlhZlFqENy_rK1IuasSicox55_xSvP_IywbhbQ,14293
33
33
  redis/asyncio/utils.py,sha256=Yxc5YQumhLjtDDwCS4mgxI6yy2Z21AzLlFxVbxCohic,704
34
34
  redis/commands/__init__.py,sha256=cTUH-MGvaLYS0WuoytyqtN1wniw2A1KbkUXcpvOSY3I,576
35
35
  redis/commands/cluster.py,sha256=BBHSyXfl3OETIJs4JC5DrcfzqgF2Kt4WMEcd0WMILOU,31598
@@ -55,7 +55,7 @@ redis/commands/json/decoders.py,sha256=a_IoMV_wgeJyUifD4P6HTcM9s6FhricwmzQcZRmc-
55
55
  redis/commands/json/path.py,sha256=0zaO6_q_FVMk1Bkhkb7Wcr8AF2Tfr69VhkKy1IBVhpA,393
56
56
  redis/commands/search/__init__.py,sha256=happQFVF0j7P87p7LQsUK5AK0kuem9cA-xvVRdQWpos,5744
57
57
  redis/commands/search/_util.py,sha256=9Mp72OO5Ib5UbfN7uXb-iB7hQCm1jQLV90ms2P9XSGU,219
58
- redis/commands/search/aggregation.py,sha256=WYTxAUANdIJ1XPgWAtXF_Om21u5F9EHilaRXxwpDFec,11064
58
+ redis/commands/search/aggregation.py,sha256=Ed9iezAj504gGQnqcmKrG0X_9Y9Jd1ddg2CRvDWcJ4s,11512
59
59
  redis/commands/search/commands.py,sha256=3zrkg9FXuscD6IuBdd7zu6B1Q-qED2s6pmbYBep0pyA,37429
60
60
  redis/commands/search/document.py,sha256=g2R-PRgq-jN33_GLXzavvse4cpIHBMfjPfPK7tnE9Gc,413
61
61
  redis/commands/search/field.py,sha256=ZWHYTtrLi-zZojohqXoidfllxP0SiadBW6hnGkBw7mM,5891
@@ -69,8 +69,8 @@ redis/commands/timeseries/__init__.py,sha256=gkz6wshEzzQQryBOnrAqqQzttS-AHfXmuN_
69
69
  redis/commands/timeseries/commands.py,sha256=8Z2BEyP23qTYCJR_e9zdG11yWmIDwGBMO2PJNLtK2BA,47147
70
70
  redis/commands/timeseries/info.py,sha256=meZYdu7IV9KaUWMKZs9qW4vo3Q9MwhdY-EBtKQzls5o,3223
71
71
  redis/commands/timeseries/utils.py,sha256=NLwSOS5Dz9N8dYQSzEyBIvrItOWwfQ0xgDj8un6x3dU,1319
72
- redis-5.1.1.dist-info/LICENSE,sha256=pXslClvwPXr-VbdAYzE_Ktt7ANVGwKsUmok5gzP-PMg,1074
73
- redis-5.1.1.dist-info/METADATA,sha256=rla49iP_R11yTm51i6G8lXu0UEtlFF-aPa8oC_C_Qf8,9138
74
- redis-5.1.1.dist-info/WHEEL,sha256=eOLhNAGa2EW3wWl_TU484h7q1UNgy0JXjjoqKoxAAQc,92
75
- redis-5.1.1.dist-info/top_level.txt,sha256=OMAefszlde6ZoOtlM35AWzpRIrwtcqAMHGlRit-w2-4,6
76
- redis-5.1.1.dist-info/RECORD,,
72
+ redis-5.2.1.dist-info/LICENSE,sha256=pXslClvwPXr-VbdAYzE_Ktt7ANVGwKsUmok5gzP-PMg,1074
73
+ redis-5.2.1.dist-info/METADATA,sha256=BPiJh0sxEzBec911KAZAZ0fbCI4gF46NBvYbMV0Xeco,9138
74
+ redis-5.2.1.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
75
+ redis-5.2.1.dist-info/top_level.txt,sha256=OMAefszlde6ZoOtlM35AWzpRIrwtcqAMHGlRit-w2-4,6
76
+ redis-5.2.1.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: bdist_wheel (0.44.0)
2
+ Generator: bdist_wheel (0.45.1)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
File without changes