Skip to content

Commit bb3ae02

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

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
@@ -2437,6 +2437,16 @@ def __init__(self, args, options=None, position=None):
24372437
self.node = None
24382438
self.asking = False
24392439

2440+
def __repr__(self):
2441+
return (
2442+
f"{self.__class__.__name__}<"
2443+
f"args={repr(self.args)},"
2444+
f"options={repr(self.options)},"
2445+
f"position={self.position},"
2446+
f"result={repr(self.result)}"
2447+
">"
2448+
)
2449+
24402450

24412451
class NodeCommands:
24422452
""" """
@@ -2448,6 +2458,14 @@ def __init__(self, parse_response, connection_pool, connection):
24482458
self.connection = connection
24492459
self.commands = []
24502460

2461+
def __repr__(self):
2462+
return (
2463+
f"{self.__class__.__name__}<"
2464+
f"connection={repr(self.connection)},"
2465+
f"commands={repr(self.commands)}"
2466+
">"
2467+
)
2468+
24512469
def append(self, c):
24522470
""" """
24532471
self.commands.append(c)

0 commit comments

Comments
 (0)