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

Function expected_response_shape

tests/conftest.py:855–873  ·  view source on GitHub ↗

Return the expected Python response shape for ``r``. One of: * ``"legacy_resp2"`` — native RESP2 wire, or RESP3 wire normalised by the legacy adapters back to RESP2 Python shapes. * ``"legacy_resp3"`` — Python shapes from the previous RESP3 callbacks, produced when the call

(r)

Source from the content-addressed store, hash-verified

853
854
855def expected_response_shape(r):
856 """Return the expected Python response shape for ``r``.
857
858 One of:
859
860 * ``"legacy_resp2"`` — native RESP2 wire, or RESP3 wire normalised by
861 the legacy adapters back to RESP2 Python shapes.
862 * ``"legacy_resp3"`` — Python shapes from the previous RESP3 callbacks,
863 produced when the caller pinned ``protocol=3`` with
864 ``legacy_responses=True``.
865 * ``"unified"`` — protocol-agnostic unified Python shapes selected by
866 ``legacy_responses=False``.
867 """
868 if not get_legacy_responses(r):
869 return "unified"
870 raw_protocol = _get_raw_protocol(r)
871 if raw_protocol is None or raw_protocol in ("2", 2):
872 return "legacy_resp2"
873 return "legacy_resp3"
874
875
876def expects_resp2_shape(r):

Calls 2

_get_raw_protocolFunction · 0.85
get_legacy_responsesFunction · 0.70

Tested by

no test coverage detected