Return the raw ``protocol`` from ``connection_kwargs`` (no default). Returns ``None`` when the caller did not pin a protocol value, which is distinct from the wire version the connection eventually negotiates (see :func:`get_protocol_version`).
(r)
| 817 | |
| 818 | |
| 819 | def _get_raw_protocol(r): |
| 820 | """Return the raw ``protocol`` from ``connection_kwargs`` (no default). |
| 821 | |
| 822 | Returns ``None`` when the caller did not pin a protocol value, which |
| 823 | is distinct from the wire version the connection eventually |
| 824 | negotiates (see :func:`get_protocol_version`). |
| 825 | """ |
| 826 | if isinstance(r, redis.Redis) or isinstance(r, redis.asyncio.Redis): |
| 827 | return r.connection_pool.connection_kwargs.get("protocol") |
| 828 | elif isinstance(r, redis.cluster.AbstractRedisCluster): |
| 829 | return r.nodes_manager.connection_kwargs.get("protocol") |
| 830 | return None |
| 831 | |
| 832 | |
| 833 | def get_protocol_version(r): |
no test coverage detected