Parses a response from the Redis server
(
self, connection: Connection, command_name: Union[str, bytes], **options
)
| 871 | await pool.release(conn) |
| 872 | |
| 873 | async def parse_response( |
| 874 | self, connection: Connection, command_name: Union[str, bytes], **options |
| 875 | ): |
| 876 | """Parses a response from the Redis server""" |
| 877 | try: |
| 878 | if NEVER_DECODE in options: |
| 879 | response = await connection.read_response(disable_decoding=True) |
| 880 | options.pop(NEVER_DECODE) |
| 881 | else: |
| 882 | response = await connection.read_response() |
| 883 | except ResponseError: |
| 884 | if EMPTY_RESPONSE in options: |
| 885 | return options[EMPTY_RESPONSE] |
| 886 | raise |
| 887 | |
| 888 | if EMPTY_RESPONSE in options: |
| 889 | options.pop(EMPTY_RESPONSE) |
| 890 | |
| 891 | # Remove keys entry, it needs only for cache. |
| 892 | options.pop("keys", None) |
| 893 | |
| 894 | if command_name in self.response_callbacks: |
| 895 | # Mypy bug: https://github.com/python/mypy/issues/10977 |
| 896 | command_name = cast(str, command_name) |
| 897 | retval = self.response_callbacks[command_name](response, **options) |
| 898 | return await retval if inspect.isawaitable(retval) else retval |
| 899 | return response |
| 900 | |
| 901 | |
| 902 | StrictRedis = Redis |
no test coverage detected