valkey-glide 2.1.0rc8__cp313-cp313-macosx_10_7_x86_64.whl → 2.1.1rc2__cp313-cp313-macosx_10_7_x86_64.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.

Potentially problematic release.


This version of valkey-glide might be problematic. Click here for more details.

glide/__init__.py CHANGED
@@ -1,5 +1,9 @@
1
1
  # Copyright Valkey GLIDE Project Contributors - SPDX Identifier: Apache-2.0
2
2
 
3
+ import sys
4
+ import types
5
+ import warnings
6
+
3
7
  from glide.glide import (
4
8
  ClusterScanCursor,
5
9
  OpenTelemetryConfig,
@@ -159,6 +163,56 @@ from .glide_client import GlideClient, GlideClusterClient, TGlideClient
159
163
  from .logger import Level as LogLevel
160
164
  from .logger import Logger
161
165
 
166
+ _glide_module = sys.modules[__name__]
167
+
168
+ _legacy_modules = [
169
+ "glide.exceptions",
170
+ "glide.config",
171
+ "glide.constants",
172
+ "glide.routes",
173
+ "glide.async_commands",
174
+ "glide.async_commands.batch",
175
+ "glide.async_commands.batch_options",
176
+ "glide.async_commands.bitmap",
177
+ "glide.async_commands.command_args",
178
+ "glide.async_commands.server_modules",
179
+ "glide.async_commands.server_modules.ft_options",
180
+ "glide.async_commands.server_modules.ft_options.ft_aggregate_options",
181
+ "glide.async_commands.server_modules.ft_options.ft_create_options",
182
+ "glide.async_commands.server_modules.ft_options.ft_profile_options",
183
+ "glide.async_commands.server_modules.ft_options.ft_search_options",
184
+ "glide.async_commands.server_modules.glide_json",
185
+ "glide.async_commands.sorted_set",
186
+ "glide.async_commands.stream",
187
+ ]
188
+
189
+
190
+ class _LegacyModule(types.ModuleType):
191
+ """Proxy for a deprecated module that warns when first accessed."""
192
+
193
+ def __init__(self, name):
194
+ super().__init__(name)
195
+ self._warned = False
196
+
197
+ def __getattr__(self, name):
198
+ if not self._warned:
199
+ warnings.warn(
200
+ f"Importing from '{self.__name__}' is deprecated. "
201
+ f"Please import directly from 'glide' instead.",
202
+ DeprecationWarning,
203
+ stacklevel=2,
204
+ )
205
+ self._warned = True
206
+
207
+ # Access the attribute from the real top-level glide module
208
+ return getattr(_glide_module, name)
209
+
210
+
211
+ # Replace old modules with lazy proxy modules
212
+ for old_name in _legacy_modules:
213
+ if old_name not in sys.modules:
214
+ sys.modules[old_name] = _LegacyModule(old_name)
215
+
162
216
  __all__ = [
163
217
  # Client
164
218
  "TGlideClient",
@@ -430,6 +430,34 @@ class CoreCommands(Protocol):
430
430
  """
431
431
  return cast(int, await self._execute_command(RequestType.Del, keys))
432
432
 
433
+ async def move(self, key: TEncodable, db_index: int) -> bool:
434
+ """
435
+ Move key from the currently selected database to the specified destination database.
436
+
437
+ Note:
438
+ For cluster mode move command is supported since Valkey 9.0.0
439
+
440
+ See [valkey.io](https://valkey.io/commands/move/) for more details.
441
+
442
+ Args:
443
+ key (TEncodable): The key to move.
444
+ db_index (int): The destination database number.
445
+
446
+ Returns:
447
+ bool: True if the key was moved successfully, False if the key does not exist
448
+ or was already present in the destination database.
449
+
450
+ Examples:
451
+ >>> await client.move("some_key", 1)
452
+ True # The key was successfully moved to database 1
453
+ >>> await client.move("nonexistent_key", 1)
454
+ False # The key does not exist
455
+ """
456
+ return cast(
457
+ bool,
458
+ await self._execute_command(RequestType.Move, [key, str(db_index)]),
459
+ )
460
+
433
461
  async def incr(self, key: TEncodable) -> int:
434
462
  """
435
463
  Increments the number stored at `key` by one. If the key does not exist, it is set to 0 before performing the
@@ -651,31 +651,6 @@ class StandaloneCommands(CoreCommands):
651
651
  await self._execute_command(RequestType.LastSave, []),
652
652
  )
653
653
 
654
- async def move(self, key: TEncodable, db_index: int) -> bool:
655
- """
656
- Move `key` from the currently selected database to the database specified by `db_index`.
657
-
658
- See [valkey.io](https://valkey.io/commands/move/) for more details.
659
-
660
- Args:
661
- key (TEncodable): The key to move.
662
- db_index (int): The index of the database to move `key` to.
663
-
664
- Returns:
665
- bool: `True` if `key` was moved.
666
-
667
- `False` if the `key` already exists in the destination database
668
- or does not exist in the source database.
669
-
670
- Example:
671
- >>> await client.move("some_key", 1)
672
- True
673
- """
674
- return cast(
675
- bool,
676
- await self._execute_command(RequestType.Move, [key, str(db_index)]),
677
- )
678
-
679
654
  async def publish(self, message: TEncodable, channel: TEncodable) -> int:
680
655
  """
681
656
  Publish a message on pubsub channel.
Binary file
glide/glide_client.py CHANGED
@@ -338,7 +338,7 @@ class BaseClient(CoreCommands):
338
338
  request.callback_idx if isinstance(request, CommandRequest) else 0
339
339
  )
340
340
  res_future = self._available_futures.pop(callback_idx, None)
341
- if res_future:
341
+ if res_future and not res_future.done():
342
342
  res_future.set_exception(e)
343
343
  else:
344
344
  ClientLogger.log(
@@ -355,7 +355,10 @@ class BaseClient(CoreCommands):
355
355
  b_arr = bytearray()
356
356
  for request in requests:
357
357
  ProtobufCodec.encode_delimited(b_arr, request)
358
- await self._stream.send(b_arr)
358
+ try:
359
+ await self._stream.send(b_arr)
360
+ except (anyio.ClosedResourceError, anyio.EndOfStream):
361
+ raise ClosingError("The communication layer was unexpectedly closed.")
359
362
 
360
363
  def _encode_arg(self, arg: TEncodable) -> bytes:
361
364
  """
@@ -403,6 +403,27 @@ class BaseBatch:
403
403
  """
404
404
  return self.append_command(RequestType.ConfigResetStat, [])
405
405
 
406
+ def move(self: TBatch, key: TEncodable, db_index: int) -> "TBatch":
407
+ """
408
+ Move `key` from the currently selected database to the database specified by `db_index`.
409
+
410
+ Note:
411
+ For cluster mode move command is supported since Valkey 9.0.0
412
+
413
+ See [valkey.io](https://valkey.io/commands/move/) for more details.
414
+
415
+ Args:
416
+ key (TEncodable): The key to move.
417
+ db_index (int): The index of the database to move `key` to.
418
+
419
+ Commands response:
420
+ bool: True if `key` was moved.
421
+
422
+ False if the `key` already exists in the destination database
423
+ or does not exist in the source database.
424
+ """
425
+ return self.append_command(RequestType.Move, [key, str(db_index)])
426
+
406
427
  def mset(self: TBatch, key_value_map: Mapping[TEncodable, TEncodable]) -> TBatch:
407
428
  """
408
429
  Set multiple keys to multiple values in a single atomic operation.
@@ -5754,25 +5775,6 @@ class Batch(BaseBatch):
5754
5775
 
5755
5776
  """
5756
5777
 
5757
- # TODO: add SLAVEOF and all SENTINEL commands
5758
- def move(self, key: TEncodable, db_index: int) -> "Batch":
5759
- """
5760
- Move `key` from the currently selected database to the database specified by `db_index`.
5761
-
5762
- See [valkey.io](https://valkey.io/commands/move/) for more details.
5763
-
5764
- Args:
5765
- key (TEncodable): The key to move.
5766
- db_index (int): The index of the database to move `key` to.
5767
-
5768
- Commands response:
5769
- bool: True if `key` was moved.
5770
-
5771
- False if the `key` already exists in the destination database
5772
- or does not exist in the source database.
5773
- """
5774
- return self.append_command(RequestType.Move, [key, str(db_index)])
5775
-
5776
5778
  def select(self, index: int) -> "Batch":
5777
5779
  """
5778
5780
  Change the currently selected database.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: valkey-glide
3
- Version: 2.1.0rc8
3
+ Version: 2.1.1rc2
4
4
  Classifier: Topic :: Database
5
5
  Classifier: Topic :: Utilities
6
6
  Classifier: License :: OSI Approved :: Apache Software License
@@ -1,19 +1,19 @@
1
- valkey_glide-2.1.0rc8.dist-info/METADATA,sha256=nGnpNUXwxxlbh61Lt021I1CPMWM_W5U2Nzf0pLGkNss,6978
2
- valkey_glide-2.1.0rc8.dist-info/WHEEL,sha256=WKnnnV-Uggn89gY5LlN93bk9B3X9JgieltY0v0WQhvw,107
1
+ valkey_glide-2.1.1rc2.dist-info/METADATA,sha256=KWk9vN70VroErcvOfkOZNADxlpIWZ7GdFRbw8aPRHoY,6978
2
+ valkey_glide-2.1.1rc2.dist-info/WHEEL,sha256=WKnnnV-Uggn89gY5LlN93bk9B3X9JgieltY0v0WQhvw,107
3
3
  glide/async_commands/glide_json.py,sha256=H5dnB4vJkGPpNXJZhhVyPQoTSbkN_chq5Xw6tkP0wMQ,60410
4
4
  glide/async_commands/ft.py,sha256=1v96sBCgiXtPbj85ZurY3ruLCmok3cPoaIXSiJBEv9Y,16849
5
5
  glide/async_commands/__init__.py,sha256=_tbTAFATlzp4L2qe-H77PpAQK-16VsV-y7uKNUKLC_o,136
6
- glide/async_commands/core.py,sha256=csbFWNGqduOgFsL378LYynLqHZURAYoewdKmmsrFsTs,328186
7
- glide/async_commands/standalone_commands.py,sha256=6oPesnC8WK816JbBySUZ9dSXPbdtN0dvd8rRde646NQ,40364
6
+ glide/async_commands/core.py,sha256=XGnO7RjJwNDAiTk1NUqGrSeDhTE9f35VzKl1qRs29oo,329202
7
+ glide/async_commands/standalone_commands.py,sha256=yG855laN2P69KKn2wBgWnH7HaZwvwQYUMghRfYQ0X6k,39553
8
8
  glide/async_commands/cluster_commands.py,sha256=Lji6eo2LaoXwy4Ha3e6bcGOHyMQHdDBiSQLt1kf9gGo,60129
9
- glide/__init__.py,sha256=r0VyTcuIdVzXTTZW6TmWwCsTCIg54ciyba1iDM8PFVQ,7055
9
+ glide/__init__.py,sha256=6FuOMIsm52UiKxJsb2dUj06vwCT8DOsxZDqxMx8d6vQ,8767
10
10
  glide/glide.pyi,sha256=6JIpAeADQ-1fU1Mp99pyh7aJORDxAAdtQebV5aByIVI,2093
11
11
  glide/opentelemetry.py,sha256=vg9fTYXj7_rni7hVBkZBJ1ZN4-RSGde5fOH4DsnVx_4,7476
12
- glide/glide_client.py,sha256=4RKpPvaci7XmlFgoI5s__P3dATk8sM2QcpUBFnFVq78,32405
12
+ glide/glide_client.py,sha256=lIxvEkMsUG6Ura42dDrFbP8OPYJ1bXk-LsFf4eN5fwo,32594
13
13
  glide/logger.py,sha256=5-bAhfH_6hYEXdcgBR9R_wdeffSLHqEN-aQeIyMHnYY,4103
14
14
  glide_shared/__init__.py,sha256=Jgl61tWsX5n1F1a5_rxPvWBuMkBYtJ7gCLFRDPwGV8o,7141
15
15
  glide_shared/commands/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
16
- glide_shared/commands/batch.py,sha256=HxvswR5epj2A9nx-i69xzlO0L3jRWQNAfOg9pmmg3dE,246833
16
+ glide_shared/commands/batch.py,sha256=cGsjfyLqhfQjFaLcDcO18iMHnvBm81YMxk_aBPP7q00,246881
17
17
  glide_shared/commands/batch_options.py,sha256=i2lDCLhMzUvpArb2bxX16xu7X-im0hLPaLXALkxWeQ8,11130
18
18
  glide_shared/commands/bitmap.py,sha256=ZHGLcKBP7RADtANqIR7PWdIW_gfDBFgpkIsQ-T4QFBQ,10125
19
19
  glide_shared/commands/command_args.py,sha256=55vpSxeQr8wFU7olkFTEecl66wPk1g6vWxVYj16UvXs,2529
@@ -35,5 +35,5 @@ glide_shared/protobuf/connection_request_pb2.py,sha256=b3jDmMetSHUrZGmQd8b5DooZZ
35
35
  glide_shared/protobuf/response_pb2.py,sha256=oT2GHUwjrxvBVdINRKCvb3_BFN0Fq2wqwHbTj7KAX2E,2110
36
36
  glide_shared/protobuf_codec.py,sha256=xwt4-D4WbvNIY_vjOd-00c73HOyNjWq7nN-Z718PBVA,3667
37
37
  glide_shared/routes.py,sha256=HFccxCzXQXSi6Y1HFsRUm9ZcbJgCrar6y6uOWpGJWe0,4746
38
- glide/glide.cpython-313-darwin.so,sha256=mn6aCJpZM-AgE08SQYuzV0kGGVHOEiGOsqzYddGIZaI,11432576
39
- valkey_glide-2.1.0rc8.dist-info/RECORD,,
38
+ glide/glide.cpython-313-darwin.so,sha256=Iz2LC8lQGiszY6ZjhUzdMoLiKxZYRx32-l-RVEEjMh0,11371160
39
+ valkey_glide-2.1.1rc2.dist-info/RECORD,,