Create a new RedisBloom client.
(self, client, **kwargs)
| 236 | |
| 237 | class _TDigestBloomBase(TDigestCommands, AbstractBloom): |
| 238 | def __init__(self, client, **kwargs): |
| 239 | """Create a new RedisBloom client.""" |
| 240 | # Set the module commands' callbacks |
| 241 | _MODULE_CALLBACKS = { |
| 242 | TDIGEST_CREATE: bool_ok, |
| 243 | # TDIGEST_RESET: bool_ok, |
| 244 | # TDIGEST_ADD: spaceHolder, |
| 245 | # TDIGEST_MERGE: spaceHolder, |
| 246 | } |
| 247 | |
| 248 | _RESP2_MODULE_CALLBACKS = { |
| 249 | TDIGEST_BYRANK: parse_to_list, |
| 250 | TDIGEST_BYREVRANK: parse_to_list, |
| 251 | TDIGEST_CDF: parse_to_list, |
| 252 | TDIGEST_INFO: TDigestInfo, |
| 253 | TDIGEST_MIN: float, |
| 254 | TDIGEST_MAX: float, |
| 255 | TDIGEST_TRIMMED_MEAN: float, |
| 256 | TDIGEST_QUANTILE: parse_to_list, |
| 257 | } |
| 258 | _RESP3_MODULE_CALLBACKS = {} |
| 259 | _RESP2_UNIFIED_MODULE_CALLBACKS = dict(_RESP2_MODULE_CALLBACKS) |
| 260 | _RESP3_UNIFIED_MODULE_CALLBACKS = { |
| 261 | TDIGEST_BYRANK: parse_to_list, |
| 262 | TDIGEST_BYREVRANK: parse_to_list, |
| 263 | TDIGEST_CDF: parse_to_list, |
| 264 | TDIGEST_INFO: TDigestInfo, |
| 265 | TDIGEST_MIN: float, |
| 266 | TDIGEST_MAX: float, |
| 267 | TDIGEST_TRIMMED_MEAN: float, |
| 268 | TDIGEST_QUANTILE: parse_to_list, |
| 269 | } |
| 270 | _RESP3_TO_RESP2_LEGACY_MODULE_CALLBACKS = { |
| 271 | TDIGEST_INFO: TDigestInfo, |
| 272 | TDIGEST_MIN: float, |
| 273 | TDIGEST_MAX: float, |
| 274 | TDIGEST_TRIMMED_MEAN: float, |
| 275 | } |
| 276 | |
| 277 | self.client = client |
| 278 | self.commandmixin = TDigestCommands |
| 279 | self.execute_command = client.execute_command |
| 280 | |
| 281 | callbacks = apply_module_callbacks( |
| 282 | get_protocol_version(self.client), |
| 283 | get_legacy_responses(self.client), |
| 284 | common=_MODULE_CALLBACKS, |
| 285 | resp2=_RESP2_MODULE_CALLBACKS, |
| 286 | resp3=_RESP3_MODULE_CALLBACKS, |
| 287 | resp2_unified=_RESP2_UNIFIED_MODULE_CALLBACKS, |
| 288 | resp3_unified=_RESP3_UNIFIED_MODULE_CALLBACKS, |
| 289 | resp3_to_resp2_legacy=_RESP3_TO_RESP2_LEGACY_MODULE_CALLBACKS, |
| 290 | ) |
| 291 | |
| 292 | for k, v in callbacks.items(): |
| 293 | self.client.set_response_callback(k, v) |
| 294 | |
| 295 |
nothing calls this directly
no test coverage detected