mirror of
https://github.com/varun-r-mallya/py-libp2p.git
synced 2025-12-31 20:36:24 +00:00
style: enforce multiline import style for consistency
This commit is contained in:
@ -1,5 +1,5 @@
|
|||||||
"""
|
"""
|
||||||
Common Objects for Kademlia DHT implementation.
|
Shared constants and protocol parameters for the Kademlia DHT.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from libp2p.custom_types import (
|
from libp2p.custom_types import (
|
||||||
|
|||||||
@ -5,7 +5,9 @@ This module provides a complete Distributed Hash Table (DHT)
|
|||||||
implementation based on the Kademlia algorithm and protocol.
|
implementation based on the Kademlia algorithm and protocol.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from enum import Enum
|
from enum import (
|
||||||
|
Enum,
|
||||||
|
)
|
||||||
import logging
|
import logging
|
||||||
import time
|
import time
|
||||||
|
|
||||||
|
|||||||
@ -2,13 +2,17 @@
|
|||||||
Kademlia DHT routing table implementation.
|
Kademlia DHT routing table implementation.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from collections import OrderedDict
|
from collections import (
|
||||||
|
OrderedDict,
|
||||||
|
)
|
||||||
import logging
|
import logging
|
||||||
import time
|
import time
|
||||||
|
|
||||||
import trio
|
import trio
|
||||||
|
|
||||||
from libp2p.abc import IHost
|
from libp2p.abc import (
|
||||||
|
IHost,
|
||||||
|
)
|
||||||
from libp2p.kad_dht.utils import (
|
from libp2p.kad_dht.utils import (
|
||||||
xor_distance,
|
xor_distance,
|
||||||
)
|
)
|
||||||
@ -238,12 +242,9 @@ class KBucket:
|
|||||||
if not peer_info:
|
if not peer_info:
|
||||||
raise ValueError(f"Peer {peer_id} not in bucket")
|
raise ValueError(f"Peer {peer_id} not in bucket")
|
||||||
|
|
||||||
# Default protocol ID for Kademlia DHT
|
|
||||||
protocol_id = PROTOCOL_ID
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Open a stream to the peer with the DHT protocol
|
# Open a stream to the peer with the DHT protocol
|
||||||
stream = await self.host.new_stream(peer_id, [protocol_id])
|
stream = await self.host.new_stream(peer_id, [PROTOCOL_ID])
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Create ping protobuf message
|
# Create ping protobuf message
|
||||||
|
|||||||
Reference in New Issue
Block a user