Skip to content

Commit 2b60a5c

Browse files
committed
Code quality
1 parent 9bdae27 commit 2b60a5c

6 files changed

Lines changed: 22 additions & 17 deletions

File tree

setup.cfg

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ ignore = bitmessagekivy
2424
[pylint.messages_control]
2525
disable =
2626
invalid-name,bare-except,broad-except,relative-import,
27-
superfluous-parens,bad-option-value,fixme
27+
superfluous-parens,bad-option-value,fixme,missing-docstring
2828
# invalid-name: needs fixing during a large, project-wide refactor
2929
# bare-except,broad-except: Need fixing once thorough testing is easier
3030
# bad-option-value is for backward compatibility between python 2 and 3
@@ -42,7 +42,7 @@ ignore = bitmessagekivy
4242
[MESSAGES CONTROL]
4343
disable =
4444
invalid-name,bare-except,broad-except,relative-import,
45-
superfluous-parens,bad-option-value,fixme
45+
superfluous-parens,bad-option-value,fixme,missing-docstring
4646

4747
[DESIGN]
4848
max-args = 8

src/bitmessagecli.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,6 @@ def apiInit(apiEnabled):
188188
def apiData():
189189
"""TBC"""
190190

191-
global keysName
192191
global keysPath
193192
global usrPrompt
194193

src/bitmessageqt/__init__.py

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -760,6 +760,11 @@ def __init__(self, parent=None):
760760

761761
self.unreadCount = 0
762762

763+
self.currentTrayIconFileName = ""
764+
self.actionQuiet = None
765+
self.actionShow = None
766+
self.tray = None
767+
763768
# Set the icon sizes for the identicons
764769
identicon_size = 3 * 7
765770
self.ui.tableWidgetInbox.setIconSize(QtCore.QSize(identicon_size, identicon_size))
@@ -3978,12 +3983,12 @@ def on_context_menuInbox(self, point):
39783983
popMenuInbox.addAction(self.actionReply)
39793984
popMenuInbox.addAction(self.actionAddSenderToAddressBook)
39803985
# pylint: disable=no-member
3981-
self.actionClipboardMessagelist = self.ui.inboxContextMenuToolbar.addAction(
3986+
actionClipboardMessagelist = self.ui.inboxContextMenuToolbar.addAction(
39823987
_translate("MainWindow", "Copy subject to clipboard")
39833988
if tableWidget.currentColumn() == 2 else
39843989
_translate("MainWindow", "Copy address to clipboard"),
39853990
self.on_action_ClipboardMessagelist)
3986-
popMenuInbox.addAction(self.actionClipboardMessagelist)
3991+
popMenuInbox.addAction(actionClipboardMessagelist)
39873992
# pylint: disable=no-member
39883993
self._contact_selected = tableWidget.item(currentRow, 1)
39893994
# preloaded gui.menu plugins with prefix 'address'
@@ -4229,7 +4234,7 @@ class BitmessageQtApplication(QtGui.QApplication):
42294234
"""
42304235

42314236
# Unique identifier for this application
4232-
uuid = '6ec0149b-96e1-4be1-93ab-1465fb3ebf7c'
4237+
UUID = '6ec0149b-96e1-4be1-93ab-1465fb3ebf7c'
42334238

42344239
@staticmethod
42354240
def get_windowstyle():
@@ -4241,7 +4246,6 @@ def get_windowstyle():
42414246

42424247
def __init__(self, *argv):
42434248
super(BitmessageQtApplication, self).__init__(*argv)
4244-
id = BitmessageQtApplication.uuid
42454249

42464250
QtCore.QCoreApplication.setOrganizationName("PyBitmessage")
42474251
QtCore.QCoreApplication.setOrganizationDomain("bitmessage.org")
@@ -4259,14 +4263,14 @@ def __init__(self, *argv):
42594263
self.is_running = False
42604264

42614265
socket = QLocalSocket()
4262-
socket.connectToServer(id)
4266+
socket.connectToServer(self.UUID)
42634267
self.is_running = socket.waitForConnected()
42644268

42654269
# Cleanup past crashed servers
42664270
if not self.is_running:
42674271
if socket.error() == QLocalSocket.ConnectionRefusedError:
42684272
socket.disconnectFromServer()
4269-
QLocalServer.removeServer(id)
4273+
QLocalServer.removeServer(self.UUID)
42704274

42714275
socket.abort()
42724276

@@ -4278,7 +4282,7 @@ def __init__(self, *argv):
42784282
# Nope, create a local server with this id and assign on_new_connection
42794283
# for whenever a second instance tries to run focus the application.
42804284
self.server = QLocalServer()
4281-
self.server.listen(id)
4285+
self.server.listen(self.UUID)
42824286
self.server.newConnection.connect(self.on_new_connection)
42834287

42844288
self.setStyleSheet("QStatusBar::item { border: 0px solid black }")
@@ -4293,20 +4297,20 @@ def on_new_connection(self):
42934297

42944298

42954299
def init():
4296-
global app
4300+
global app # pylint: disable=global-statement
42974301
if not app:
42984302
app = BitmessageQtApplication(sys.argv)
42994303
return app
43004304

43014305

43024306
def run():
4303-
global myapp
4304-
app = init()
4305-
myapp = MyForm()
4307+
global myapp # pylint: disable=global-statement
4308+
_app = init()
4309+
myapp = MyForm() # pylint: disable=redefined-outer-name
43064310

43074311
myapp.appIndicatorInit(app)
43084312

4309-
if myapp._firstrun:
4313+
if myapp._firstrun: # pylint: disable=protected-access
43104314
myapp.showConnectDialog() # ask the user if we may connect
43114315

43124316
# only show after wizards and connect dialogs have completed
@@ -4315,4 +4319,4 @@ def run():
43154319
QtCore.QTimer.singleShot(
43164320
30000, lambda: myapp.setStatusIcon(state.statusIconColor))
43174321

4318-
app.exec_()
4322+
_app.exec_()

src/bitmessageqt/account.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ def accountClass(address):
6868
if subscription.type != AccountMixin.BROADCAST:
6969
return None
7070
else:
71+
# pylint: disable=redefined-variable-type
7172
subscription = SubscriptionAccount(address)
7273
if subscription.type != AccountMixin.SUBSCRIPTION:
7374
# e.g. deleted chan

src/bitmessageqt/bitmessage_icons_rc.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#
88
# WARNING! All changes made in this file will be lost!
99

10+
# pylint: disble=too-many-lines
1011
from PyQt4 import QtCore # pylint: disable=import-error
1112

1213
qt_resource_data = "\

src/class_sqlThread.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -643,5 +643,5 @@ def create_function(self):
643643
self.conn.create_function("enaddr", 3, func=encodeAddress, deterministic=True)
644644
except (TypeError, sqlite3.NotSupportedError) as err:
645645
logger.debug(
646-
"Got error while pass deterministic in sqlite create function {}, Passing 3 params".format(err))
646+
"Got error while pass deterministic in sqlite create function %s, Passing 3 params", err)
647647
self.conn.create_function("enaddr", 3, encodeAddress)

0 commit comments

Comments
 (0)