DilatedConnectionProtocol/Role: prettier repr

This commit is contained in:
Brian Warner 2019-02-10 16:57:16 -08:00
parent ebc63e52e0
commit 53ad951c11
2 changed files with 12 additions and 6 deletions

View File

@ -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

View File

@ -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")