Skip to content

Commit 16f87bf

Browse files
authored
[GROW-3262] add __repr__ to RedisCluster objects (#15)
1 parent d5533db commit 16f87bf

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
@@ -2341,6 +2341,16 @@ def __init__(self, args, options=None, position=None):
23412341
self.node = None
23422342
self.asking = False
23432343

2344+
def __repr__(self):
2345+
return (
2346+
f"{self.__class__.__name__}<"
2347+
f"args={repr(self.args)},"
2348+
f"options={repr(self.options)},"
2349+
f"position={self.position},"
2350+
f"result={repr(self.result)}"
2351+
">"
2352+
)
2353+
23442354

23452355
class NodeCommands:
23462356
""" """
@@ -2352,6 +2362,14 @@ def __init__(self, parse_response, connection_pool, connection):
23522362
self.connection = connection
23532363
self.commands = []
23542364

2365+
def __repr__(self):
2366+
return (
2367+
f"{self.__class__.__name__}<"
2368+
f"connection={repr(self.connection)},"
2369+
f"commands={repr(self.commands)}"
2370+
">"
2371+
)
2372+
23552373
def append(self, c):
23562374
""" """
23572375
self.commands.append(c)

0 commit comments

Comments
 (0)