1+ from __future__ import annotations
2+
13from 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
212
313
414class RedisModuleCommands :
515 """This class contains the wrapper functions to bring supported redis
616 modules into the command namespace.
717 """
818
9- def json (self , encoder = JSONEncoder (), decoder = JSONDecoder ()):
19+ def json (self , encoder = JSONEncoder (), decoder = JSONDecoder ()) -> JSON :
1020 """Access the json namespace, providing support for redis json."""
1121
1222 from .json import JSON
1323
1424 jj = JSON (client = self , encoder = encoder , decoder = decoder )
1525 return jj
1626
17- def ft (self , index_name = "idx" ):
27+ def ft (self , index_name = "idx" ) -> Search :
1828 """Access the search namespace, providing support for redis search."""
1929
2030 from .search import Search
2131
2232 s = Search (client = self , index_name = index_name )
2333 return s
2434
25- def ts (self ):
35+ def ts (self ) -> TimeSeries :
2636 """Access the timeseries namespace, providing support for
2737 redis timeseries data.
2838 """
@@ -32,47 +42,47 @@ def ts(self):
3242 s = TimeSeries (client = self )
3343 return s
3444
35- def bf (self ):
45+ def bf (self ) -> BFBloom :
3646 """Access the bloom namespace."""
3747
3848 from .bf import BFBloom
3949
4050 bf = BFBloom (client = self )
4151 return bf
4252
43- def cf (self ):
53+ def cf (self ) -> CFBloom :
4454 """Access the bloom namespace."""
4555
4656 from .bf import CFBloom
4757
4858 cf = CFBloom (client = self )
4959 return cf
5060
51- def cms (self ):
61+ def cms (self ) -> CMSBloom :
5262 """Access the bloom namespace."""
5363
5464 from .bf import CMSBloom
5565
5666 cms = CMSBloom (client = self )
5767 return cms
5868
59- def topk (self ):
69+ def topk (self ) -> TOPKBloom :
6070 """Access the bloom namespace."""
6171
6272 from .bf import TOPKBloom
6373
6474 topk = TOPKBloom (client = self )
6575 return topk
6676
67- def tdigest (self ):
77+ def tdigest (self ) -> TDigestBloom :
6878 """Access the bloom namespace."""
6979
7080 from .bf import TDigestBloom
7181
7282 tdigest = TDigestBloom (client = self )
7383 return tdigest
7484
75- def vset (self ):
85+ def vset (self ) -> VectorSet :
7686 """Access the VectorSet commands namespace."""
7787
7888 from .vectorset import VectorSet
@@ -82,7 +92,7 @@ def vset(self):
8292
8393
8494class AsyncRedisModuleCommands (RedisModuleCommands ):
85- def ft (self , index_name = "idx" ):
95+ def ft (self , index_name = "idx" ) -> AsyncSearch :
8696 """Access the search namespace, providing support for redis search."""
8797
8898 from .search import AsyncSearch
0 commit comments