py-libp2p/peer/id.py
ZX 8bcffb67cb WIP CI Build Errors (#76)
* ignore TODO and kademlia

* remove unnecessary pass

* fixed swarm warnings

* fixed peerdata_interface warnings

* fixed peer warnings

* fixed rest of linting errors

* trying to fix last error

* fixed dup errors
2018-11-26 18:24:29 -05:00

18 lines
372 B
Python

import base58
class ID:
def __init__(self, id_str):
self._id_str = id_str
def pretty(self):
return base58.b58encode(self._id_str).decode()
def __str__(self):
pid = self.pretty()
if len(pid) <= 10:
return "<peer.ID %s>" % pid
return "<peer.ID %s*%s>" % (pid[:2], pid[len(pid)-6:])
__repr__ = __str__