From 16f87bfa9961ddb804409d538e37184a61f33642 Mon Sep 17 00:00:00 2001 From: Zach Lee Date: Mon, 4 Sep 2023 11:44:10 +0900 Subject: [PATCH] [GROW-3262] add __repr__ to RedisCluster objects (#15) --- redis/cluster.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/redis/cluster.py b/redis/cluster.py index 483b8ac6d2..8d21f05ab2 100644 --- a/redis/cluster.py +++ b/redis/cluster.py @@ -2341,6 +2341,16 @@ def __init__(self, args, options=None, position=None): self.node = None self.asking = False + def __repr__(self): + return ( + f"{self.__class__.__name__}<" + f"args={repr(self.args)}," + f"options={repr(self.options)}," + f"position={self.position}," + f"result={repr(self.result)}" + ">" + ) + class NodeCommands: """ """ @@ -2352,6 +2362,14 @@ def __init__(self, parse_response, connection_pool, connection): self.connection = connection self.commands = [] + def __repr__(self): + return ( + f"{self.__class__.__name__}<" + f"connection={repr(self.connection)}," + f"commands={repr(self.commands)}" + ">" + ) + def append(self, c): """ """ self.commands.append(c)