valkey-glide 1.3.5rc2__pp39-pypy39_pp73-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.

Files changed (37) hide show
  1. glide/__init__.py +330 -0
  2. glide/async_commands/__init__.py +5 -0
  3. glide/async_commands/bitmap.py +311 -0
  4. glide/async_commands/cluster_commands.py +1294 -0
  5. glide/async_commands/command_args.py +102 -0
  6. glide/async_commands/core.py +7040 -0
  7. glide/async_commands/server_modules/ft.py +395 -0
  8. glide/async_commands/server_modules/ft_options/ft_aggregate_options.py +293 -0
  9. glide/async_commands/server_modules/ft_options/ft_constants.py +84 -0
  10. glide/async_commands/server_modules/ft_options/ft_create_options.py +409 -0
  11. glide/async_commands/server_modules/ft_options/ft_profile_options.py +108 -0
  12. glide/async_commands/server_modules/ft_options/ft_search_options.py +131 -0
  13. glide/async_commands/server_modules/glide_json.py +1255 -0
  14. glide/async_commands/server_modules/json_batch.py +790 -0
  15. glide/async_commands/sorted_set.py +402 -0
  16. glide/async_commands/standalone_commands.py +935 -0
  17. glide/async_commands/stream.py +442 -0
  18. glide/async_commands/transaction.py +5175 -0
  19. glide/config.py +590 -0
  20. glide/constants.py +120 -0
  21. glide/exceptions.py +62 -0
  22. glide/glide.pyi +36 -0
  23. glide/glide.pypy39-pp73-darwin.so +0 -0
  24. glide/glide_client.py +604 -0
  25. glide/logger.py +85 -0
  26. glide/protobuf/command_request_pb2.py +54 -0
  27. glide/protobuf/command_request_pb2.pyi +1164 -0
  28. glide/protobuf/connection_request_pb2.py +52 -0
  29. glide/protobuf/connection_request_pb2.pyi +292 -0
  30. glide/protobuf/response_pb2.py +32 -0
  31. glide/protobuf/response_pb2.pyi +101 -0
  32. glide/protobuf_codec.py +109 -0
  33. glide/py.typed +0 -0
  34. glide/routes.py +114 -0
  35. valkey_glide-1.3.5rc2.dist-info/METADATA +125 -0
  36. valkey_glide-1.3.5rc2.dist-info/RECORD +37 -0
  37. valkey_glide-1.3.5rc2.dist-info/WHEEL +4 -0
