diff --git a/libp2p/__init__.py b/libp2p/__init__.py index d83ec3c..62e014b 100644 --- a/libp2p/__init__.py +++ b/libp2p/__init__.py @@ -35,7 +35,7 @@ def initialize_default_swarm( :param peerstore_opt: optional peerstore :return: return a default swarm instance """ - # pylint: disable=too-many-arguments + # pylint: disable=too-many-arguments, unused-argument if not id_opt: new_key = RSA.generate(2048, e=65537) id_opt = id_from_public_key(new_key.publickey()) diff --git a/tests/libp2p/test_libp2p.py b/tests/libp2p/test_libp2p.py index 3d74516..e9bfb83 100644 --- a/tests/libp2p/test_libp2p.py +++ b/tests/libp2p/test_libp2p.py @@ -2,7 +2,6 @@ import multiaddr import pytest from tests.utils import cleanup, set_up_nodes_by_transport_opt -from libp2p import new_node from libp2p.peer.peerinfo import info_from_p2p_addr @@ -10,7 +9,7 @@ from libp2p.peer.peerinfo import info_from_p2p_addr @pytest.mark.asyncio async def test_simple_messages(): transport_opt_list = [["/ip4/127.0.0.1/tcp/0"], ["/ip4/127.0.0.1/tcp/0"]] - (node_a, node_b) = await set_up_nodes_by_transport_opt(transport_opt_list) + (node_a, node_b) = await set_up_nodes_by_transport_opt(transport_opt_list) async def stream_handler(stream): while True: diff --git a/tests/libp2p/test_notify.py b/tests/libp2p/test_notify.py index edaba2f..71b455b 100644 --- a/tests/libp2p/test_notify.py +++ b/tests/libp2p/test_notify.py @@ -10,8 +10,11 @@ features are implemented in swarm """ import pytest +import multiaddr -from tests.utils import * + +from tests.utils import cleanup, echo_stream_handler, \ + perform_two_host_set_up_custom_handler from libp2p import new_node, initialize_default_swarm from libp2p.network.notifee_interface import INotifee from libp2p.host.basic_host import BasicHost @@ -39,11 +42,11 @@ class MyNotifee(INotifee): async def disconnected(self, network, conn): pass - async def listen(self, network, multiaddr): + async def listen(self, network, _multiaddr): self.events.append(["listened" + self.val_to_append_to_event,\ - multiaddr]) + _multiaddr]) - async def listen_close(self, network, multiaddr): + async def listen_close(self, network, _multiaddr): pass class InvalidNotifee(): diff --git a/tests/protocol_muxer/test_protocol_muxer.py b/tests/protocol_muxer/test_protocol_muxer.py index 1eff211..00949fa 100644 --- a/tests/protocol_muxer/test_protocol_muxer.py +++ b/tests/protocol_muxer/test_protocol_muxer.py @@ -1,7 +1,6 @@ import pytest from tests.utils import cleanup, set_up_nodes_by_transport_opt -from libp2p import new_node from libp2p.protocol_muxer.multiselect_client import MultiselectClientError # TODO: Add tests for multiple streams being opened on different @@ -16,7 +15,7 @@ from libp2p.protocol_muxer.multiselect_client import MultiselectClientError async def perform_simple_test(expected_selected_protocol, protocols_for_client, protocols_with_handlers): transport_opt_list = [["/ip4/127.0.0.1/tcp/0"], ["/ip4/127.0.0.1/tcp/0"]] - (node_a, node_b) = await set_up_nodes_by_transport_opt(transport_opt_list) + (node_a, node_b) = await set_up_nodes_by_transport_opt(transport_opt_list) async def stream_handler(stream): while True: diff --git a/tests/utils.py b/tests/utils.py index 28f217e..4efde83 100644 --- a/tests/utils.py +++ b/tests/utils.py @@ -32,10 +32,10 @@ async def echo_stream_handler(stream): async def perform_two_host_set_up_custom_handler(handler): transport_opt_list = [["/ip4/127.0.0.1/tcp/0"], ["/ip4/127.0.0.1/tcp/0"]] - (node_a, node_b) = await set_up_nodes_by_transport_opt(transport_opt_list) + (node_a, node_b) = await set_up_nodes_by_transport_opt(transport_opt_list) node_b.set_stream_handler("/echo/1.0.0", handler) # Associate the peer with local ip address (see default parameters of Libp2p()) node_a.get_peerstore().add_addrs(node_b.get_id(), node_b.get_addrs(), 10) - return node_a, node_b \ No newline at end of file + return node_a, node_b