1
+ from __future__ import annotations
2
+
1
3
from json import JSONDecoder , JSONEncoder
4
+ from typing import TYPE_CHECKING
5
+
6
+ if TYPE_CHECKING :
7
+ from .bf import BFBloom , CFBloom , CMSBloom , TDigestBloom , TOPKBloom
8
+ from .json import JSON
9
+ from .search import AsyncSearch , Search
10
+ from .timeseries import TimeSeries
11
+ from .vectorset import VectorSet
2
12
3
13
4
14
class RedisModuleCommands :
5
15
"""This class contains the wrapper functions to bring supported redis
6
16
modules into the command namespace.
7
17
"""
8
18
9
- def json (self , encoder = JSONEncoder (), decoder = JSONDecoder ()):
19
+ def json (self , encoder = JSONEncoder (), decoder = JSONDecoder ()) -> JSON :
10
20
"""Access the json namespace, providing support for redis json."""
11
21
12
22
from .json import JSON
13
23
14
24
jj = JSON (client = self , encoder = encoder , decoder = decoder )
15
25
return jj
16
26
17
- def ft (self , index_name = "idx" ):
27
+ def ft (self , index_name = "idx" ) -> Search :
18
28
"""Access the search namespace, providing support for redis search."""
19
29
20
30
from .search import Search
21
31
22
32
s = Search (client = self , index_name = index_name )
23
33
return s
24
34
25
- def ts (self ):
35
+ def ts (self ) -> TimeSeries :
26
36
"""Access the timeseries namespace, providing support for
27
37
redis timeseries data.
28
38
"""
@@ -32,47 +42,47 @@ def ts(self):
32
42
s = TimeSeries (client = self )
33
43
return s
34
44
35
- def bf (self ):
45
+ def bf (self ) -> BFBloom :
36
46
"""Access the bloom namespace."""
37
47
38
48
from .bf import BFBloom
39
49
40
50
bf = BFBloom (client = self )
41
51
return bf
42
52
43
- def cf (self ):
53
+ def cf (self ) -> CFBloom :
44
54
"""Access the bloom namespace."""
45
55
46
56
from .bf import CFBloom
47
57
48
58
cf = CFBloom (client = self )
49
59
return cf
50
60
51
- def cms (self ):
61
+ def cms (self ) -> CMSBloom :
52
62
"""Access the bloom namespace."""
53
63
54
64
from .bf import CMSBloom
55
65
56
66
cms = CMSBloom (client = self )
57
67
return cms
58
68
59
- def topk (self ):
69
+ def topk (self ) -> TOPKBloom :
60
70
"""Access the bloom namespace."""
61
71
62
72
from .bf import TOPKBloom
63
73
64
74
topk = TOPKBloom (client = self )
65
75
return topk
66
76
67
- def tdigest (self ):
77
+ def tdigest (self ) -> TDigestBloom :
68
78
"""Access the bloom namespace."""
69
79
70
80
from .bf import TDigestBloom
71
81
72
82
tdigest = TDigestBloom (client = self )
73
83
return tdigest
74
84
75
- def vset (self ):
85
+ def vset (self ) -> VectorSet :
76
86
"""Access the VectorSet commands namespace."""
77
87
78
88
from .vectorset import VectorSet
@@ -82,7 +92,7 @@ def vset(self):
82
92
83
93
84
94
class AsyncRedisModuleCommands (RedisModuleCommands ):
85
- def ft (self , index_name = "idx" ):
95
+ def ft (self , index_name = "idx" ) -> AsyncSearch :
86
96
"""Access the search namespace, providing support for redis search."""
87
97
88
98
from .search import AsyncSearch
0 commit comments