From 53ad951c11d05f658d5cc394a3afcc5867a8e58c Mon Sep 17 00:00:00 2001 From: Brian Warner Date: Sun, 10 Feb 2019 16:57:16 -0800 Subject: [PATCH] DilatedConnectionProtocol/Role: prettier repr --- src/wormhole/_dilation/connection.py | 10 +++++----- src/wormhole/_dilation/roles.py | 8 +++++++- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/wormhole/_dilation/connection.py b/src/wormhole/_dilation/connection.py index 36e7211..8bb82aa 100644 --- a/src/wormhole/_dilation/connection.py +++ b/src/wormhole/_dilation/connection.py @@ -473,13 +473,13 @@ class DilatedConnectionProtocol(Protocol, object): At any given time, there is at most one active L2 connection. """ - _eventual_queue = attrib() + _eventual_queue = attrib(repr=False) _role = attrib() _description = attrib() - _connector = attrib(validator=provides(IDilationConnector)) - _noise = attrib() - _outbound_prologue = attrib(validator=instance_of(bytes)) - _inbound_prologue = attrib(validator=instance_of(bytes)) + _connector = attrib(validator=provides(IDilationConnector), repr=False) + _noise = attrib(repr=False) + _outbound_prologue = attrib(validator=instance_of(bytes), repr=False) + _inbound_prologue = attrib(validator=instance_of(bytes), repr=False) _use_relay = False _relay_handshake = None diff --git a/src/wormhole/_dilation/roles.py b/src/wormhole/_dilation/roles.py index 8f9adac..001566b 100644 --- a/src/wormhole/_dilation/roles.py +++ b/src/wormhole/_dilation/roles.py @@ -1 +1,7 @@ -LEADER, FOLLOWER = object(), object() +class _Role(object): + def __init__(self, which): + self._which = which + def __repr__(self): + return "Role(%s)" % self._which + +LEADER, FOLLOWER = _Role("LEADER"), _Role("FOLLOWER")