mirror of
https://github.com/varun-r-mallya/py-libp2p.git
synced 2026-02-12 16:10:57 +00:00
style: apply ruff formatting fixes
This commit is contained in:
@ -63,13 +63,13 @@ The new API provides direct access to multiple connections:
|
|||||||
|
|
||||||
# Get all connections to a peer
|
# Get all connections to a peer
|
||||||
peer_connections = swarm.get_connections(peer_id)
|
peer_connections = swarm.get_connections(peer_id)
|
||||||
|
|
||||||
# Get all connections (across all peers)
|
# Get all connections (across all peers)
|
||||||
all_connections = swarm.get_connections()
|
all_connections = swarm.get_connections()
|
||||||
|
|
||||||
# Get the complete connections map
|
# Get the complete connections map
|
||||||
connections_map = swarm.get_connections_map()
|
connections_map = swarm.get_connections_map()
|
||||||
|
|
||||||
# Backward compatibility - get single connection
|
# Backward compatibility - get single connection
|
||||||
single_conn = swarm.get_connection(peer_id)
|
single_conn = swarm.get_connection(peer_id)
|
||||||
|
|
||||||
@ -82,7 +82,7 @@ Existing code continues to work through backward compatibility features:
|
|||||||
|
|
||||||
# Legacy 1:1 mapping (returns first connection for each peer)
|
# Legacy 1:1 mapping (returns first connection for each peer)
|
||||||
legacy_connections = swarm.connections_legacy
|
legacy_connections = swarm.connections_legacy
|
||||||
|
|
||||||
# Single connection access (returns first available connection)
|
# Single connection access (returns first available connection)
|
||||||
conn = swarm.get_connection(peer_id)
|
conn = swarm.get_connection(peer_id)
|
||||||
|
|
||||||
|
|||||||
@ -71,8 +71,7 @@ async def example_multiple_connections_api() -> None:
|
|||||||
logger.info("Demonstrating multiple connections API...")
|
logger.info("Demonstrating multiple connections API...")
|
||||||
|
|
||||||
connection_config = ConnectionConfig(
|
connection_config = ConnectionConfig(
|
||||||
max_connections_per_peer=3,
|
max_connections_per_peer=3, load_balancing_strategy="round_robin"
|
||||||
load_balancing_strategy="round_robin"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
swarm = new_swarm(connection_config=connection_config)
|
swarm = new_swarm(connection_config=connection_config)
|
||||||
|
|||||||
Reference in New Issue
Block a user