From e74affe6363f99be5ee185919adfa14c2f0bbb7a Mon Sep 17 00:00:00 2001 From: lakshyacis Date: Thu, 12 Sep 2019 15:24:18 +0530 Subject: [PATCH] udp pylint fixes --- src/network/udp.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/network/udp.py b/src/network/udp.py index 33504289..01dc1f7b 100644 --- a/src/network/udp.py +++ b/src/network/udp.py @@ -1,3 +1,7 @@ +""" +src/network/udp.py +================== +""" import time import socket @@ -9,15 +13,16 @@ from objectracker import ObjectTracker from queues import receiveDataQueue -class UDPSocket(BMProto): +class UDPSocket(BMProto): # pylint: disable=too-many-instance-attributes + """Bitmessage protocol over UDP (class)""" port = 8444 announceInterval = 60 def __init__(self, host=None, sock=None, announcing=False): - super(BMProto, self).__init__(sock=sock) + super(BMProto, self).__init__(sock=sock) # pylint: disable=bad-super-call self.verackReceived = True self.verackSent = True - # TODO sort out streams + # .. todo:: sort out streams self.streams = [1] self.fullyEstablished = True self.connectedAt = 0 @@ -44,6 +49,7 @@ class UDPSocket(BMProto): self.set_state("bm_header", expectBytes=protocol.Header.size) def set_socket_reuse(self): + """Set socket reuse option""" self.socket.setsockopt(socket.SOL_SOCKET, socket.SO_BROADCAST, 1) self.socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) try: @@ -73,8 +79,7 @@ class UDPSocket(BMProto): decodedIP = protocol.checkIPAddress(str(ip)) if stream not in state.streamsInWhichIAmParticipating: continue - if (seenTime < time.time() - self.maxTimeOffset or - seenTime > time.time() + self.maxTimeOffset): + if (seenTime < time.time() - self.maxTimeOffset or seenTime > time.time() + self.maxTimeOffset): continue if decodedIP is False: # if the address isn't local, interpret it as