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,84 @@
1
+ # Copyright Valkey GLIDE Project Contributors - SPDX Identifier: Apache-2.0
2
+
3
+
4
+ class CommandNames:
5
+ """
6
+ Command name constants for vector search.
7
+ """
8
+
9
+ FT_CREATE = "FT.CREATE"
10
+ FT_DROPINDEX = "FT.DROPINDEX"
11
+ FT_LIST = "FT._LIST"
12
+ FT_SEARCH = "FT.SEARCH"
13
+ FT_INFO = "FT.INFO"
14
+ FT_ALIASADD = "FT.ALIASADD"
15
+ FT_ALIASDEL = "FT.ALIASDEL"
16
+ FT_ALIASUPDATE = "FT.ALIASUPDATE"
17
+ FT_EXPLAIN = "FT.EXPLAIN"
18
+ FT_EXPLAINCLI = "FT.EXPLAINCLI"
19
+ FT_AGGREGATE = "FT.AGGREGATE"
20
+ FT_PROFILE = "FT.PROFILE"
21
+ FT_ALIASLIST = "FT._ALIASLIST"
22
+
23
+
24
+ class FtCreateKeywords:
25
+ """
26
+ Keywords used in the FT.CREATE command.
27
+ """
28
+
29
+ SCHEMA = "SCHEMA"
30
+ AS = "AS"
31
+ SORTABLE = "SORTABLE"
32
+ UNF = "UNF"
33
+ NO_INDEX = "NOINDEX"
34
+ ON = "ON"
35
+ PREFIX = "PREFIX"
36
+ SEPARATOR = "SEPARATOR"
37
+ CASESENSITIVE = "CASESENSITIVE"
38
+ DIM = "DIM"
39
+ DISTANCE_METRIC = "DISTANCE_METRIC"
40
+ TYPE = "TYPE"
41
+ INITIAL_CAP = "INITIAL_CAP"
42
+ M = "M"
43
+ EF_CONSTRUCTION = "EF_CONSTRUCTION"
44
+ EF_RUNTIME = "EF_RUNTIME"
45
+
46
+
47
+ class FtSearchKeywords:
48
+ """
49
+ Keywords used in the FT.SEARCH command.
50
+ """
51
+
52
+ RETURN = "RETURN"
53
+ TIMEOUT = "TIMEOUT"
54
+ PARAMS = "PARAMS"
55
+ LIMIT = "LIMIT"
56
+ COUNT = "COUNT"
57
+ AS = "AS"
58
+
59
+
60
+ class FtAggregateKeywords:
61
+ """
62
+ Keywords used in the FT.AGGREGATE command.
63
+ """
64
+
65
+ LIMIT = "LIMIT"
66
+ FILTER = "FILTER"
67
+ GROUPBY = "GROUPBY"
68
+ REDUCE = "REDUCE"
69
+ AS = "AS"
70
+ SORTBY = "SORTBY"
71
+ MAX = "MAX"
72
+ APPLY = "APPLY"
73
+ LOAD = "LOAD"
74
+ TIMEOUT = "TIMEOUT"
75
+ PARAMS = "PARAMS"
76
+
77
+
78
+ class FtProfileKeywords:
79
+ """
80
+ Keywords used in the FT.PROFILE command.
81
+ """
82
+
83
+ QUERY = "QUERY"
84
+ LIMITED = "LIMITED"
@@ -0,0 +1,409 @@
1
+ # Copyright Valkey GLIDE Project Contributors - SPDX Identifier: Apache-2.0
2
+ from abc import ABC, abstractmethod
3
+ from enum import Enum
4
+ from typing import List, Optional
5
+
6
+ from glide.async_commands.server_modules.ft_options.ft_constants import FtCreateKeywords
7
+ from glide.constants import TEncodable
8
+
9
+
10
+ class FieldType(Enum):
11
+ """
12
+ All possible values for the data type of field identifier for the SCHEMA option.
13
+ """
14
+
15
+ TEXT = "TEXT"
16
+ """
17
+ If the field contains any blob of data.
18
+ """
19
+ TAG = "TAG"
20
+ """
21
+ If the field contains a tag field.
22
+ """
23
+ NUMERIC = "NUMERIC"
24
+ """
25
+ If the field contains a number.
26
+ """
27
+ VECTOR = "VECTOR"
28
+ """
29
+ If the field is a vector field that supports vector search.
30
+ """
31
+
32
+
33
+ class VectorAlgorithm(Enum):
34
+ """
35
+ Algorithm for vector type fields used for vector similarity search.
36
+ """
37
+
38
+ HNSW = "HNSW"
39
+ """
40
+ Hierarchical Navigable Small World algorithm.
41
+ """
42
+ FLAT = "FLAT"
43
+ """
44
+ Flat algorithm or the brute force algorithm.
45
+ """
46
+
47
+
48
+ class DistanceMetricType(Enum):
49
+ """
50
+ Distance metrics to measure the degree of similarity between two vectors.
51
+
52
+ The above metrics calculate distance between two vectors, where the smaller the value is, the
53
+ closer the two vectors are in the vector space.
54
+ """
55
+
56
+ L2 = "L2"
57
+ """
58
+ Euclidean distance
59
+ """
60
+ IP = "IP"
61
+ """
62
+ Inner product
63
+ """
64
+ COSINE = "COSINE"
65
+ """
66
+ Cosine distance
67
+ """
68
+
69
+
70
+ class VectorType(Enum):
71
+ """
72
+ Type type for the vector field type.
73
+ """
74
+
75
+ FLOAT32 = "FLOAT32"
76
+ """
77
+ FLOAT32 type of vector. The only supported type.
78
+ """
79
+
80
+
81
+ class Field(ABC):
82
+ """
83
+ Abstract base class for a vector search field.
84
+ """
85
+
86
+ @abstractmethod
87
+ def __init__(
88
+ self,
89
+ name: TEncodable,
90
+ type: FieldType,
91
+ alias: Optional[TEncodable] = None,
92
+ ):
93
+ """
94
+ Initialize a new field instance.
95
+
96
+ Args:
97
+ name (TEncodable): The name of the field.
98
+ type (FieldType): The type of the field.
99
+ alias (Optional[TEncodable]): An alias for the field.
100
+ """
101
+ self.name = name
102
+ self.type = type
103
+ self.alias = alias
104
+
105
+ @abstractmethod
106
+ def to_args(self) -> List[TEncodable]:
107
+ """
108
+ Get the arguments representing the field.
109
+
110
+ Returns:
111
+ List[TEncodable]: A list of field arguments.
112
+ """
113
+ args = [self.name]
114
+ if self.alias:
115
+ args.extend([FtCreateKeywords.AS, self.alias])
116
+ args.append(self.type.value)
117
+ return args
118
+
119
+
120
+ class TextField(Field):
121
+ """
122
+ Field contains any blob of data.
123
+ """
124
+
125
+ def __init__(self, name: TEncodable, alias: Optional[TEncodable] = None):
126
+ """
127
+ Initialize a new TextField instance.
128
+
129
+ Args:
130
+ name (TEncodable): The name of the text field.
131
+ alias (Optional[TEncodable]): An alias for the field.
132
+ """
133
+ super().__init__(name, FieldType.TEXT, alias)
134
+
135
+ def to_args(self) -> List[TEncodable]:
136
+ args = super().to_args()
137
+ return args
138
+
139
+
140
+ class TagField(Field):
141
+ """
142
+ Tag fields are similar to full-text fields, but they interpret the text as a simple list of
143
+ tags delimited by a separator character.
144
+
145
+ For `HASH fields, separator default is a comma `,`. For `JSON` fields, there is no
146
+ default separator; you must declare one explicitly if needed.
147
+ """
148
+
149
+ def __init__(
150
+ self,
151
+ name: TEncodable,
152
+ alias: Optional[TEncodable] = None,
153
+ separator: Optional[TEncodable] = None,
154
+ case_sensitive: bool = False,
155
+ ):
156
+ """
157
+ Initialize a new TagField instance.
158
+
159
+ Args:
160
+ name (TEncodable): The name of the tag field.
161
+ alias (Optional[TEncodable]): An alias for the field.
162
+ separator (Optional[TEncodable]): Specify how text in the attribute is split into individual tags. Must be a single character.
163
+ case_sensitive (bool): Preserve the original letter cases of tags. If set to False, characters are converted to lowercase by default.
164
+ """
165
+ super().__init__(name, FieldType.TAG, alias)
166
+ self.separator = separator
167
+ self.case_sensitive = case_sensitive
168
+
169
+ def to_args(self) -> List[TEncodable]:
170
+ args = super().to_args()
171
+ if self.separator:
172
+ args.extend([FtCreateKeywords.SEPARATOR, self.separator])
173
+ if self.case_sensitive:
174
+ args.append(FtCreateKeywords.CASESENSITIVE)
175
+ return args
176
+
177
+
178
+ class NumericField(Field):
179
+ """
180
+ Field contains a number.
181
+ """
182
+
183
+ def __init__(self, name: TEncodable, alias: Optional[TEncodable] = None):
184
+ """
185
+ Initialize a new NumericField instance.
186
+
187
+ Args:
188
+ name (TEncodable): The name of the numeric field.
189
+ alias (Optional[TEncodable]): An alias for the field.
190
+ """
191
+ super().__init__(name, FieldType.NUMERIC, alias)
192
+
193
+ def to_args(self) -> List[TEncodable]:
194
+ args = super().to_args()
195
+ return args
196
+
197
+
198
+ class VectorFieldAttributes(ABC):
199
+ """
200
+ Abstract base class for defining vector field attributes to be used after the vector algorithm name.
201
+ """
202
+
203
+ @abstractmethod
204
+ def __init__(
205
+ self, dimensions: int, distance_metric: DistanceMetricType, type: VectorType
206
+ ):
207
+ """
208
+ Initialize a new vector field attributes instance.
209
+
210
+ Args:
211
+ dimensions (int): Number of dimensions in the vector. Equivalent to `DIM` on the module API.
212
+ distance_metric (DistanceMetricType): The distance metric used in vector type field. Can be one of `[L2 | IP | COSINE]`. Equivalent to `DISTANCE_METRIC` on the module API.
213
+ type (VectorType): Vector type. The only supported type is `FLOAT32`. Equivalent to `TYPE` on the module API.
214
+ """
215
+ self.dimensions = dimensions
216
+ self.distance_metric = distance_metric
217
+ self.type = type
218
+
219
+ @abstractmethod
220
+ def to_args(self) -> List[TEncodable]:
221
+ """
222
+ Get the arguments to be used for the algorithm of the vector field.
223
+
224
+ Returns:
225
+ List[TEncodable]: A list of arguments.
226
+ """
227
+ args: List[TEncodable] = []
228
+ if self.dimensions:
229
+ args.extend([FtCreateKeywords.DIM, str(self.dimensions)])
230
+ if self.distance_metric:
231
+ args.extend([FtCreateKeywords.DISTANCE_METRIC, self.distance_metric.name])
232
+ if self.type:
233
+ args.extend([FtCreateKeywords.TYPE, self.type.name])
234
+ return args
235
+
236
+
237
+ class VectorFieldAttributesFlat(VectorFieldAttributes):
238
+ """
239
+ Get the arguments to be used for the FLAT algorithm of the vector field.
240
+ """
241
+
242
+ def __init__(
243
+ self,
244
+ dimensions: int,
245
+ distance_metric: DistanceMetricType,
246
+ type: VectorType,
247
+ initial_cap: Optional[int] = None,
248
+ ):
249
+ """
250
+ Initialize a new flat vector field attributes instance.
251
+
252
+ Args:
253
+ dimensions (int): Number of dimensions in the vector. Equivalent to `DIM` on the module API.
254
+ distance_metric (DistanceMetricType): The distance metric used in vector type field. Can be one of `[L2 | IP | COSINE]`. Equivalent to `DISTANCE_METRIC` on the module API.
255
+ type (VectorType): Vector type. The only supported type is `FLOAT32`. Equivalent to `TYPE` on the module API.
256
+ initial_cap (Optional[int]): Initial vector capacity in the index affecting memory allocation size of the index. Defaults to `1024`. Equivalent to `INITIAL_CAP` on the module API.
257
+ """
258
+ super().__init__(dimensions, distance_metric, type)
259
+ self.initial_cap = initial_cap
260
+
261
+ def to_args(self) -> List[TEncodable]:
262
+ args = super().to_args()
263
+ if self.initial_cap:
264
+ args.extend([FtCreateKeywords.INITIAL_CAP, str(self.initial_cap)])
265
+ return args
266
+
267
+
268
+ class VectorFieldAttributesHnsw(VectorFieldAttributes):
269
+ """
270
+ Get the arguments to be used for the HNSW algorithm of the vector field.
271
+ """
272
+
273
+ def __init__(
274
+ self,
275
+ dimensions: int,
276
+ distance_metric: DistanceMetricType,
277
+ type: VectorType,
278
+ initial_cap: Optional[int] = None,
279
+ number_of_edges: Optional[int] = None,
280
+ vectors_examined_on_construction: Optional[int] = None,
281
+ vectors_examined_on_runtime: Optional[int] = None,
282
+ ):
283
+ """
284
+ Initialize a new HNSW vector field attributes instance.
285
+
286
+ Args:
287
+ dimensions (int): Number of dimensions in the vector. Equivalent to `DIM` on the module API.
288
+ distance_metric (DistanceMetricType): The distance metric used in vector type field. Can be one of `[L2 | IP | COSINE]`. Equivalent to `DISTANCE_METRIC` on the module API.
289
+ type (VectorType): Vector type. The only supported type is `FLOAT32`. Equivalent to `TYPE` on the module API.
290
+ initial_cap (Optional[int]): Initial vector capacity in the index affecting memory allocation size of the index. Defaults to `1024`. Equivalent to `INITIAL_CAP` on the module API.
291
+ number_of_edges (Optional[int]): Number of maximum allowed outgoing edges for each node in the graph in each layer. Default is `16`, maximum is `512`. Equivalent to `M` on the module API.
292
+ vectors_examined_on_construction (Optional[int]): Controls the number of vectors examined during index construction. Default value is `200`, Maximum value is `4096`. Equivalent to `EF_CONSTRUCTION` on the module API.
293
+ vectors_examined_on_runtime (Optional[int]): Controls the number of vectors examined during query operations. Default value is `10`, Maximum value is `4096`. Equivalent to `EF_RUNTIME` on the module API.
294
+ """
295
+ super().__init__(dimensions, distance_metric, type)
296
+ self.initial_cap = initial_cap
297
+ self.number_of_edges = number_of_edges
298
+ self.vectors_examined_on_construction = vectors_examined_on_construction
299
+ self.vectors_examined_on_runtime = vectors_examined_on_runtime
300
+
301
+ def to_args(self) -> List[TEncodable]:
302
+ args = super().to_args()
303
+ if self.initial_cap:
304
+ args.extend([FtCreateKeywords.INITIAL_CAP, str(self.initial_cap)])
305
+ if self.number_of_edges:
306
+ args.extend([FtCreateKeywords.M, str(self.number_of_edges)])
307
+ if self.vectors_examined_on_construction:
308
+ args.extend(
309
+ [
310
+ FtCreateKeywords.EF_CONSTRUCTION,
311
+ str(self.vectors_examined_on_construction),
312
+ ]
313
+ )
314
+ if self.vectors_examined_on_runtime:
315
+ args.extend(
316
+ [FtCreateKeywords.EF_RUNTIME, str(self.vectors_examined_on_runtime)]
317
+ )
318
+ return args
319
+
320
+
321
+ class VectorField(Field):
322
+ """
323
+ Class for defining vector field in a schema.
324
+ """
325
+
326
+ def __init__(
327
+ self,
328
+ name: TEncodable,
329
+ algorithm: VectorAlgorithm,
330
+ attributes: VectorFieldAttributes,
331
+ alias: Optional[TEncodable] = None,
332
+ ):
333
+ """
334
+ Initialize a new VectorField instance.
335
+
336
+ Args:
337
+ name (TEncodable): The name of the vector field.
338
+ algorithm (VectorAlgorithm): The vector indexing algorithm.
339
+ alias (Optional[TEncodable]): An alias for the field.
340
+ attributes (VectorFieldAttributes): Additional attributes to be passed with the vector field after the algorithm name.
341
+ """
342
+ super().__init__(name, FieldType.VECTOR, alias)
343
+ self.algorithm = algorithm
344
+ self.attributes = attributes
345
+
346
+ def to_args(self) -> List[TEncodable]:
347
+ args = super().to_args()
348
+ args.append(self.algorithm.value)
349
+ if self.attributes:
350
+ attribute_list = self.attributes.to_args()
351
+ args.append(str(len(attribute_list)))
352
+ args.extend(attribute_list)
353
+ return args
354
+
355
+
356
+ class DataType(Enum):
357
+ """
358
+ Type of the index dataset.
359
+ """
360
+
361
+ HASH = "HASH"
362
+ """
363
+ Data stored in hashes, so field identifiers are field names within the hashes.
364
+ """
365
+ JSON = "JSON"
366
+ """
367
+ Data stored as a JSON document, so field identifiers are JSON Path expressions.
368
+ """
369
+
370
+
371
+ class FtCreateOptions:
372
+ """
373
+ This class represents the input options to be used in the FT.CREATE command.
374
+ All fields in this class are optional inputs for FT.CREATE.
375
+ """
376
+
377
+ def __init__(
378
+ self,
379
+ data_type: Optional[DataType] = None,
380
+ prefixes: Optional[List[TEncodable]] = None,
381
+ ):
382
+ """
383
+ Initialize the FT.CREATE optional fields.
384
+
385
+ Args:
386
+ data_type (Optional[DataType]): The index data type. If not defined a `HASH` index is created.
387
+ prefixes (Optional[List[TEncodable]]): A list of prefixes of index definitions.
388
+ """
389
+ self.data_type = data_type
390
+ self.prefixes = prefixes
391
+
392
+ def to_args(self) -> List[TEncodable]:
393
+ """
394
+ Get the optional arguments for the FT.CREATE command.
395
+
396
+ Returns:
397
+ List[TEncodable]:
398
+ List of FT.CREATE optional agruments.
399
+ """
400
+ args: List[TEncodable] = []
401
+ if self.data_type:
402
+ args.append(FtCreateKeywords.ON)
403
+ args.append(self.data_type.value)
404
+ if self.prefixes:
405
+ args.append(FtCreateKeywords.PREFIX)
406
+ args.append(str(len(self.prefixes)))
407
+ for prefix in self.prefixes:
408
+ args.append(prefix)
409
+ return args
@@ -0,0 +1,108 @@
1
+ # Copyright Valkey GLIDE Project Contributors - SPDX Identifier: Apache-2.0
2
+ from enum import Enum
3
+ from typing import List, Optional, Union, cast
4
+
5
+ from glide.async_commands.server_modules.ft_options.ft_aggregate_options import (
6
+ FtAggregateOptions,
7
+ )
8
+ from glide.async_commands.server_modules.ft_options.ft_constants import (
9
+ FtProfileKeywords,
10
+ )
11
+ from glide.async_commands.server_modules.ft_options.ft_search_options import (
12
+ FtSearchOptions,
13
+ )
14
+ from glide.constants import TEncodable
15
+
16
+
17
+ class QueryType(Enum):
18
+ """
19
+ This class represents the query type being profiled.
20
+ """
21
+
22
+ AGGREGATE = "AGGREGATE"
23
+ """
24
+ If the query being profiled is for the FT.AGGREGATE command.
25
+ """
26
+ SEARCH = "SEARCH"
27
+ """
28
+ If the query being profiled is for the FT.SEARCH command.
29
+ """
30
+
31
+
32
+ class FtProfileOptions:
33
+ """
34
+ This class represents the arguments/options for the FT.PROFILE command.
35
+ """
36
+
37
+ def __init__(
38
+ self,
39
+ query: TEncodable,
40
+ query_type: QueryType,
41
+ query_options: Optional[Union[FtSearchOptions, FtAggregateOptions]] = None,
42
+ limited: Optional[bool] = False,
43
+ ):
44
+ """
45
+ Initialize a new FtProfileOptions instance.
46
+
47
+ Args:
48
+ query (TEncodable): The query that is being profiled. This is the query argument from the FT.AGGREGATE/FT.SEARCH command.
49
+ query_type (Optional[QueryType]): The type of query to be profiled.
50
+ query_options (Optional[Union[FtSearchOptions, FtAggregateOptions]]): The arguments/options for the FT.AGGREGATE/FT.SEARCH command being profiled.
51
+ limited (Optional[bool]): To provide some brief version of the output, otherwise a full verbose output is provided.
52
+ """
53
+ self.query = query
54
+ self.query_type = query_type
55
+ self.query_options = query_options
56
+ self.limited = limited
57
+
58
+ @classmethod
59
+ def from_query_options(
60
+ cls,
61
+ query: TEncodable,
62
+ query_options: Union[FtSearchOptions, FtAggregateOptions],
63
+ limited: Optional[bool] = False,
64
+ ):
65
+ """
66
+ A class method to create FtProfileOptions with FT.SEARCH/FT.AGGREGATE options.
67
+
68
+ Args:
69
+ query (TEncodable): The query that is being profiled. This is the query argument from the FT.AGGREGATE/FT.SEARCH command.
70
+ query_options (Optional[Union[FtSearchOptions, FtAggregateOptions]]): The arguments/options for the FT.AGGREGATE/FT.SEARCH command being profiled.
71
+ limited (Optional[bool]): To provide some brief version of the output, otherwise a full verbose output is provided.
72
+ """
73
+ query_type: QueryType = QueryType.SEARCH
74
+ if type(query_options) == FtAggregateOptions:
75
+ query_type = QueryType.AGGREGATE
76
+ return cls(query, query_type, query_options, limited)
77
+
78
+ @classmethod
79
+ def from_query_type(
80
+ cls, query: TEncodable, query_type: QueryType, limited: Optional[bool] = False
81
+ ):
82
+ """
83
+ A class method to create FtProfileOptions with QueryType.
84
+
85
+ Args:
86
+ query (TEncodable): The query that is being profiled. This is the query argument from the FT.AGGREGATE/FT.SEARCH command.
87
+ query_type (QueryType): The type of query to be profiled.
88
+ limited (Optional[bool]): To provide some brief version of the output, otherwise a full verbose output is provided.
89
+ """
90
+ return cls(query, query_type, None, limited)
91
+
92
+ def to_args(self) -> List[TEncodable]:
93
+ """
94
+ Get the remaining arguments for the FT.PROFILE command.
95
+
96
+ Returns:
97
+ List[TEncodable]: A list of remaining arguments for the FT.PROFILE command.
98
+ """
99
+ args: List[TEncodable] = [self.query_type.value]
100
+ if self.limited:
101
+ args.append(FtProfileKeywords.LIMITED)
102
+ args.extend([FtProfileKeywords.QUERY, self.query])
103
+ if self.query_options:
104
+ if type(self.query_options) == FtAggregateOptions:
105
+ args.extend(cast(FtAggregateOptions, self.query_options).to_args())
106
+ else:
107
+ args.extend(cast(FtSearchOptions, self.query_options).to_args())
108
+ return args