style: enforce multiline import style for consistency

This commit is contained in:
Luca Vivona
2025-06-21 15:08:11 -04:00
parent 811c217ee6
commit ebdde7b5aa
3 changed files with 11 additions and 8 deletions

View File

@ -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 (

View File

@ -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

View File

@ -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