Clean up peer.ID

This commit is contained in:
Alex Stokes 2019-08-13 18:18:29 -07:00
parent c40314a043
commit f9e859a8e9
No known key found for this signature in database
GPG Key ID: 51CE1721B245C086

View File

@ -28,10 +28,10 @@ class ID:
self._b58_str = base58.b58encode(self._bytes).decode() self._b58_str = base58.b58encode(self._bytes).decode()
return self._b58_str return self._b58_str
def __bytes__(self) -> bytes: def __repr__(self) -> str:
return self._bytes return "<libp2p.peer.id.ID 0x" + self._bytes.hex() + ">"
__repr__ = __str__ = pretty = to_string = to_base58 __str__ = pretty = to_string = to_base58
def __eq__(self, other: object) -> bool: def __eq__(self, other: object) -> bool:
if isinstance(other, str): if isinstance(other, str):