Skip to content

Commit

Permalink
[GROW-3262] add __repr__ to RedisCluster objects (#15)
Browse files Browse the repository at this point in the history
  • Loading branch information
zach-iee authored Sep 4, 2023
1 parent d5533db commit 16f87bf
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions redis/cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
""" """
Expand All @@ -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)
Expand Down

0 comments on commit 16f87bf

Please sign in to comment.