Merge pull request #36 from jaicis/py3codefix

pylint fixes 2
This commit is contained in:
lakshyacis 2020-01-21 17:59:39 +05:30 committed by GitHub
commit 17971d6860
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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.addstr(6, 18, "Connections", curses.A_BOLD)
stdscr.hline(7, 6, '-', 23) stdscr.hline(7, 6, '-', 23)
streamcount = [] streamcount = []
for host, stream in connected_hosts: for _, stream in connected_hosts:
if stream >= len(streamcount): if stream >= len(streamcount):
streamcount.append(1) streamcount.append(1)
else: else:

View File

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

View File

@ -49,6 +49,7 @@ def json_serialize_knownnodes(output):
for stream, peers in iter(knownNodes.items()): for stream, peers in iter(knownNodes.items()):
for peer, info in iter(peers.items()): for peer, info in iter(peers.items()):
info.update(rating=round(info.get('rating', 0), 2)) info.update(rating=round(info.get('rating', 0), 2))
# pylint: disable=unidiomatic-typecheck
if type(peer[0]) != bytes: if type(peer[0]) != bytes:
_serialized.append({'stream': stream, 'peer': peer._asdict(), 'info': info}) _serialized.append({'stream': stream, 'peer': peer._asdict(), 'info': info})
else: else:

View File

@ -190,7 +190,6 @@ class BMConnectionPool(object):
def startListening(self, bind=None): def startListening(self, bind=None):
"""Open a listening socket and start accepting connections on it""" """Open a listening socket and start accepting connections on it"""
if bind is None: if bind is None:
"""this return blank host"""
bind = self.getListeningIP() bind = self.getListeningIP()
port = BMConfigParser().safeGetInt("bitmessagesettings", "port") port = BMConfigParser().safeGetInt("bitmessagesettings", "port")
# correct port even if it changed # correct port even if it changed
@ -325,6 +324,7 @@ class BMConnectionPool(object):
continue continue
try: try:
# pylint: disable=unidiomatic-typecheck
if type(chosen.host) == bytes: if type(chosen.host) == bytes:
onion = '.onion'.encode() onion = '.onion'.encode()
else: else:

View File

@ -33,8 +33,8 @@ def get_code_string(base):
elif base == 58: elif base == 58:
return "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz" return "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"
elif base == 256: elif base == 256:
'''raw_unicode_escape is used because in the python3 after range(161) its genreate # 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 ''' # the speical character so avoiding that function we have used the raw_unicode method
return bytes(range(0, 256)) return bytes(range(0, 256))
else: else:
raise ValueError("Invalid base!") raise ValueError("Invalid base!")

View File

@ -21,6 +21,7 @@ class ObjectProcessorQueue(Queue.Queue):
self.curSize = 0 self.curSize = 0
def put(self, item, block=True, timeout=None): def put(self, item, block=True, timeout=None):
"""Putting values in queues"""
while self.curSize >= self.maxSize: while self.curSize >= self.maxSize:
time.sleep(1) time.sleep(1)
with self.sizeLock: with self.sizeLock:
@ -28,6 +29,7 @@ class ObjectProcessorQueue(Queue.Queue):
Queue.Queue.put(self, item, block, timeout) Queue.Queue.put(self, item, block, timeout)
def get(self, block=True, timeout=None): def get(self, block=True, timeout=None):
"""Getting values from queues"""
item = Queue.Queue.get(self, block, timeout) item = Queue.Queue.get(self, block, timeout)
with self.sizeLock: with self.sizeLock:
self.curSize -= len(item[1]) self.curSize -= len(item[1])