Skip to content

Commit 6da5487

Browse files
committed
Code quality
1 parent 7a81d76 commit 6da5487

11 files changed

Lines changed: 61 additions & 38 deletions

File tree

src/api.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@
7272

7373
import six
7474
from six.moves import configparser, http_client, xmlrpc_server
75-
from six.moves.reprlib import repr
75+
from six.moves.reprlib import repr # pylint: disable=redefined-builtin,import-error
7676

7777
import helper_inbox
7878
import helper_sent

src/bitmessagemain.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
# yet contain logic to expand into further streams.
1212

1313
# flake8: noqa:402
14-
# pylint: disable=superfluous-parens
14+
# pylint: disable=superfluous-parens,relative-import
1515
import os
1616
import sys
1717

src/bitmessageqt/__init__.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"""
22
PyQt based UI for bitmessage, the main module
33
"""
4-
4+
# pylint: disable=import-error,relative-import,too-many-lines
55
import hashlib
66
import locale
77
import os
@@ -239,20 +239,20 @@ def init_inbox_popup_menu(self, connectSignal=True):
239239
QtCore.Qt.CustomContextMenu)
240240
if connectSignal:
241241
self.connect(self.ui.tableWidgetInbox, QtCore.SIGNAL(
242-
'customContextMenuRequested(const QPoint&)'),
243-
self.on_context_menuInbox)
242+
'customContextMenuRequested(const QPoint&)'),
243+
self.on_context_menuInbox)
244244
self.ui.tableWidgetInboxSubscriptions.setContextMenuPolicy(
245245
QtCore.Qt.CustomContextMenu)
246246
if connectSignal:
247247
self.connect(self.ui.tableWidgetInboxSubscriptions, QtCore.SIGNAL(
248-
'customContextMenuRequested(const QPoint&)'),
249-
self.on_context_menuInbox)
248+
'customContextMenuRequested(const QPoint&)'),
249+
self.on_context_menuInbox)
250250
self.ui.tableWidgetInboxChans.setContextMenuPolicy(
251251
QtCore.Qt.CustomContextMenu)
252252
if connectSignal:
253253
self.connect(self.ui.tableWidgetInboxChans, QtCore.SIGNAL(
254-
'customContextMenuRequested(const QPoint&)'),
255-
self.on_context_menuInbox)
254+
'customContextMenuRequested(const QPoint&)'),
255+
self.on_context_menuInbox)
256256

257257
def init_identities_popup_menu(self, connectSignal=True):
258258
# Popup menu for the Your Identities tab
@@ -291,8 +291,8 @@ def init_identities_popup_menu(self, connectSignal=True):
291291
QtCore.Qt.CustomContextMenu)
292292
if connectSignal:
293293
self.connect(self.ui.treeWidgetYourIdentities, QtCore.SIGNAL(
294-
'customContextMenuRequested(const QPoint&)'),
295-
self.on_context_menuYourIdentities)
294+
'customContextMenuRequested(const QPoint&)'),
295+
self.on_context_menuYourIdentities)
296296

297297
# load all gui.menu plugins with prefix 'address'
298298
self.menu_plugins = {'address': []}

