diff --git a/examples/chat/chat.py b/examples/chat/chat.py index b16c8fb..186df40 100755 --- a/examples/chat/chat.py +++ b/examples/chat/chat.py @@ -53,9 +53,10 @@ async def run(port, destination, localhost): print( f"Run 'python ./examples/chat/chat.py" + localhost_opt - + f" -p {int(port) + 1} -d /ip4/{ip}/tcp/{port}/p2p/{host.get_id().pretty()}' on another console.\n" + + f" -p {int(port) + 1} -d /ip4/{ip}/tcp/{port}/p2p/{host.get_id().pretty()}'" + + " on another console." ) - print("\nWaiting for incoming connection\n\n") + print("Waiting for incoming connection...") else: # its the client maddr = multiaddr.Multiaddr(destination) diff --git a/libp2p/pubsub/pubsub.py b/libp2p/pubsub/pubsub.py index 87019e1..9c04112 100644 --- a/libp2p/pubsub/pubsub.py +++ b/libp2p/pubsub/pubsub.py @@ -143,7 +143,7 @@ class Pubsub: # NOTE: Check if `rpc_incoming.control` is set through `HasField`. # This is necessary because `control` is an optional field in pb2. - # Ref: https://developers.google.com/protocol-buffers/docs/reference/python-generated#singular-fields-proto2 + # Ref: https://developers.google.com/protocol-buffers/docs/reference/python-generated#singular-fields-proto2 # noqa: E501 if rpc_incoming.HasField("control"): # Pass rpc to router so router could perform custom logic await self.router.handle_rpc(rpc_incoming, peer_id) diff --git a/tests/peer/test_peerinfo.py b/tests/peer/test_peerinfo.py index dc4f6cd..02d6c48 100644 --- a/tests/peer/test_peerinfo.py +++ b/tests/peer/test_peerinfo.py @@ -8,6 +8,7 @@ from libp2p.peer.peerdata import PeerData from libp2p.peer.peerinfo import InvalidAddrError, PeerInfo, info_from_p2p_addr ALPHABETS = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz" +VALID_MULTI_ADDR_STR = "/ip4/127.0.0.1/tcp/8000/p2p/3YgLAeMKSAPcGqZkAt8mREqhQXmJT8SN8VCMN4T6ih4GNX9wvK8mWJnWZ1qA2mLdCQ" # noqa: E501 def test_init_(): @@ -47,9 +48,7 @@ def test_info_from_p2p_addr_invalid(addr): def test_info_from_p2p_addr_valid(): - m_addr = multiaddr.Multiaddr( - "/ip4/127.0.0.1/tcp/8000/p2p/3YgLAeMKSAPcGqZkAt8mREqhQXmJT8SN8VCMN4T6ih4GNX9wvK8mWJnWZ1qA2mLdCQ" - ) + m_addr = multiaddr.Multiaddr(VALID_MULTI_ADDR_STR) info = info_from_p2p_addr(m_addr) assert ( info.peer_id.pretty()