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

Function _get_raw_protocol

tests/conftest.py:819–830  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

817
818
819def _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
833def get_protocol_version(r):

Callers 2

get_protocol_versionFunction · 0.85
expected_response_shapeFunction · 0.85

Calls 1

getMethod · 0.45

Tested by

no test coverage detected