Return the user-supplied ``legacy_responses`` flag for ``client``. Defaults to ``True`` when the flag is not present in the client's ``connection_kwargs``. Mirrors :func:`get_protocol_version` so module command bases can read both the protocol and the response-shape selection from t
(client)
| 133 | |
| 134 | |
| 135 | def get_legacy_responses(client): |
| 136 | """Return the user-supplied ``legacy_responses`` flag for ``client``. |
| 137 | |
| 138 | Defaults to ``True`` when the flag is not present in the client's |
| 139 | ``connection_kwargs``. Mirrors :func:`get_protocol_version` so module |
| 140 | command bases can read both the protocol and the response-shape |
| 141 | selection from the same place. |
| 142 | """ |
| 143 | if isinstance(client, redis.Redis) or isinstance(client, redis.asyncio.Redis): |
| 144 | return client.connection_pool.connection_kwargs.get("legacy_responses", True) |
| 145 | elif isinstance(client, redis.cluster.AbstractRedisCluster): |
| 146 | return client.nodes_manager.connection_kwargs.get("legacy_responses", True) |
| 147 | return True |
| 148 | |
| 149 | |
| 150 | def apply_module_callbacks( |
no test coverage detected