From c613c6d439e1c98a7a532e94fc189bce8122d7a0 Mon Sep 17 00:00:00 2001 From: lakshyacis Date: Tue, 21 Jan 2020 17:43:09 +0530 Subject: [PATCH] pylint fixes 2 --- src/bitmessagecurses/__init__.py | 2 +- src/bitmessageqt/statusbar.py | 1 - src/knownnodes.py | 1 + src/network/connectionpool.py | 2 +- src/pyelliptic/arithmetic.py | 4 ++-- src/queues.py | 2 ++ 6 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/bitmessagecurses/__init__.py b/src/bitmessagecurses/__init__.py index a3cf5398..d4b72f8c 100644 --- a/src/bitmessagecurses/__init__.py +++ b/src/bitmessagecurses/__init__.py @@ -258,7 +258,7 @@ def drawtab(stdscr): stdscr.addstr(6, 18, "Connections", curses.A_BOLD) stdscr.hline(7, 6, '-', 23) streamcount = [] - for host, stream in connected_hosts: + for _, stream in connected_hosts: if stream >= len(streamcount): streamcount.append(1) else: diff --git a/src/bitmessageqt/statusbar.py b/src/bitmessageqt/statusbar.py index 7f559197..68ddba3f 100644 --- a/src/bitmessageqt/statusbar.py +++ b/src/bitmessageqt/statusbar.py @@ -1,5 +1,4 @@ from PyQt4 import QtCore, QtGui -from queue.Queue import Queue from time import time class BMStatusBar(QtGui.QStatusBar): diff --git a/src/knownnodes.py b/src/knownnodes.py index a2327625..48194d9d 100644 --- a/src/knownnodes.py +++ b/src/knownnodes.py @@ -49,6 +49,7 @@ def json_serialize_knownnodes(output): for stream, peers in iter(knownNodes.items()): for peer, info in iter(peers.items()): info.update(rating=round(info.get('rating', 0), 2)) + # pylint: disable=unidiomatic-typecheck if type(peer[0]) != bytes: _serialized.append({'stream': stream, 'peer': peer._asdict(), 'info': info}) else: diff --git a/src/network/connectionpool.py b/src/network/connectionpool.py index 36f8c2b3..159f66f3 100644 --- a/src/network/connectionpool.py +++ b/src/network/connectionpool.py @@ -190,7 +190,6 @@ class BMConnectionPool(object): def startListening(self, bind=None): """Open a listening socket and start accepting connections on it""" if bind is None: - """this return blank host""" bind = self.getListeningIP() port = BMConfigParser().safeGetInt("bitmessagesettings", "port") # correct port even if it changed @@ -325,6 +324,7 @@ class BMConnectionPool(object): continue try: + # pylint: disable=unidiomatic-typecheck if type(chosen.host) == bytes: onion = '.onion'.encode() else: diff --git a/src/pyelliptic/arithmetic.py b/src/pyelliptic/arithmetic.py index 566be794..f6690a25 100644 --- a/src/pyelliptic/arithmetic.py +++ b/src/pyelliptic/arithmetic.py @@ -33,8 +33,8 @@ def get_code_string(base): elif base == 58: return "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz" elif base == 256: - '''raw_unicode_escape is used because in the python3 after range(161) its genreate - the speical character so avoiding that function we have used the raw_unicode method ''' + # raw_unicode_escape is used because in the python3 after range(161) its genreate + # the speical character so avoiding that function we have used the raw_unicode method return bytes(range(0, 256)) else: raise ValueError("Invalid base!") diff --git a/src/queues.py b/src/queues.py index 6a76adb6..bbd13fb7 100644 --- a/src/queues.py +++ b/src/queues.py @@ -21,6 +21,7 @@ class ObjectProcessorQueue(Queue.Queue): self.curSize = 0 def put(self, item, block=True, timeout=None): + """Putting values in queues""" while self.curSize >= self.maxSize: time.sleep(1) with self.sizeLock: @@ -28,6 +29,7 @@ class ObjectProcessorQueue(Queue.Queue): Queue.Queue.put(self, item, block, timeout) def get(self, block=True, timeout=None): + """Getting values from queues""" item = Queue.Queue.get(self, block, timeout) with self.sizeLock: self.curSize -= len(item[1])