Handled pylint warnings in bitmessageqt, qidenticon, depends,
resolved pylint redefined-variable-type warnings, marked autogenerated modules for skipping by pylint and flake8
This commit is contained in:
parent
a38e5c63e1
commit
f4eae01886
|
@ -1578,7 +1578,13 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
|
|
||||||
# menu button 'delete all treshed messages'
|
# menu button 'delete all treshed messages'
|
||||||
def click_actionDeleteAllTrashedMessages(self):
|
def click_actionDeleteAllTrashedMessages(self):
|
||||||
if QtWidgets.QMessageBox.question(self, _translate("MainWindow", "Delete trash?"), _translate("MainWindow", "Are you sure you want to delete all trashed messages?"), QtWidgets.QMessageBox.Yes, QtWidgets.QMessageBox.No) == QtWidgets.QMessageBox.No:
|
if QtWidgets.QMessageBox.question(
|
||||||
|
self, _translate("MainWindow", "Delete trash?"),
|
||||||
|
_translate(
|
||||||
|
"MainWindow",
|
||||||
|
"Are you sure you want to delete all trashed messages?"
|
||||||
|
), QtWidgets.QMessageBox.Yes, QtWidgets.QMessageBox.No
|
||||||
|
) == QtWidgets.QMessageBox.No:
|
||||||
return
|
return
|
||||||
sqlStoredProcedure('deleteandvacuume')
|
sqlStoredProcedure('deleteandvacuume')
|
||||||
self.rerenderTabTreeMessages()
|
self.rerenderTabTreeMessages()
|
||||||
|
@ -2086,7 +2092,7 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
# attempt register
|
# attempt register
|
||||||
if email[-14:] != "@mailchuck.com":
|
if email[-14:] != "@mailchuck.com":
|
||||||
# 12 character random email address
|
# 12 character random email address
|
||||||
email = ''.join(
|
email = u''.join(
|
||||||
random.SystemRandom().choice(
|
random.SystemRandom().choice(
|
||||||
string.ascii_lowercase
|
string.ascii_lowercase
|
||||||
) for _ in range(12)
|
) for _ in range(12)
|
||||||
|
@ -2108,33 +2114,33 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
decodeAddress(toAddress)[:3]
|
decodeAddress(toAddress)[:3]
|
||||||
if status != 'success':
|
if status != 'success':
|
||||||
try:
|
try:
|
||||||
toAddress = unicode(toAddress, 'utf-8', 'ignore')
|
toAddress_value = unicode(
|
||||||
|
toAddress, 'utf-8', 'ignore')
|
||||||
except:
|
except:
|
||||||
logger.warning(
|
logger.warning(
|
||||||
"Failed unicode(toAddress ):",
|
"Failed unicode(toAddress ):", exc_info=True)
|
||||||
exc_info=True)
|
|
||||||
logger.error(
|
logger.error(
|
||||||
'Error: Could not decode recipient address %s: %s',
|
'Error: Could not decode recipient address %s: %s',
|
||||||
toAddress, status)
|
toAddress_value, status)
|
||||||
|
|
||||||
if status == 'missingbm':
|
if status == 'missingbm':
|
||||||
self.updateStatusBar(_translate(
|
self.updateStatusBar(_translate(
|
||||||
"MainWindow",
|
"MainWindow",
|
||||||
"Error: Bitmessage addresses start with"
|
"Error: Bitmessage addresses start with"
|
||||||
" BM- Please check the recipient address {0}"
|
" BM- Please check the recipient address {0}"
|
||||||
).format(toAddress))
|
).format(toAddress_value))
|
||||||
elif status == 'checksumfailed':
|
elif status == 'checksumfailed':
|
||||||
self.updateStatusBar(_translate(
|
self.updateStatusBar(_translate(
|
||||||
"MainWindow",
|
"MainWindow",
|
||||||
"Error: The recipient address {0} is not"
|
"Error: The recipient address {0} is not"
|
||||||
" typed or copied correctly. Please check it."
|
" typed or copied correctly. Please check it."
|
||||||
).format(toAddress))
|
).format(toAddress_value))
|
||||||
elif status == 'invalidcharacters':
|
elif status == 'invalidcharacters':
|
||||||
self.updateStatusBar(_translate(
|
self.updateStatusBar(_translate(
|
||||||
"MainWindow",
|
"MainWindow",
|
||||||
"Error: The recipient address {0} contains"
|
"Error: The recipient address {0} contains"
|
||||||
" invalid characters. Please check it."
|
" invalid characters. Please check it."
|
||||||
).format(toAddress))
|
).format(toAddress_value))
|
||||||
elif status == 'versiontoohigh':
|
elif status == 'versiontoohigh':
|
||||||
self.updateStatusBar(_translate(
|
self.updateStatusBar(_translate(
|
||||||
"MainWindow",
|
"MainWindow",
|
||||||
|
@ -2142,7 +2148,7 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
" {0} is too high. Either you need to upgrade"
|
" {0} is too high. Either you need to upgrade"
|
||||||
" your Bitmessage software or your"
|
" your Bitmessage software or your"
|
||||||
" acquaintance is being clever."
|
" acquaintance is being clever."
|
||||||
).format(toAddress))
|
).format(toAddress_value))
|
||||||
elif status == 'ripetooshort':
|
elif status == 'ripetooshort':
|
||||||
self.updateStatusBar(_translate(
|
self.updateStatusBar(_translate(
|
||||||
"MainWindow",
|
"MainWindow",
|
||||||
|
@ -2150,7 +2156,7 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
" address {0} is too short. There might be"
|
" address {0} is too short. There might be"
|
||||||
" something wrong with the software of"
|
" something wrong with the software of"
|
||||||
" your acquaintance."
|
" your acquaintance."
|
||||||
).format(toAddress))
|
).format(toAddress_value))
|
||||||
elif status == 'ripetoolong':
|
elif status == 'ripetoolong':
|
||||||
self.updateStatusBar(_translate(
|
self.updateStatusBar(_translate(
|
||||||
"MainWindow",
|
"MainWindow",
|
||||||
|
@ -2158,7 +2164,7 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
" address {0} is too long. There might be"
|
" address {0} is too long. There might be"
|
||||||
" something wrong with the software of"
|
" something wrong with the software of"
|
||||||
" your acquaintance."
|
" your acquaintance."
|
||||||
).format(toAddress))
|
).format(toAddress_value))
|
||||||
elif status == 'varintmalformed':
|
elif status == 'varintmalformed':
|
||||||
self.updateStatusBar(_translate(
|
self.updateStatusBar(_translate(
|
||||||
"MainWindow",
|
"MainWindow",
|
||||||
|
@ -2166,13 +2172,13 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
" address {0} is malformed. There might be"
|
" address {0} is malformed. There might be"
|
||||||
" something wrong with the software of"
|
" something wrong with the software of"
|
||||||
" your acquaintance."
|
" your acquaintance."
|
||||||
).format(toAddress))
|
).format(toAddress_value))
|
||||||
else:
|
else:
|
||||||
self.updateStatusBar(_translate(
|
self.updateStatusBar(_translate(
|
||||||
"MainWindow",
|
"MainWindow",
|
||||||
"Error: Something is wrong with the"
|
"Error: Something is wrong with the"
|
||||||
" recipient address {0}."
|
" recipient address {0}."
|
||||||
).format(toAddress))
|
).format(toAddress_value))
|
||||||
elif fromAddress == '':
|
elif fromAddress == '':
|
||||||
self.updateStatusBar(_translate(
|
self.updateStatusBar(_translate(
|
||||||
"MainWindow",
|
"MainWindow",
|
||||||
|
@ -2478,7 +2484,7 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
dialog.exec_()
|
dialog.exec_()
|
||||||
try:
|
try:
|
||||||
address, label = dialog.data
|
address, label = dialog.data
|
||||||
except AttributeError:
|
except (AttributeError, TypeError):
|
||||||
return
|
return
|
||||||
|
|
||||||
# First we must check to see if the address is already in the
|
# First we must check to see if the address is already in the
|
||||||
|
@ -2523,7 +2529,7 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
dialog.exec_()
|
dialog.exec_()
|
||||||
try:
|
try:
|
||||||
address, label = dialog.data
|
address, label = dialog.data
|
||||||
except AttributeError:
|
except (AttributeError, TypeError):
|
||||||
return
|
return
|
||||||
|
|
||||||
# We must check to see if the address is already in the
|
# We must check to see if the address is already in the
|
||||||
|
@ -2582,9 +2588,8 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
dialog = dialogs.EmailGatewayDialog(self, config=BMConfigParser())
|
dialog = dialogs.EmailGatewayDialog(self, config=BMConfigParser())
|
||||||
# For Modal dialogs
|
# For Modal dialogs
|
||||||
dialog.exec_()
|
dialog.exec_()
|
||||||
try:
|
|
||||||
acct = dialog.data
|
acct = dialog.data
|
||||||
except AttributeError:
|
if not acct:
|
||||||
return
|
return
|
||||||
|
|
||||||
# Only settings remain here
|
# Only settings remain here
|
||||||
|
@ -3239,10 +3244,9 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
|
|
||||||
defaultFilename = "".join(
|
defaultFilename = "".join(
|
||||||
x for x in subjectAtCurrentInboxRow if x.isalnum()) + '.txt'
|
x for x in subjectAtCurrentInboxRow if x.isalnum()) + '.txt'
|
||||||
filename, filetype = QtWidgets.QFileDialog.getSaveFileName(
|
filename = QtWidgets.QFileDialog.getSaveFileName(
|
||||||
self, _translate("MainWindow", "Save As..."), defaultFilename,
|
self, _translate("MainWindow", "Save As..."), defaultFilename,
|
||||||
"Text files (*.txt);;All files (*.*)"
|
"Text files (*.txt);;All files (*.*)")[0]
|
||||||
)
|
|
||||||
if not filename:
|
if not filename:
|
||||||
return
|
return
|
||||||
try:
|
try:
|
||||||
|
@ -3702,8 +3706,8 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
account = accountClass(myAddress)
|
account = accountClass(myAddress)
|
||||||
if isinstance(account, GatewayAccount) \
|
if isinstance(account, GatewayAccount) \
|
||||||
and otherAddress == account.relayAddress and (
|
and otherAddress == account.relayAddress and (
|
||||||
(currentColumn in (0, 2) and currentFolder == "sent")
|
(currentColumn in (0, 2) and currentFolder == "sent") or
|
||||||
or (currentColumn in (1, 2) and currentFolder != "sent")):
|
(currentColumn in (1, 2) and currentFolder != "sent")):
|
||||||
text = tableWidget.item(currentRow, currentColumn).label
|
text = tableWidget.item(currentRow, currentColumn).label
|
||||||
else:
|
else:
|
||||||
text = tableWidget.item(currentRow, currentColumn).data(QtCore.Qt.UserRole)
|
text = tableWidget.item(currentRow, currentColumn).data(QtCore.Qt.UserRole)
|
||||||
|
@ -3764,10 +3768,9 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
current_files += [upper]
|
current_files += [upper]
|
||||||
filters[0:0] = ['Image files (' + ' '.join(all_images_filter) + ')']
|
filters[0:0] = ['Image files (' + ' '.join(all_images_filter) + ')']
|
||||||
filters[1:1] = ['All files (*.*)']
|
filters[1:1] = ['All files (*.*)']
|
||||||
sourcefile, filetype = QtWidgets.QFileDialog.getOpenFileName(
|
sourcefile = QtWidgets.QFileDialog.getOpenFileName(
|
||||||
self, _translate("MainWindow", "Set avatar..."),
|
self, _translate("MainWindow", "Set avatar..."),
|
||||||
filter=';;'.join(filters)
|
filter=';;'.join(filters))[0]
|
||||||
)
|
|
||||||
# determine the correct filename (note that avatars don't use the suffix)
|
# determine the correct filename (note that avatars don't use the suffix)
|
||||||
destination = state.appdata + 'avatars/' + hash + '.' + sourcefile.split('.')[-1]
|
destination = state.appdata + 'avatars/' + hash + '.' + sourcefile.split('.')[-1]
|
||||||
exists = QtCore.QFile.exists(destination)
|
exists = QtCore.QFile.exists(destination)
|
||||||
|
@ -3828,10 +3831,10 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
"MainWindow", "Sound files (%s)" %
|
"MainWindow", "Sound files (%s)" %
|
||||||
' '.join(['*%s%s' % (os.extsep, ext) for ext in sound.extensions])
|
' '.join(['*%s%s' % (os.extsep, ext) for ext in sound.extensions])
|
||||||
))]
|
))]
|
||||||
sourcefile, filetype = QtWidgets.QFileDialog.getOpenFileName(
|
sourcefile = QtWidgets.QFileDialog.getOpenFileName(
|
||||||
self, _translate("MainWindow", "Set notification sound..."),
|
self, _translate("MainWindow", "Set notification sound..."),
|
||||||
filter=';;'.join(filters)
|
filter=';;'.join(filters)
|
||||||
)
|
)[0]
|
||||||
|
|
||||||
if not sourcefile:
|
if not sourcefile:
|
||||||
return
|
return
|
||||||
|
@ -4095,6 +4098,8 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
except NameError:
|
except NameError:
|
||||||
message = u""
|
message = u""
|
||||||
except IndexError:
|
except IndexError:
|
||||||
|
# _translate() often returns unicode, no redefinition here!
|
||||||
|
# pylint: disable=redefined-variable-type
|
||||||
message = _translate(
|
message = _translate(
|
||||||
"MainWindow",
|
"MainWindow",
|
||||||
"Error occurred: could not load message from disk."
|
"Error occurred: could not load message from disk."
|
||||||
|
|
|
@ -91,7 +91,7 @@ class AddressDataDialog(QtWidgets.QDialog, AddressCheckMixin):
|
||||||
def __init__(self, parent):
|
def __init__(self, parent):
|
||||||
super(AddressDataDialog, self).__init__(parent)
|
super(AddressDataDialog, self).__init__(parent)
|
||||||
self.parent = parent
|
self.parent = parent
|
||||||
self.data = ("", "")
|
self.data = None
|
||||||
|
|
||||||
def accept(self):
|
def accept(self):
|
||||||
"""Callback for QDialog accepting value"""
|
"""Callback for QDialog accepting value"""
|
||||||
|
@ -187,6 +187,7 @@ class NewSubscriptionDialog(AddressDataDialog):
|
||||||
def __init__(self, parent=None):
|
def __init__(self, parent=None):
|
||||||
super(NewSubscriptionDialog, self).__init__(parent)
|
super(NewSubscriptionDialog, self).__init__(parent)
|
||||||
widgets.load('newsubscriptiondialog.ui', self)
|
widgets.load('newsubscriptiondialog.ui', self)
|
||||||
|
self.recent = []
|
||||||
self._setup()
|
self._setup()
|
||||||
|
|
||||||
def _onSuccess(self, addressVersion, streamNumber, ripe):
|
def _onSuccess(self, addressVersion, streamNumber, ripe):
|
||||||
|
@ -306,6 +307,7 @@ class EmailGatewayDialog(QtWidgets.QDialog):
|
||||||
widgets.load('emailgateway.ui', self)
|
widgets.load('emailgateway.ui', self)
|
||||||
self.parent = parent
|
self.parent = parent
|
||||||
self.config = config
|
self.config = config
|
||||||
|
self.data = None
|
||||||
if account:
|
if account:
|
||||||
self.acct = account
|
self.acct = account
|
||||||
self.setWindowTitle(_translate(
|
self.setWindowTitle(_translate(
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
# pylint: skip-file
|
||||||
|
# flake8: noqa
|
||||||
|
|
||||||
from qtpy import QtCore, QtGui, QtWidgets
|
from qtpy import QtCore, QtGui, QtWidgets
|
||||||
from tr import _translate
|
from tr import _translate
|
||||||
from bmconfigparser import BMConfigParser
|
from bmconfigparser import BMConfigParser
|
||||||
|
|
|
@ -136,17 +136,17 @@ detectOS.result = None
|
||||||
def detectOSRelease():
|
def detectOSRelease():
|
||||||
"""Detecting the release of OS"""
|
"""Detecting the release of OS"""
|
||||||
with open("/etc/os-release", 'r') as osRelease:
|
with open("/etc/os-release", 'r') as osRelease:
|
||||||
version = None
|
ver = None
|
||||||
for line in osRelease:
|
for line in osRelease:
|
||||||
if line.startswith("NAME="):
|
if line.startswith("NAME="):
|
||||||
detectOS.result = OS_RELEASE.get(
|
detectOS.result = OS_RELEASE.get(
|
||||||
line.replace('"', '').split("=")[-1].strip().lower())
|
line.replace('"', '').split("=")[-1].strip().lower())
|
||||||
elif line.startswith("VERSION_ID="):
|
elif line.startswith("VERSION_ID="):
|
||||||
try:
|
try:
|
||||||
version = float(line.split("=")[1].replace("\"", ""))
|
ver = float(line.split("=")[1].replace("\"", ""))
|
||||||
except ValueError:
|
except ValueError:
|
||||||
pass
|
pass
|
||||||
if detectOS.result == "Ubuntu" and version < 14:
|
if detectOS.result == "Ubuntu" and ver < 14:
|
||||||
detectOS.result = "Ubuntu 12"
|
detectOS.result = "Ubuntu 12"
|
||||||
|
|
||||||
|
|
||||||
|
@ -364,8 +364,10 @@ def check_pyqt():
|
||||||
Here we are checking for PyQt4 with its version, as for it require
|
Here we are checking for PyQt4 with its version, as for it require
|
||||||
PyQt 4.8 or later.
|
PyQt 4.8 or later.
|
||||||
"""
|
"""
|
||||||
|
# pylint: disable=no-member
|
||||||
qtpy = try_import(
|
qtpy = try_import(
|
||||||
'qtpy', 'PyBitmessage requires qtpy, PyQt 4.8 or later and Qt 4.7 or later.')
|
'qtpy',
|
||||||
|
'PyBitmessage requires qtpy, PyQt 4.8 or later and Qt 4.7 or later.')
|
||||||
|
|
||||||
if not qtpy:
|
if not qtpy:
|
||||||
return False
|
return False
|
||||||
|
|
|
@ -128,7 +128,7 @@ class IdenticonRendererBase(object):
|
||||||
|
|
||||||
return image
|
return image
|
||||||
|
|
||||||
def decode(self, code):
|
def decode(self, code, twoColor):
|
||||||
"""virtual functions"""
|
"""virtual functions"""
|
||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user