MCPcopy
hub / github.com/redis/redis-py / _register_module_callbacks

Method _register_module_callbacks

redis/commands/search/__init__.py:188–214  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

186 self._register_module_callbacks()
187
188 def _register_module_callbacks(self):
189 # Pipeline post-processing matches the pre-migration behavior:
190 # legacy mode returns raw pipeline responses like v8.0.0b1. The
191 # default connection now uses RESP3 on the wire, so it gets a small
192 # adapter for the old raw RESP2 pipeline shape; explicit RESP3 keeps
193 # the previous native shape, with HYBRID's experimental normalizer.
194 # Only ``legacy_responses=False`` registers the unified parsers that
195 # post-process every response.
196 protocol = get_protocol_version(self)
197 if get_legacy_responses(self):
198 if protocol is None:
199 cmd_callbacks = self._RESP3_TO_RESP2_LEGACY_PIPELINE_CALLBACKS
200 elif check_protocol_version(protocol, 3):
201 cmd_callbacks = self._RESP3_MODULE_CALLBACKS
202 else:
203 cmd_callbacks = {}
204 else:
205 if check_protocol_version(protocol, 3):
206 cmd_callbacks = self._RESP3_UNIFIED_MODULE_CALLBACKS
207 else:
208 cmd_callbacks = self._RESP2_UNIFIED_MODULE_CALLBACKS
209 for cmd, cb in cmd_callbacks.items():
210 self.response_callbacks[cmd] = cb
211 # ``FT.CURSOR`` shares the AGGREGATE parser but isn't in the maps.
212 agg_cb = cmd_callbacks.get(AGGREGATE_CMD)
213 if agg_cb is not None:
214 self.response_callbacks[CURSOR_CMD] = agg_cb
215
216 @property
217 def client(self):

Callers 2

__init__Method · 0.95
__init__Method · 0.80

Calls 4

check_protocol_versionFunction · 0.85
get_protocol_versionFunction · 0.50
get_legacy_responsesFunction · 0.50
getMethod · 0.45

Tested by

no test coverage detected