remove friendly IDs
This commit is contained in:
parent
2d1d3d0136
commit
50ae439d20
|
@ -6,11 +6,6 @@ import multihash
|
||||||
|
|
||||||
from libp2p.crypto.keys import PublicKey
|
from libp2p.crypto.keys import PublicKey
|
||||||
|
|
||||||
# NOTE: ``FRIENDLY_IDS`` renders a ``str`` representation of ``ID`` as a
|
|
||||||
# short string of a prefix of the base58 representation. This feature is primarily
|
|
||||||
# intended for debugging, logging, etc.
|
|
||||||
FRIENDLY_IDS = True
|
|
||||||
|
|
||||||
# NOTE: On inlining...
|
# NOTE: On inlining...
|
||||||
# See: https://github.com/libp2p/specs/issues/138
|
# See: https://github.com/libp2p/specs/issues/138
|
||||||
# NOTE: enabling to be interoperable w/ the Go implementation
|
# NOTE: enabling to be interoperable w/ the Go implementation
|
||||||
|
@ -61,15 +56,9 @@ class ID:
|
||||||
return self._b58_str
|
return self._b58_str
|
||||||
|
|
||||||
def __repr__(self) -> str:
|
def __repr__(self) -> str:
|
||||||
return "<libp2p.peer.id.ID 0x" + self._bytes.hex() + ">"
|
return f"<libp2p.peer.id.ID ({self.to_string()})>"
|
||||||
|
|
||||||
pretty = to_string = to_base58
|
__str__ = pretty = to_string = to_base58
|
||||||
|
|
||||||
def __str__(self) -> str:
|
|
||||||
if FRIENDLY_IDS:
|
|
||||||
return f"<peer.ID {self.to_string()[2:8]}>"
|
|
||||||
else:
|
|
||||||
return self.to_string()
|
|
||||||
|
|
||||||
def __eq__(self, other: object) -> bool:
|
def __eq__(self, other: object) -> bool:
|
||||||
if isinstance(other, str):
|
if isinstance(other, str):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user