pylint fixes 2

This commit is contained in:
lakshyacis 2020-01-21 17:43:09 +05:30
parent fe3a98c2b6
commit c613c6d439
No known key found for this signature in database
GPG Key ID: D2C539C8EC63E9EB
6 changed files with 7 additions and 5 deletions

View File

@ -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:

View File

@ -1,5 +1,4 @@
from PyQt4 import QtCore, QtGui
from queue.Queue import Queue
from time import time
class BMStatusBar(QtGui.QStatusBar):

View File

@ -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:

View File

@ -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:

View File

@ -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!")

View File

@ -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])