Resolved pylint warnings

This commit is contained in:
Dmitri Bogomolov 2019-05-06 13:05:21 +03:00
parent 453e045ae5
commit 01d4fbe60b
Signed by untrusted user: g1itch
GPG Key ID: 720A756F18DEED13
2 changed files with 8 additions and 3 deletions

View File

@ -143,7 +143,9 @@ class objectProcessor(threading.Thread):
else: else:
logger.debug('This object is not an acknowledgement bound for me.') logger.debug('This object is not an acknowledgement bound for me.')
def processonion(self, data): @staticmethod
def processonion(data):
"""Process onionpeer object"""
readPosition = 20 # bypass the nonce, time, and object type readPosition = 20 # bypass the nonce, time, and object type
length = decodeVarint(data[readPosition:readPosition + 10])[1] length = decodeVarint(data[readPosition:readPosition + 10])[1]
readPosition += length readPosition += length
@ -160,7 +162,9 @@ class objectProcessor(threading.Thread):
knownnodes.addKnownNode( knownnodes.addKnownNode(
stream, peer, is_self=state.ownAddresses.get(peer)) stream, peer, is_self=state.ownAddresses.get(peer))
def processgetpubkey(self, data): @staticmethod
def processgetpubkey(data):
"""Process getpubkey object"""
if len(data) > 200: if len(data) > 200:
logger.info( logger.info(
'getpubkey is abnormally long. Sanity check failed.' 'getpubkey is abnormally long. Sanity check failed.'

View File

@ -130,7 +130,7 @@ class singleWorker(threading.Thread, StoppableThread):
queues.workerQueue.put(('sendbroadcast', '')) queues.workerQueue.put(('sendbroadcast', ''))
# send onionpeer object # send onionpeer object
for peer in state.ownAddresses.keys(): for peer in state.ownAddresses:
if peer.host.endswith('.onion'): if peer.host.endswith('.onion'):
queues.workerQueue.put(('sendOnionPeerObj', peer)) queues.workerQueue.put(('sendOnionPeerObj', peer))
break break
@ -470,6 +470,7 @@ class singleWorker(threading.Thread, StoppableThread):
) )
def sendOnionPeerObj(self, peer): def sendOnionPeerObj(self, peer):
"""Send onionpeer object representing peer"""
TTL = int(7 * 24 * 60 * 60 + helper_random.randomrandrange(-300, 300)) TTL = int(7 * 24 * 60 * 60 + helper_random.randomrandrange(-300, 300))
embeddedTime = int(time.time() + TTL) embeddedTime = int(time.time() + TTL)
streamNumber = 1 # Don't know yet what should be here streamNumber = 1 # Don't know yet what should be here