From e9899743eff2d6afaf1f97d3dcc83f76eb7ecef2 Mon Sep 17 00:00:00 2001 From: Peter Surda Date: Wed, 22 Feb 2017 15:09:36 +0100 Subject: [PATCH] Typos, formatting, obsolete imports --- src/bitmessageqt/safehtmlparser.py | 1 - src/class_receiveDataThread.py | 13 ++++++++----- src/queues.py | 1 - 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/bitmessageqt/safehtmlparser.py b/src/bitmessageqt/safehtmlparser.py index 1ff12c8e..aa935785 100644 --- a/src/bitmessageqt/safehtmlparser.py +++ b/src/bitmessageqt/safehtmlparser.py @@ -3,7 +3,6 @@ import inspect import re from urllib import quote, quote_plus from urlparse import urlparse -from debug import logger class SafeHTMLParser(HTMLParser): # from html5lib.sanitiser diff --git a/src/class_receiveDataThread.py b/src/class_receiveDataThread.py index d3bcd689..64135bc7 100644 --- a/src/class_receiveDataThread.py +++ b/src/class_receiveDataThread.py @@ -658,7 +658,8 @@ class receiveDataThread(threading.Thread): with knownnodes.knownNodesLock: if len(knownnodes.knownNodes[stream]) > 0: - filtered = {k: v for k, v in knownnodes.knownNodes[stream].items() if v > (int(time.time()) - shared.maximumAgeOfNodesThatIAdvertiseToOthers)} + filtered = {k: v for k, v in knownnodes.knownNodes[stream].items() + if v > (int(time.time()) - shared.maximumAgeOfNodesThatIAdvertiseToOthers)} elemCount = len(filtered) if elemCount > 500: elemCount = 500 @@ -666,17 +667,19 @@ class receiveDataThread(threading.Thread): addrsInMyStream = random.sample(filtered.items(), elemCount) # sent 250 only if the remote isn't interested in it if len(knownnodes.knownNodes[stream * 2]) > 0 and stream not in self.streamNumber: - filtered = {k: v for k, v in knownnodes.knownNodes[stream*2].items() if v > (int(time.time()) - shared.maximumAgeOfNodesThatIAdvertiseToOthers)} + filtered = {k: v for k, v in knownnodes.knownNodes[stream*2].items() + if v > (int(time.time()) - shared.maximumAgeOfNodesThatIAdvertiseToOthers)} elemCount = len(filtered) if elemCount > 250: elemCount = 250 - addrsInMyStreamLeft = random.sample(filtered.items(), elemCount) + addrsInChildStreamLeft = random.sample(filtered.items(), elemCount) if len(knownnodes.knownNodes[(stream * 2) + 1]) > 0 and stream not in self.streamNumber: - filtered = {k: v for k, v in knownnodes.knownNodes[stream*2+1].items() if v > (int(time.time()) - shared.maximumAgeOfNodesThatIAdvertiseToOthers)} + filtered = {k: v for k, v in knownnodes.knownNodes[stream*2+1].items() + if v > (int(time.time()) - shared.maximumAgeOfNodesThatIAdvertiseToOthers)} elemCount = len(filtered) if elemCount > 250: elemCount = 250 - addrsInMyStreamRight = random.sample(filtered.items(), elemCount) + addrsInChildStreamRight = random.sample(filtered.items(), elemCount) numberOfAddressesInAddrMessage = 0 payload = '' for (HOST, PORT), timeLastReceivedMessageFromThisNode in addrsInMyStream: diff --git a/src/queues.py b/src/queues.py index c7dab16f..335863e9 100644 --- a/src/queues.py +++ b/src/queues.py @@ -1,5 +1,4 @@ import Queue -from multiprocessing import Queue as mpQueue, Lock as mpLock from class_objectProcessorQueue import ObjectProcessorQueue workerQueue = Queue.Queue()