Skip to content

[GROW-3262] add __repr__ to RedisCluster objects #15

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 4, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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