coredis 5.5.0__cp313-cp313-macosx_11_0_arm64.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.
- 22fe76227e35f92ab5c3__mypyc.cpython-313-darwin.so +0 -0
- coredis/__init__.py +42 -0
- coredis/_enum.py +42 -0
- coredis/_json.py +11 -0
- coredis/_packer.cpython-313-darwin.so +0 -0
- coredis/_packer.py +71 -0
- coredis/_protocols.py +50 -0
- coredis/_py_311_typing.py +20 -0
- coredis/_py_312_typing.py +17 -0
- coredis/_sidecar.py +114 -0
- coredis/_utils.cpython-313-darwin.so +0 -0
- coredis/_utils.py +440 -0
- coredis/_version.py +34 -0
- coredis/_version.pyi +1 -0
- coredis/cache.py +801 -0
- coredis/client/__init__.py +6 -0
- coredis/client/basic.py +1240 -0
- coredis/client/cluster.py +1265 -0
- coredis/commands/__init__.py +64 -0
- coredis/commands/_key_spec.py +517 -0
- coredis/commands/_utils.py +108 -0
- coredis/commands/_validators.py +159 -0
- coredis/commands/_wrappers.py +175 -0
- coredis/commands/bitfield.py +110 -0
- coredis/commands/constants.py +662 -0
- coredis/commands/core.py +8484 -0
- coredis/commands/function.py +408 -0
- coredis/commands/monitor.py +168 -0
- coredis/commands/pubsub.py +905 -0
- coredis/commands/request.py +108 -0
- coredis/commands/script.py +296 -0
- coredis/commands/sentinel.py +246 -0
- coredis/config.py +50 -0
- coredis/connection.py +906 -0
- coredis/constants.cpython-313-darwin.so +0 -0
- coredis/constants.py +37 -0
- coredis/credentials.py +45 -0
- coredis/exceptions.py +360 -0
- coredis/experimental/__init__.py +1 -0
- coredis/globals.py +23 -0
- coredis/modules/__init__.py +121 -0
- coredis/modules/autocomplete.py +138 -0
- coredis/modules/base.py +262 -0
- coredis/modules/filters.py +1319 -0
- coredis/modules/graph.py +362 -0
- coredis/modules/json.py +691 -0
- coredis/modules/response/__init__.py +0 -0
- coredis/modules/response/_callbacks/__init__.py +0 -0
- coredis/modules/response/_callbacks/autocomplete.py +42 -0
- coredis/modules/response/_callbacks/graph.py +237 -0
- coredis/modules/response/_callbacks/json.py +21 -0
- coredis/modules/response/_callbacks/search.py +221 -0
- coredis/modules/response/_callbacks/timeseries.py +158 -0
- coredis/modules/response/types.py +179 -0
- coredis/modules/search.py +1089 -0
- coredis/modules/timeseries.py +1139 -0
- coredis/parser.cpython-313-darwin.so +0 -0
- coredis/parser.py +344 -0
- coredis/pipeline.py +1225 -0
- coredis/pool/__init__.py +11 -0
- coredis/pool/basic.py +453 -0
- coredis/pool/cluster.py +517 -0
- coredis/pool/nodemanager.py +340 -0
- coredis/py.typed +0 -0
- coredis/recipes/__init__.py +0 -0
- coredis/recipes/credentials/__init__.py +5 -0
- coredis/recipes/credentials/iam_provider.py +63 -0
- coredis/recipes/locks/__init__.py +5 -0
- coredis/recipes/locks/extend.lua +17 -0
- coredis/recipes/locks/lua_lock.py +281 -0
- coredis/recipes/locks/release.lua +10 -0
- coredis/response/__init__.py +5 -0
- coredis/response/_callbacks/__init__.py +538 -0
- coredis/response/_callbacks/acl.py +32 -0
- coredis/response/_callbacks/cluster.py +183 -0
- coredis/response/_callbacks/command.py +86 -0
- coredis/response/_callbacks/connection.py +31 -0
- coredis/response/_callbacks/geo.py +58 -0
- coredis/response/_callbacks/hash.py +85 -0
- coredis/response/_callbacks/keys.py +59 -0
- coredis/response/_callbacks/module.py +33 -0
- coredis/response/_callbacks/script.py +85 -0
- coredis/response/_callbacks/sentinel.py +179 -0
- coredis/response/_callbacks/server.py +241 -0
- coredis/response/_callbacks/sets.py +44 -0
- coredis/response/_callbacks/sorted_set.py +204 -0
- coredis/response/_callbacks/streams.py +185 -0
- coredis/response/_callbacks/strings.py +70 -0
- coredis/response/_callbacks/vector_sets.py +159 -0
- coredis/response/_utils.py +33 -0
- coredis/response/types.py +416 -0
- coredis/retry.py +233 -0
- coredis/sentinel.py +477 -0
- coredis/stream.py +369 -0
- coredis/tokens.py +2286 -0
- coredis/typing.py +593 -0
- coredis-5.5.0.dist-info/METADATA +211 -0
- coredis-5.5.0.dist-info/RECORD +100 -0
- coredis-5.5.0.dist-info/WHEEL +6 -0
- coredis-5.5.0.dist-info/licenses/LICENSE +23 -0
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import dataclasses
|
|
4
|
+
from typing import NamedTuple
|
|
5
|
+
|
|
6
|
+
from coredis._json import json
|
|
7
|
+
from coredis.typing import (
|
|
8
|
+
AnyStr,
|
|
9
|
+
Generic,
|
|
10
|
+
ResponsePrimitive,
|
|
11
|
+
ResponseType,
|
|
12
|
+
StringT,
|
|
13
|
+
)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
@dataclasses.dataclass
|
|
17
|
+
class SearchDocument(Generic[AnyStr]):
|
|
18
|
+
"""
|
|
19
|
+
Search document as returned by `FT.SEARCH <https://redis.io/commands/ft.search>`__
|
|
20
|
+
"""
|
|
21
|
+
|
|
22
|
+
#: Document id
|
|
23
|
+
id: StringT
|
|
24
|
+
#: Search score if the :paramref:`~coredis.modules.search.Search.search.withscores`
|
|
25
|
+
#: option was used
|
|
26
|
+
score: float | None
|
|
27
|
+
#: Explanation of the score if the
|
|
28
|
+
#: :paramref:`~coredis.modules.search.Search.search.explainscore` option was used
|
|
29
|
+
score_explanation: list[AnyStr] | None
|
|
30
|
+
#: Payload associated with the document if
|
|
31
|
+
#: :paramref:`~coredis.modules.search.Search.search.withpayloads` was used
|
|
32
|
+
payload: StringT | None
|
|
33
|
+
sortkeys: StringT | None
|
|
34
|
+
#: Mapping of properties returned for the document
|
|
35
|
+
properties: dict[AnyStr, ResponseType]
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
@dataclasses.dataclass
|
|
39
|
+
class SearchResult(Generic[AnyStr]):
|
|
40
|
+
"""
|
|
41
|
+
Search results as returned by `FT.SEARCH <https://redis.io/commands/ft.search>`__
|
|
42
|
+
"""
|
|
43
|
+
|
|
44
|
+
#: The total number of results found for the query
|
|
45
|
+
total: int
|
|
46
|
+
#: The documents returned by the query
|
|
47
|
+
documents: tuple[SearchDocument[AnyStr], ...]
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
@dataclasses.dataclass
|
|
51
|
+
class SearchAggregationResult(Generic[AnyStr]):
|
|
52
|
+
"""
|
|
53
|
+
Search aggregations as returned by `FT.AGGREGATE <https://redis.io/commands/ft.aggregate>`__
|
|
54
|
+
"""
|
|
55
|
+
|
|
56
|
+
#: The aggregation results
|
|
57
|
+
results: list[dict[StringT, ResponseType]]
|
|
58
|
+
#: The cursor id if :paramref:`~coredis.modules.search.aggregate.with_cursor` was `True`
|
|
59
|
+
cursor: int | None
|
|
60
|
+
|
|
61
|
+
def __post_init__(self) -> None:
|
|
62
|
+
for idx, result in enumerate(self.results):
|
|
63
|
+
json_key = b"$" if b"$" in result else "$" if "$" in result else None
|
|
64
|
+
if json_key:
|
|
65
|
+
self.results[idx] = json.loads(result.pop(json_key))
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
@dataclasses.dataclass
|
|
69
|
+
class AutocompleteSuggestion(Generic[AnyStr]):
|
|
70
|
+
"""
|
|
71
|
+
Autocomplete suggestion as returned by `FT.SUGGET <https://redis.io/commands/ft.sugget>`__
|
|
72
|
+
"""
|
|
73
|
+
|
|
74
|
+
#: the suggestion string
|
|
75
|
+
string: AnyStr
|
|
76
|
+
#: the score of the suggestion if
|
|
77
|
+
#: :paramref:`~coredis.modules.autocomplete.Autocomplete.sugget.withscores` was used
|
|
78
|
+
score: float | None
|
|
79
|
+
#: the payload associated with the suggestion if
|
|
80
|
+
#: :paramref:`~coredis.modules.autocomplete.Autocomplete.sugget.withpayloads` was used
|
|
81
|
+
payload: AnyStr | None
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
@dataclasses.dataclass
|
|
85
|
+
class GraphNode(Generic[AnyStr]):
|
|
86
|
+
"""
|
|
87
|
+
Representation of a graph node
|
|
88
|
+
"""
|
|
89
|
+
|
|
90
|
+
#: The node's internal ID
|
|
91
|
+
id: int
|
|
92
|
+
#: A set of labels associated with the node
|
|
93
|
+
labels: set[AnyStr]
|
|
94
|
+
#: Mapping of property names to values
|
|
95
|
+
properties: dict[AnyStr, ResponseType]
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
@dataclasses.dataclass
|
|
99
|
+
class GraphRelation(Generic[AnyStr]):
|
|
100
|
+
"""
|
|
101
|
+
Representation of a relation between two nodes
|
|
102
|
+
"""
|
|
103
|
+
|
|
104
|
+
#: The relationship's internal ID
|
|
105
|
+
id: int
|
|
106
|
+
#: Relation type
|
|
107
|
+
type: AnyStr
|
|
108
|
+
#: Source node ID
|
|
109
|
+
src_node: int
|
|
110
|
+
#: Destination node ID
|
|
111
|
+
destination_node: int
|
|
112
|
+
#: Mapping of all properties the relation possesses
|
|
113
|
+
properties: dict[AnyStr, ResponseType]
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
@dataclasses.dataclass
|
|
117
|
+
class GraphPath(Generic[AnyStr]):
|
|
118
|
+
"""
|
|
119
|
+
Representation of a graph path
|
|
120
|
+
"""
|
|
121
|
+
|
|
122
|
+
#: The nodes in the path
|
|
123
|
+
nodes: list[GraphNode[AnyStr]]
|
|
124
|
+
#: The relations in the path
|
|
125
|
+
relations: list[GraphRelation[AnyStr]]
|
|
126
|
+
|
|
127
|
+
NULL_NODE = GraphNode[AnyStr](0, set(), {})
|
|
128
|
+
|
|
129
|
+
@property
|
|
130
|
+
def path(self) -> tuple[GraphNode[AnyStr] | GraphRelation[AnyStr], ...]:
|
|
131
|
+
"""
|
|
132
|
+
The path as a tuple of nodes and relations
|
|
133
|
+
"""
|
|
134
|
+
if self.nodes and self.relations:
|
|
135
|
+
return tuple(
|
|
136
|
+
[
|
|
137
|
+
item
|
|
138
|
+
for pair in zip(self.nodes, self.relations + [self.NULL_NODE])
|
|
139
|
+
for item in pair
|
|
140
|
+
][:-1]
|
|
141
|
+
)
|
|
142
|
+
return ()
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
@dataclasses.dataclass
|
|
146
|
+
class GraphQueryResult(Generic[AnyStr]):
|
|
147
|
+
"""
|
|
148
|
+
Response from `GRAPH.QUERY <https://redis.io/commands/graph.query>`__
|
|
149
|
+
"""
|
|
150
|
+
|
|
151
|
+
#: List of entries in the response header
|
|
152
|
+
header: tuple[AnyStr, ...]
|
|
153
|
+
#: The result set from the query
|
|
154
|
+
result_set: tuple[
|
|
155
|
+
(
|
|
156
|
+
ResponsePrimitive
|
|
157
|
+
| list[
|
|
158
|
+
(ResponsePrimitive | GraphNode[AnyStr] | GraphRelation[AnyStr] | GraphPath[AnyStr])
|
|
159
|
+
]
|
|
160
|
+
),
|
|
161
|
+
...,
|
|
162
|
+
]
|
|
163
|
+
#: Mapping of query statistics
|
|
164
|
+
stats: dict[str, ResponsePrimitive]
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
class GraphSlowLogInfo(NamedTuple):
|
|
168
|
+
"""
|
|
169
|
+
Response from `GRAPH.SLOWLOG <https://redis.io/commands/graph.slowlog>`__
|
|
170
|
+
"""
|
|
171
|
+
|
|
172
|
+
#: The unix timestamp at which the logged command was processed.
|
|
173
|
+
start_time: int
|
|
174
|
+
#: The array composing the arguments of the command.
|
|
175
|
+
command: StringT
|
|
176
|
+
#: query name
|
|
177
|
+
query: StringT
|
|
178
|
+
#: The amount of time needed for its execution, in microseconds.
|
|
179
|
+
duration: float
|