@@ -0,0 +1,131 @@
1
+ # Copyright Valkey GLIDE Project Contributors - SPDX Identifier: Apache-2.0
2
+
3
+ from typing import List, Mapping, Optional
4
+
5
+ from glide.async_commands.server_modules.ft_options.ft_constants import FtSearchKeywords
6
+ from glide.constants import TEncodable
7
+
8
+
9
+ class FtSearchLimit:
10
+ """
11
+ This class represents the arguments for the LIMIT option of the FT.SEARCH command.
12
+ """
13
+
14
+ def __init__(self, offset: int, count: int):
15
+ """
16
+ Initialize a new FtSearchLimit instance.
17
+
18
+ Args:
19
+ offset (int): The number of keys to skip before returning the result for the FT.SEARCH command.
20
+ count (int): The total number of keys to be returned by FT.SEARCH command.
21
+ """
22
+ self.offset = offset
23
+ self.count = count
24
+
25
+ def to_args(self) -> List[TEncodable]:
26
+ """
27
+ Get the arguments for the LIMIT option of FT.SEARCH.
28
+
29
+ Returns:
30
+ List[TEncodable]: A list of LIMIT option arguments.
31
+ """
32
+ args: List[TEncodable] = [
33
+ FtSearchKeywords.LIMIT,
34
+ str(self.offset),
35
+ str(self.count),
36
+ ]
37
+ return args
38
+
39
+
40
+ class ReturnField:
41
+ """
42
+ This class represents the arguments for the RETURN option of the FT.SEARCH command.
43
+ """
44
+
45
+ def __init__(
46
+ self, field_identifier: TEncodable, alias: Optional[TEncodable] = None
47
+ ):
48
+ """
49
+ Initialize a new ReturnField instance.
50
+
51
+ Args:
52
+ field_identifier (TEncodable): The identifier for the field of the key that has to returned as a result of FT.SEARCH command.
53
+ alias (Optional[TEncodable]): The alias to override the name of the field in the FT.SEARCH result.
54
+ """
55
+ self.field_identifier = field_identifier
56
+ self.alias = alias
57
+
58
+ def to_args(self) -> List[TEncodable]:
59
+ """
60
+ Get the arguments for the RETURN option of FT.SEARCH.
61
+
62
+ Returns:
63
+ List[TEncodable]: A list of RETURN option arguments.
64
+ """
65
+ args: List[TEncodable] = [self.field_identifier]
66
+ if self.alias:
67
+ args.append(FtSearchKeywords.AS)
68
+ args.append(self.alias)
69
+ return args
70
+
71
+
72
+ class FtSearchOptions:
73
+ """
74
+ This class represents the input options to be used in the FT.SEARCH command.
75
+ All fields in this class are optional inputs for FT.SEARCH.
76
+ """
77
+
78
+ def __init__(
79
+ self,
80
+ return_fields: Optional[List[ReturnField]] = None,
81
+ timeout: Optional[int] = None,
82
+ params: Optional[Mapping[TEncodable, TEncodable]] = None,
83
+ limit: Optional[FtSearchLimit] = None,
84
+ count: Optional[bool] = False,
85
+ ):
86
+ """
87
+ Initialize the FT.SEARCH optional fields.
88
+
89
+ Args:
90
+ return_fields (Optional[List[ReturnField]]): The fields of a key that are returned by FT.SEARCH command. See `ReturnField`.
91
+ timeout (Optional[int]): This value overrides the timeout parameter of the module. The unit for the timout is in milliseconds.
92
+ params (Optional[Mapping[TEncodable, TEncodable]]): Param key/value pairs that can be referenced from within the query expression.
93
+ limit (Optional[FtSearchLimit]): This option provides pagination capability. Only the keys that satisfy the offset and count values are returned. See `FtSearchLimit`.
94
+ count (Optional[bool]): This flag option suppresses returning the contents of keys. Only the number of keys is returned.
95
+ """
96
+ self.return_fields = return_fields
97
+ self.timeout = timeout
98
+ self.params = params
99
+ self.limit = limit
100
+ self.count = count
101
+
102
+ def to_args(self) -> List[TEncodable]:
103
+ """
104
+ Get the optional arguments for the FT.SEARCH command.
105
+
106
+ Returns:
107
+ List[TEncodable]:
108
+ List of FT.SEARCH optional agruments.
109
+ """
110
+ args: List[TEncodable] = []
111
+ if self.return_fields:
112
+ args.append(FtSearchKeywords.RETURN)
113
+ return_field_args: List[TEncodable] = []
114
+ for return_field in self.return_fields:
115
+ return_field_args.extend(return_field.to_args())
116
+ args.append(str(len(return_field_args)))
117
+ args.extend(return_field_args)
118
+ if self.timeout:
119
+ args.append(FtSearchKeywords.TIMEOUT)
120
+ args.append(str(self.timeout))
121
+ if self.params:
122
+ args.append(FtSearchKeywords.PARAMS)
123
+ args.append(str(len(self.params) * 2))
124
+ for name, value in self.params.items():
125
+ args.append(name)
126
+ args.append(value)
127
+ if self.limit:
128
+ args.extend(self.limit.to_args())
129
+ if self.count:
130
+ args.append(FtSearchKeywords.COUNT)
131
+ return args