forked from LBRYCommunity/lbry-sdk
pylint
This commit is contained in:
parent
7da70cc02d
commit
760417ff3a
7 changed files with 11 additions and 13 deletions
|
@ -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__)
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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):
|
||||
|
|
Loading…
Add table
Reference in a new issue