mirror of
https://github.com/varun-r-mallya/py-libp2p.git
synced 2026-02-10 23:20:55 +00:00
style: enforce consistent import block
This commit is contained in:
@ -1,12 +1,9 @@
|
|||||||
|
import functools
|
||||||
import hashlib
|
import hashlib
|
||||||
|
|
||||||
import base58
|
import base58
|
||||||
import multihash
|
import multihash
|
||||||
|
|
||||||
from functools import (
|
|
||||||
cached_property,
|
|
||||||
)
|
|
||||||
|
|
||||||
from libp2p.crypto.keys import (
|
from libp2p.crypto.keys import (
|
||||||
PublicKey,
|
PublicKey,
|
||||||
)
|
)
|
||||||
@ -44,11 +41,11 @@ class ID:
|
|||||||
def __init__(self, peer_id_bytes: bytes) -> None:
|
def __init__(self, peer_id_bytes: bytes) -> None:
|
||||||
self._bytes = peer_id_bytes
|
self._bytes = peer_id_bytes
|
||||||
|
|
||||||
@cached_property
|
@functools.cached_property
|
||||||
def xor_id(self) -> int:
|
def xor_id(self) -> int:
|
||||||
return int(sha256_digest(self._bytes).hex(), 16)
|
return int(sha256_digest(self._bytes).hex(), 16)
|
||||||
|
|
||||||
@cached_property
|
@functools.cached_property
|
||||||
def base58(self) -> str:
|
def base58(self) -> str:
|
||||||
return base58.b58encode(self._bytes).decode()
|
return base58.b58encode(self._bytes).decode()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user