From 760417ff3a21b4e1215fae6df7d54a5a2947592d Mon Sep 17 00:00:00 2001 From: Jack Robison Date: Wed, 23 May 2018 19:33:16 -0400 Subject: [PATCH] pylint --- lbrynet/core/Session.py | 1 - lbrynet/dht/contact.py | 2 +- lbrynet/dht/protocol.py | 4 ++-- lbrynet/dht/routingtable.py | 4 ++-- lbrynet/tests/functional/dht/test_contact_expiration.py | 2 +- lbrynet/tests/unit/dht/test_kbucket.py | 6 ++++-- lbrynet/tests/unit/dht/test_node.py | 5 +---- 7 files changed, 11 insertions(+), 13 deletions(-) diff --git a/lbrynet/core/Session.py b/lbrynet/core/Session.py index d05c49239..c2aefafc6 100644 --- a/lbrynet/core/Session.py +++ b/lbrynet/core/Session.py @@ -7,7 +7,6 @@ from lbrynet.database.storage import SQLiteStorage from lbrynet.core.RateLimiter import RateLimiter from lbrynet.core.utils import generate_id from lbrynet.core.PaymentRateManager import BasePaymentRateManager, OnlyFreePaymentsManager -from lbrynet.core.BlobAvailability import BlobAvailabilityTracker log = logging.getLogger(__name__) diff --git a/lbrynet/dht/contact.py b/lbrynet/dht/contact.py index 2ee26c678..9cf6eb67a 100644 --- a/lbrynet/dht/contact.py +++ b/lbrynet/dht/contact.py @@ -13,7 +13,7 @@ class _Contact(object): self._id = id if id is not None: if not len(id) == constants.key_bits / 8: - raise ValueError("invalid node id: %s", id.encode('hex')) + raise ValueError("invalid node id: %s" % id.encode('hex')) self.address = ipAddress self.port = udpPort self._networkProtocol = networkProtocol diff --git a/lbrynet/dht/protocol.py b/lbrynet/dht/protocol.py index 49325770c..536315c44 100644 --- a/lbrynet/dht/protocol.py +++ b/lbrynet/dht/protocol.py @@ -137,7 +137,7 @@ class KademliaProtocol(protocol.DatagramProtocol): log.debug("%s:%i SEND CALL %s(%s) TO %s:%i", self._node.externalIP, self._node.port, method, args[0].encode('hex'), contact.address, contact.port) else: - log.debug("%s:%i SEND CALL %s TO %s:%i", self._node.externalIP, self._node.port, method, + log.debug("%s:%i SEND CALL %s TO %s:%i", self._node.externalIP, self._node.port, method, contact.address, contact.port) df = defer.Deferred() @@ -395,7 +395,7 @@ class KademliaProtocol(protocol.DatagramProtocol): log.debug("%s:%i RECV CALL %s(%s) %s:%i", self._node.externalIP, self._node.port, method, args[0].encode('hex'), senderContact.address, senderContact.port) else: - log.debug("%s:%i RECV CALL %s %s:%i", self._node.externalIP, self._node.port, method, + log.debug("%s:%i RECV CALL %s %s:%i", self._node.externalIP, self._node.port, method, senderContact.address, senderContact.port) try: if method != 'ping': diff --git a/lbrynet/dht/routingtable.py b/lbrynet/dht/routingtable.py index 540871bb5..70713a927 100644 --- a/lbrynet/dht/routingtable.py +++ b/lbrynet/dht/routingtable.py @@ -124,8 +124,8 @@ class TreeRoutingTable(object): """ failure.trap(TimeoutError) log.debug("Replacing dead contact in bucket %i: %s:%i (%s) with %s:%i (%s)", bucketIndex, - deadContact.address, deadContact.port, deadContact.log_id(), contact.address, contact.port, - contact.log_id()) + deadContact.address, deadContact.port, deadContact.log_id(), contact.address, + contact.port, contact.log_id()) try: self._buckets[bucketIndex].removeContact(deadContact) except ValueError: diff --git a/lbrynet/tests/functional/dht/test_contact_expiration.py b/lbrynet/tests/functional/dht/test_contact_expiration.py index f7f969b8f..57296b647 100644 --- a/lbrynet/tests/functional/dht/test_contact_expiration.py +++ b/lbrynet/tests/functional/dht/test_contact_expiration.py @@ -40,4 +40,4 @@ class TestPeerExpiration(TestKademliaBase): for seed_name in sorted(self.seed_dns.keys())])]) self.verify_all_nodes_are_routable() - self.verify_all_nodes_are_pingable() \ No newline at end of file + self.verify_all_nodes_are_pingable() diff --git a/lbrynet/tests/unit/dht/test_kbucket.py b/lbrynet/tests/unit/dht/test_kbucket.py index 2896076b8..100f63562 100644 --- a/lbrynet/tests/unit/dht/test_kbucket.py +++ b/lbrynet/tests/unit/dht/test_kbucket.py @@ -69,13 +69,15 @@ class KBucketTest(unittest.TestCase): if constants.k >= 2: for i in range(constants.k-2): node_ids.append(generate_id()) - tmpContact = self.contact_manager.make_contact(node_ids[-1], next(self.address_generator), 4444, 0, None) + tmpContact = self.contact_manager.make_contact(node_ids[-1], next(self.address_generator), 4444, 0, + None) self.kbucket.addContact(tmpContact) else: # add k contacts for i in range(constants.k): node_ids.append(generate_id()) - tmpContact = self.contact_manager.make_contact(node_ids[-1], next(self.address_generator), 4444, 0, None) + tmpContact = self.contact_manager.make_contact(node_ids[-1], next(self.address_generator), 4444, 0, + None) self.kbucket.addContact(tmpContact) # try to get too many contacts diff --git a/lbrynet/tests/unit/dht/test_node.py b/lbrynet/tests/unit/dht/test_node.py index c612d7593..3310523e9 100644 --- a/lbrynet/tests/unit/dht/test_node.py +++ b/lbrynet/tests/unit/dht/test_node.py @@ -8,12 +8,9 @@ import hashlib from twisted.trial import unittest import struct -from twisted.internet import protocol, defer, selectreactor -from lbrynet.dht.msgtypes import ResponseMessage +from twisted.internet import defer from lbrynet.dht.node import Node from lbrynet.dht import constants -from lbrynet.dht.datastore import DictDataStore -from lbrynet.dht.routingtable import TreeRoutingTable class NodeIDTest(unittest.TestCase):