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

1from json import JSONDecoder, JSONEncoder 

2 

3 

4class RedisModuleCommands: 

5 """This class contains the wrapper functions to bring supported redis 

6 modules into the command namespace. 

7 """ 

8 

9 def json(self, encoder=JSONEncoder(), decoder=JSONDecoder()): 

10 """Access the json namespace, providing support for redis json.""" 

11 

12 from .json import JSON 

13 

14 jj = JSON(client=self, encoder=encoder, decoder=decoder) 

15 return jj 

16 

17 def ft(self, index_name="idx"): 

18 """Access the search namespace, providing support for redis search.""" 

19 

20 from .search import Search 

21 

22 s = Search(client=self, index_name=index_name) 

23 return s 

24 

25 def ts(self): 

26 """Access the timeseries namespace, providing support for 

27 redis timeseries data. 

28 """ 

29 

30 from .timeseries import TimeSeries 

31 

32 s = TimeSeries(client=self) 

33 return s 

34 

35 def bf(self): 

36 """Access the bloom namespace.""" 

37 

38 from .bf import BFBloom 

39 

40 bf = BFBloom(client=self) 

41 return bf 

42 

43 def cf(self): 

44 """Access the bloom namespace.""" 

45 

46 from .bf import CFBloom 

47 

48 cf = CFBloom(client=self) 

49 return cf 

50 

51 def cms(self): 

52 """Access the bloom namespace.""" 

53 

54 from .bf import CMSBloom 

55 

56 cms = CMSBloom(client=self) 

57 return cms 

58 

59 def topk(self): 

60 """Access the bloom namespace.""" 

61 

62 from .bf import TOPKBloom 

63 

64 topk = TOPKBloom(client=self) 

65 return topk 

66 

67 def tdigest(self): 

68 """Access the bloom namespace.""" 

69 

70 from .bf import TDigestBloom 

71 

72 tdigest = TDigestBloom(client=self) 

73 return tdigest 

74 

75 def graph(self, index_name="idx"): 

76 """Access the graph namespace, providing support for 

77 redis graph data. 

78 """ 

79 

80 from .graph import Graph 

81 

82 g = Graph(client=self, name=index_name) 

83 return g 

84 

85 

86class AsyncRedisModuleCommands(RedisModuleCommands): 

87 def ft(self, index_name="idx"): 

88 """Access the search namespace, providing support for redis search.""" 

89 

90 from .search import AsyncSearch 

91 

92 s = AsyncSearch(client=self, index_name=index_name) 

93 return s 

94 

95 def graph(self, index_name="idx"): 

96 """Access the graph namespace, providing support for 

97 redis graph data. 

98 """ 

99 

100 from .graph import AsyncGraph 

101 

102 g = AsyncGraph(client=self, name=index_name) 

103 return g