Skip to content

Commit fa53343

Browse files
committed
[GROW-3262] add __repr__ to RedisCluster objects (#15)
1 parent 0786195 commit fa53343

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

redis/cluster.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2396,6 +2396,16 @@ def __init__(self, args, options=None, position=None):
23962396
self.node = None
23972397
self.asking = False
23982398

2399+
def __repr__(self):
2400+
return (
2401+
f"{self.__class__.__name__}<"
2402+
f"args={repr(self.args)},"
2403+
f"options={repr(self.options)},"
2404+
f"position={self.position},"
2405+
f"result={repr(self.result)}"
2406+
">"
2407+
)
2408+
23992409

24002410
class NodeCommands:
24012411
""" """
@@ -2407,6 +2417,14 @@ def __init__(self, parse_response, connection_pool, connection):
24072417
self.connection = connection
24082418
self.commands = []
24092419

2420+
def __repr__(self):
2421+
return (
2422+
f"{self.__class__.__name__}<"
2423+
f"connection={repr(self.connection)},"
2424+
f"commands={repr(self.commands)}"
2425+
">"
2426+
)
2427+
24102428
def append(self, c):
24112429
""" """
24122430
self.commands.append(c)

0 commit comments

Comments
 (0)