src/bitmessageqt/account.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
Account related functions.
77
88
"""
9+
# pylint: disable=import-error
910

1011
from __future__ import absolute_import
1112

src/bitmessageqt/messagecompose.py

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
"""
22
Message editor with a wheel zoom functionality
33
"""
4-
# pylint: disable=bad-continuation
54

6-
from PyQt4 import QtCore, QtGui
5+
from PyQt4 import QtCore, QtGui # pylint disable:import-error
76

87

98
class MessageCompose(QtGui.QTextEdit):
@@ -15,18 +14,22 @@ def __init__(self, parent=0):
1514

1615
def wheelEvent(self, event):
1716
"""Mouse wheel scroll event handler"""
18-
if (
19-
QtGui.QApplication.queryKeyboardModifiers() & QtCore.Qt.ControlModifier
20-
) == QtCore.Qt.ControlModifier and event.orientation() == QtCore.Qt.Vertical:
17+
if (QtGui.QApplication.queryKeyboardModifiers()
18+
& QtCore.Qt.ControlModifier) == \
19+
QtCore.Qt.ControlModifier \
20+
and event.orientation() == QtCore.Qt.Vertical:
2121
if event.delta() > 0:
2222
self.zoomIn(1)
2323
else:
2424
self.zoomOut(1)
25-
zoom = self.currentFont().pointSize() * 100 / self.defaultFontPointSize
26-
QtGui.QApplication.activeWindow().statusBar().showMessage(
27-
QtGui.QApplication.translate("MainWindow", "Zoom level %1%").arg(
28-
str(zoom)
29-
)
25+
zoom = self.currentFont().pointSize() \
26+
* 100 \
27+
/ self.defaultFontPointSize
28+
QtGui.QApplication.activeWindow().statusBar(). \
29+
showMessage(
30+
QtGui.QApplication.translate("MainWindow",
31+
"Zoom level %1%").
32+
arg(str(zoom))
3033
)
3134
else:
3235
# in QTextEdit, super does not zoom, only scroll

src/bitmessageqt/messageview.py

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,17 @@ def wheelEvent(self, event):
5252
# super will actually automatically take care of zooming
5353
super(MessageView, self).wheelEvent(event)
5454
if (
55-
QtGui.QApplication.queryKeyboardModifiers() & QtCore.Qt.ControlModifier
56-
) == QtCore.Qt.ControlModifier and event.orientation() == QtCore.Qt.Vertical:
57-
zoom = self.currentFont().pointSize() * 100 / self.defaultFontPointSize
58-
QtGui.QApplication.activeWindow().statusBar().showMessage(_translate(
59-
"MainWindow", "Zoom level %1%").arg(str(zoom)))
55+
QtGui.QApplication.queryKeyboardModifiers()
56+
& QtCore.Qt.ControlModifier) == \
57+
QtCore.Qt.ControlModifier \
58+
and event.orientation() == QtCore.Qt.Vertical:
59+
zoom = self.currentFont().pointSize() \
60+
* 100 \
61+
/ self.defaultFontPointSize
62+
QtGui.QApplication.activeWindow().statusBar().\
63+
showMessage(_translate("MainWindow",
64+
"Zoom level %1%").
65+
arg(str(zoom)))
6066

6167
def setWrappingWidth(self, width=None):
6268
"""Set word-wrapping width"""
@@ -114,17 +120,21 @@ def lazyRender(self):
114120
self.rendering = True
115121
position = self.verticalScrollBar().value()
116122
cursor = QtGui.QTextCursor(self.document())
117-
while self.outpos < len(self.out) and self.verticalScrollBar().value(
118-
) >= self.document().size().height() - 2 * self.size().height():
123+
while self.outpos < len(self.out) \
124+
and self.verticalScrollBar().value() \
125+
>= self.document().size().height() \
126+
- 2 * self.size().height():
119127
startpos = self.outpos
120128
self.outpos += 10240
121129
# find next end of tag
122130
if self.mode == MessageView.MODE_HTML:
123131
pos = self.out.find(">", self.outpos)
124132
if pos > self.outpos:
125133
self.outpos = pos + 1
126-
cursor.movePosition(QtGui.QTextCursor.End, QtGui.QTextCursor.MoveAnchor)
127-
cursor.insertHtml(QtCore.QString(self.out[startpos:self.outpos]))
134+
cursor.movePosition(QtGui.QTextCursor.End,
135+
QtGui.QTextCursor.MoveAnchor)
136+
cursor.insertHtml(
137+
QtCore.QString(self.out[startpos:self.outpos]))
128138
self.verticalScrollBar().setValue(position)
129139
self.rendering = False
130140

src/bitmessageqt/newchandialog.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,15 @@
33
=================================
44
55
"""
6-
6+
# pylint: disable=import-error,relative-import,ungrouped-imports
77
from PyQt4 import QtCore, QtGui
88

99
import widgets
1010
from addresses import addBMIfNotPresent
1111
from addressvalidator import AddressValidator, PassPhraseValidator
12-
from queues import (
13-
addressGeneratorQueue, apiAddressGeneratorReturnQueue, UISignalQueue)
12+
from queues import (addressGeneratorQueue,
13+
apiAddressGeneratorReturnQueue,
14+
UISignalQueue)
1415
from tr import _translate
1516
from utils import str_chan
1617

@@ -37,8 +38,10 @@ def __init__(self, parent=None):
3738
False))
3839

3940
self.timer = QtCore.QTimer()
40-
QtCore.QObject.connect( # pylint: disable=no-member
41-
self.timer, QtCore.SIGNAL("timeout()"), self.delayedUpdateStatus)
41+
# pylint: disable=no-member
42+
QtCore.QObject.connect(self.timer,
43+
QtCore.SIGNAL("timeout()"),
44+
self.delayedUpdateStatus)
4245
self.timer.start(500) # milliseconds
4346
self.setAttribute(QtCore.Qt.WA_DeleteOnClose)
4447
self.show()

src/bitmessageqt/settingsmixin.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
66
"""
77

8-
from PyQt4 import QtCore, QtGui
8+
from PyQt4 import QtCore, QtGui # pylint: disable=import-error
99

1010

1111
class SettingsMixin(object):

src/bitmessageqt/tests/main.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
"""Common definitions for bitmessageqt tests"""
22

3+
# pylint: disable=import-error
4+
35
import sys
46
import unittest
57

src/bitmessageqt/tests/settings.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Tests for PyBitmessage settings"""
2+
# pylint: disable=import-error
23
import threading
34
import time
45

0 commit comments

Comments
 (0)