Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.8/site-packages/redis/commands/redismodules.py: 30%
47 statements
« prev ^ index » next coverage.py v7.2.7, created at 2023-06-07 07:16 +0000
« prev ^ index » next coverage.py v7.2.7, created at 2023-06-07 07:16 +0000
1from json import JSONDecoder, JSONEncoder
4class RedisModuleCommands:
5 """This class contains the wrapper functions to bring supported redis
6 modules into the command namespace.
7 """
9 def json(self, encoder=JSONEncoder(), decoder=JSONDecoder()):
10 """Access the json namespace, providing support for redis json."""
12 from .json import JSON
14 jj = JSON(client=self, encoder=encoder, decoder=decoder)
15 return jj
17 def ft(self, index_name="idx"):
18 """Access the search namespace, providing support for redis search."""
20 from .search import Search
22 s = Search(client=self, index_name=index_name)
23 return s
25 def ts(self):
26 """Access the timeseries namespace, providing support for
27 redis timeseries data.
28 """
30 from .timeseries import TimeSeries
32 s = TimeSeries(client=self)
33 return s
35 def bf(self):
36 """Access the bloom namespace."""
38 from .bf import BFBloom
40 bf = BFBloom(client=self)
41 return bf
43 def cf(self):
44 """Access the bloom namespace."""
46 from .bf import CFBloom
48 cf = CFBloom(client=self)
49 return cf
51 def cms(self):
52 """Access the bloom namespace."""
54 from .bf import CMSBloom
56 cms = CMSBloom(client=self)
57 return cms
59 def topk(self):
60 """Access the bloom namespace."""
62 from .bf import TOPKBloom
64 topk = TOPKBloom(client=self)
65 return topk
67 def tdigest(self):
68 """Access the bloom namespace."""
70 from .bf import TDigestBloom
72 tdigest = TDigestBloom(client=self)
73 return tdigest
75 def graph(self, index_name="idx"):
76 """Access the graph namespace, providing support for
77 redis graph data.
78 """
80 from .graph import Graph
82 g = Graph(client=self, name=index_name)
83 return g
86class AsyncRedisModuleCommands(RedisModuleCommands):
87 def ft(self, index_name="idx"):
88 """Access the search namespace, providing support for redis search."""
90 from .search import AsyncSearch
92 s = AsyncSearch(client=self, index_name=index_name)
93 return s
95 def graph(self, index_name="idx"):
96 """Access the graph namespace, providing support for
97 redis graph data.
98 """
100 from .graph import AsyncGraph
102 g = AsyncGraph(client=self, name=index_name)
103 return g