From 3f929aee3cec61f2cc545bf14ee06a8909026216 Mon Sep 17 00:00:00 2001 From: Jack Date: Sat, 4 Jun 2016 14:28:32 -0400 Subject: [PATCH] merge travis fixes --- lbrynet/core/Session.py | 13 ++++++++----- lbrynet/core/client/DownloadManager.py | 4 ++-- .../BlindRepeater/ValuableBlobQueryHandler.py | 6 +++--- 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/lbrynet/core/Session.py b/lbrynet/core/Session.py index d919e33b3..c8ff3f290 100644 --- a/lbrynet/core/Session.py +++ b/lbrynet/core/Session.py @@ -28,7 +28,7 @@ class LBRYSession(object): def __init__(self, blob_data_payment_rate, db_dir=None, lbryid=None, peer_manager=None, dht_node_port=None, known_dht_nodes=None, peer_finder=None, hash_announcer=None, blob_dir=None, blob_manager=None, peer_port=None, use_upnp=True, - rate_limiter=None, wallet=None): + rate_limiter=None, wallet=None, dht_node_class=node.Node): """ @param blob_data_payment_rate: The default payment rate for blob data @@ -99,7 +99,7 @@ class LBRYSession(object): self.upnp_redirects = [] self.wallet = wallet - + self.dht_node_class = dht_node_class self.dht_node = None self.base_payment_rate_manager = BasePaymentRateManager(blob_data_payment_rate) @@ -220,8 +220,11 @@ class LBRYSession(object): d.addCallback(match_port, port) ds.append(d) - self.dht_node = node.Node(udpPort=self.dht_node_port, lbryid=self.lbryid, - externalIP=self.external_ip) + self.dht_node = self.dht_node_class( + udpPort=self.dht_node_port, + lbryid=self.lbryid, + externalIP=self.external_ip + ) self.peer_finder = DHTPeerFinder(self.dht_node, self.peer_manager) if self.hash_announcer is None: self.hash_announcer = DHTHashAnnouncer(self.dht_node, self.peer_port) @@ -269,4 +272,4 @@ class LBRYSession(object): d = threads.deferToThread(threaded_unset_upnp) d.addErrback(lambda err: str(err)) - return d \ No newline at end of file + return d diff --git a/lbrynet/core/client/DownloadManager.py b/lbrynet/core/client/DownloadManager.py index fced77969..d601833dd 100644 --- a/lbrynet/core/client/DownloadManager.py +++ b/lbrynet/core/client/DownloadManager.py @@ -52,7 +52,7 @@ class DownloadManager(object): def check_stop(result, manager): if isinstance(result, failure.Failure): - log.error("Failed to stop the %s: %s", manager. result.getErrorMessage()) + log.error("Failed to stop the %s: %s", manager, result.getErrorMessage()) return False return True @@ -115,4 +115,4 @@ class DownloadManager(object): if not self.blobs: return self.calculate_total_bytes() else: - return sum([b.length for b in self.needed_blobs() if b.length is not None]) \ No newline at end of file + return sum([b.length for b in self.needed_blobs() if b.length is not None]) diff --git a/lbrynet/lbrynet_console/plugins/BlindRepeater/ValuableBlobQueryHandler.py b/lbrynet/lbrynet_console/plugins/BlindRepeater/ValuableBlobQueryHandler.py index 08d5a57a0..d8dd0009e 100644 --- a/lbrynet/lbrynet_console/plugins/BlindRepeater/ValuableBlobQueryHandler.py +++ b/lbrynet/lbrynet_console/plugins/BlindRepeater/ValuableBlobQueryHandler.py @@ -101,7 +101,7 @@ class ValuableBlobHashQueryHandler(ValuableQueryHandler): for blob_hash, count in valuable_hashes: hashes_and_scores.append((blob_hash, 1.0 * count / 10.0)) if len(hashes_and_scores) != 0: - log.info("Responding to a valuable blob hashes request with %s blob hashes: %s", + log.info("Responding to a valuable blob hashes request with %s blob hashes", str(len(hashes_and_scores))) expected_payment = 1.0 * len(hashes_and_scores) * self.valuable_blob_hash_payment_rate / 1000.0 self.wallet.add_expected_payment(self.peer, expected_payment) @@ -193,10 +193,10 @@ class ValuableBlobLengthQueryHandler(ValuableQueryHandler): if success is True: lengths.append(response_pair) if len(lengths) > 0: - log.info("Responding with %s blob lengths: %s", str(len(lengths))) + log.info("Responding with %s blob lengths", str(len(lengths))) expected_payment = 1.0 * len(lengths) * self.blob_length_payment_rate / 1000.0 self.wallet.add_expected_payment(self.peer, expected_payment) self.peer.update_stats('uploaded_valuable_blob_infos', len(lengths)) return {'blob_length': {'blob_lengths': lengths}} - dl.addCallback(make_response) \ No newline at end of file + dl.addCallback(make_response)