Added equality check for Connection class (#938)

* Added equality check for Connection class

* ES: make connection hashable
This commit is contained in:
svalee
2019-05-15 18:25:58 -04:00
committed by Nick Lang
parent 8ab66b9bde
commit b6fe0d424f
+10
View File
@@ -56,6 +56,16 @@ class Connection(object):
def __repr__(self):
return "<%s: %s>" % (self.__class__.__name__, self.host)
def __eq__(self, other):
if not isinstance(other, Connection):
raise TypeError(
"Unsupported equality check for %s and %s" % (self, other)
)
return True
def __hash__(self):
return id(self)
def _pretty_json(self, data):
# pretty JSON in tracer curl logs
try: