diff --git a/setup.cfg b/setup.cfg index 1799a6fee..f558190e9 100644 --- a/setup.cfg +++ b/setup.cfg @@ -24,7 +24,9 @@ ignore = bitmessagekivy [pylint.messages_control] disable = invalid-name,bare-except,broad-except,relative-import, - superfluous-parens,bad-option-value,fixme + superfluous-parens,bad-option-value,fixme,missing-docstring, + too-many-locals,too-few-public-methods,too-many-statements, + too-many-instance-attributes,too-many-public-methods # invalid-name: needs fixing during a large, project-wide refactor # bare-except,broad-except: Need fixing once thorough testing is easier # bad-option-value is for backward compatibility between python 2 and 3 @@ -42,7 +44,9 @@ ignore = bitmessagekivy [MESSAGES CONTROL] disable = invalid-name,bare-except,broad-except,relative-import, - superfluous-parens,bad-option-value,fixme + superfluous-parens,bad-option-value,fixme,missing-docstring, + too-many-locals,too-few-public-methods,too-many-statements, + too-many-instance-attributes,too-many-public-methods [DESIGN] max-args = 8 diff --git a/src/bitmessagecli.py b/src/bitmessagecli.py index 536c5821b..b7ade9f7c 100644 --- a/src/bitmessagecli.py +++ b/src/bitmessagecli.py @@ -188,7 +188,6 @@ def apiInit(apiEnabled): def apiData(): """TBC""" - global keysName global keysPath global usrPrompt diff --git a/src/bitmessageqt/__init__.py b/src/bitmessageqt/__init__.py index d553e885b..8f7b5695e 100644 --- a/src/bitmessageqt/__init__.py +++ b/src/bitmessageqt/__init__.py @@ -2,6 +2,9 @@ PyQt based UI for bitmessage, the main module """ # pylint: disable=import-error,too-many-lines,no-member +# pylint: disable=too-many-branches,too-many-nested-blocks +# pylint: disable=too-many-return-statements +# pylint: disable=too-many-boolean-expressions import hashlib import locale import os @@ -760,6 +763,11 @@ def __init__(self, parent=None): self.unreadCount = 0 + self.currentTrayIconFileName = "" + self.actionQuiet = None + self.actionShow = None + self.tray = None + # Set the icon sizes for the identicons identicon_size = 3 * 7 self.ui.tableWidgetInbox.setIconSize(QtCore.QSize(identicon_size, identicon_size)) @@ -843,7 +851,7 @@ def __init__(self, parent=None): self.initSettings() self.resetNamecoinConnection() - self.sqlInit() + MyForm.sqlInit() self.indicatorInit() self.notifierInit() self.updateStartOnLogon() @@ -1107,7 +1115,8 @@ def propagateUnreadCount(self, folder=None, widget=None): if newCount != folderItem.unreadCount: folderItem.setUnreadCount(newCount) - def addMessageListItem(self, tableWidget, items): + @staticmethod + def addMessageListItem(tableWidget, items): sortingEnabled = tableWidget.isSortingEnabled() if sortingEnabled: tableWidget.setSortingEnabled(False) @@ -1117,8 +1126,9 @@ def addMessageListItem(self, tableWidget, items): if sortingEnabled: tableWidget.setSortingEnabled(True) + @staticmethod def addMessageListItemSent( - self, tableWidget, toAddress, fromAddress, subject, + tableWidget, toAddress, fromAddress, subject, status, ackdata, lastactiontime ): acct = accountClass(fromAddress) or BMAccount(fromAddress) @@ -1191,12 +1201,13 @@ def addMessageListItemSent( str(subject), text_type(acct.subject, 'utf-8', 'replace')), MessageList_TimeWidget( statusText, False, lastactiontime, ackdata)] - self.addMessageListItem(tableWidget, items) + MyForm.addMessageListItem(tableWidget, items) return acct + @staticmethod def addMessageListItemInbox( - self, tableWidget, toAddress, fromAddress, subject, + tableWidget, toAddress, fromAddress, subject, msgid, received, read ): if toAddress == str_broadcast_subscribers: @@ -1218,12 +1229,12 @@ def addMessageListItemInbox( MessageList_TimeWidget( l10n.formatTimestamp(received), not read, received, msgid) ] - self.addMessageListItem(tableWidget, items) + MyForm.addMessageListItem(tableWidget, items) return acct - # Load Sent items from database def loadSent(self, tableWidget, account, where="", what=""): + """Load Sent items from database""" if tableWidget == self.ui.tableWidgetInboxSubscriptions: tableWidget.setColumnHidden(0, True) tableWidget.setColumnHidden(1, False) @@ -1241,7 +1252,7 @@ def loadSent(self, tableWidget, account, where="", what=""): xAddress, account, "sent", where, what, False) for row in queryreturn: - self.addMessageListItemSent(tableWidget, *row) + MyForm.addMessageListItemSent(tableWidget, *row) tableWidget.horizontalHeader().setSortIndicator( 3, QtCore.Qt.DescendingOrder) @@ -1250,11 +1261,11 @@ def loadSent(self, tableWidget, account, where="", what=""): _translate("MainWindow", "Sent")) tableWidget.setUpdatesEnabled(True) - # Load messages from database file def loadMessagelist( self, tableWidget, account, folder="inbox", where="", what="", unreadOnly=False ): + """Load messages from database file""" tableWidget.setUpdatesEnabled(False) tableWidget.setSortingEnabled(False) tableWidget.setRowCount(0) @@ -1282,7 +1293,7 @@ def loadMessagelist( for row in queryreturn: toAddress, fromAddress, subject, _, msgid, received, read = row - self.addMessageListItemInbox( + MyForm.addMessageListItemInbox( tableWidget, toAddress, fromAddress, subject, msgid, received, read) @@ -1359,8 +1370,9 @@ def appIndicatorInit(self, _app): self.tray.setContextMenu(m) self.tray.show() - # returns the number of unread messages and subscriptions - def getUnread(self): + @staticmethod + def getUnread(): + """returns the number of unread messages and subscriptions""" counters = [0, 0] queryreturn = sqlQuery(''' @@ -1443,8 +1455,9 @@ def _choose_ext(basename): self._player(soundFilename) - # Adapters and converters for QT <-> sqlite - def sqlInit(self): + @staticmethod + def sqlInit(): + """Adapters and converters for QT <-> sqlite""" register_adapter(QtCore.QByteArray, str) def indicatorInit(self): @@ -1813,15 +1826,16 @@ def setStatusIcon(self, color): def initTrayIcon(self, iconFileName, _app): self.currentTrayIconFileName = iconFileName self.tray = QtGui.QSystemTrayIcon( - self.calcTrayIcon(iconFileName, - self.findInboxUnreadCount()), + MyForm.calcTrayIcon(iconFileName, + self.findInboxUnreadCount()), _app) def setTrayIconFile(self, iconFileName): self.currentTrayIconFileName = iconFileName self.drawTrayIcon(iconFileName, self.findInboxUnreadCount()) - def calcTrayIcon(self, iconFileName, inboxUnreadCount): + @staticmethod + def calcTrayIcon(iconFileName, inboxUnreadCount): pixmap = QtGui.QPixmap(":/newPrefix/images/" + iconFileName) if inboxUnreadCount > 0: # choose font and calculate font parameters @@ -1854,7 +1868,8 @@ def calcTrayIcon(self, iconFileName, inboxUnreadCount): return QtGui.QIcon(pixmap) def drawTrayIcon(self, iconFileName, inboxUnreadCount): - self.tray.setIcon(self.calcTrayIcon(iconFileName, inboxUnreadCount)) + self.tray.setIcon(MyForm.calcTrayIcon(iconFileName, + inboxUnreadCount)) def changedInboxUnread(self, row=None): self.drawTrayIcon( @@ -1985,14 +2000,14 @@ def rerenderMessagelistToLabels(self): def rerenderAddressBook(self): def addRow(address, label, row_type): self.ui.tableWidgetAddressBook.insertRow(0) - newItem = Ui_AddressBookWidgetItemLabel(address, - text_type(label, 'utf-8'), - row_type) - self.ui.tableWidgetAddressBook.setItem(0, 0, newItem) - newItem = Ui_AddressBookWidgetItemAddress(address, - text_type(label, 'utf-8'), - row_type) - self.ui.tableWidgetAddressBook.setItem(0, 1, newItem) + newItemL = Ui_AddressBookWidgetItemLabel(address, + text_type(label, 'utf-8'), + row_type) + self.ui.tableWidgetAddressBook.setItem(0, 0, newItemL) + newItemA = Ui_AddressBookWidgetItemAddress(address, + text_type(label, 'utf-8'), + row_type) + self.ui.tableWidgetAddressBook.setItem(0, 1, newItemA) oldRows = {} for i in range(self.ui.tableWidgetAddressBook.rowCount()): @@ -2964,8 +2979,9 @@ def on_action_InboxMarkUnread(self): # tableWidget.clearSelection() manages to mark the message # as read again. - # Format predefined text on message reply. - def quoted_text(self, message): + @staticmethod + def quoted_text(message): + """Format predefined text on message reply.""" if not config.safeGetBoolean('bitmessagesettings', 'replybelow'): return '\n\n------------------------------------------------------\n' + message @@ -3112,7 +3128,7 @@ def on_action_InboxReply(self, reply_type=None): self.setSendFromComboBox(toAddressAtCurrentInboxRow) - quotedText = self.quoted_text( + quotedText = MyForm.quoted_text( text_type(messageAtCurrentInboxRow, 'utf-8', 'replace')) widget['message'].setPlainText(quotedText) if acct.subject[0:3] in ('Re:', 'RE:'): @@ -3978,12 +3994,12 @@ def on_context_menuInbox(self, point): popMenuInbox.addAction(self.actionReply) popMenuInbox.addAction(self.actionAddSenderToAddressBook) # pylint: disable=no-member - self.actionClipboardMessagelist = self.ui.inboxContextMenuToolbar.addAction( + actionClipboardMessagelist = self.ui.inboxContextMenuToolbar.addAction( _translate("MainWindow", "Copy subject to clipboard") if tableWidget.currentColumn() == 2 else _translate("MainWindow", "Copy address to clipboard"), self.on_action_ClipboardMessagelist) - popMenuInbox.addAction(self.actionClipboardMessagelist) + popMenuInbox.addAction(actionClipboardMessagelist) # pylint: disable=no-member self._contact_selected = tableWidget.item(currentRow, 1) # preloaded gui.menu plugins with prefix 'address' @@ -4229,7 +4245,7 @@ class BitmessageQtApplication(QtGui.QApplication): """ # Unique identifier for this application - uuid = '6ec0149b-96e1-4be1-93ab-1465fb3ebf7c' + UUID = '6ec0149b-96e1-4be1-93ab-1465fb3ebf7c' @staticmethod def get_windowstyle(): @@ -4241,7 +4257,6 @@ def get_windowstyle(): def __init__(self, *argv): super(BitmessageQtApplication, self).__init__(*argv) - id = BitmessageQtApplication.uuid QtCore.QCoreApplication.setOrganizationName("PyBitmessage") QtCore.QCoreApplication.setOrganizationDomain("bitmessage.org") @@ -4259,14 +4274,14 @@ def __init__(self, *argv): self.is_running = False socket = QLocalSocket() - socket.connectToServer(id) + socket.connectToServer(self.UUID) self.is_running = socket.waitForConnected() # Cleanup past crashed servers if not self.is_running: if socket.error() == QLocalSocket.ConnectionRefusedError: socket.disconnectFromServer() - QLocalServer.removeServer(id) + QLocalServer.removeServer(self.UUID) socket.abort() @@ -4278,8 +4293,8 @@ def __init__(self, *argv): # Nope, create a local server with this id and assign on_new_connection # for whenever a second instance tries to run focus the application. self.server = QLocalServer() - self.server.listen(id) - self.server.newConnection.connect(self.on_new_connection) + self.server.listen(self.UUID) + self.server.newConnection.connect(MyForm.on_new_connection) self.setStyleSheet("QStatusBar::item { border: 0px solid black }") @@ -4287,26 +4302,27 @@ def __del__(self): if self.server: self.server.close() - def on_new_connection(self): + @staticmethod + def on_new_connection(): if myapp: myapp.appIndicatorShow() def init(): - global app + global app # pylint: disable=global-statement if not app: app = BitmessageQtApplication(sys.argv) return app def run(): - global myapp - app = init() - myapp = MyForm() + global myapp # pylint: disable=global-statement + _app = init() + myapp = MyForm() # pylint: disable=redefined-outer-name myapp.appIndicatorInit(app) - if myapp._firstrun: + if myapp._firstrun: # pylint: disable=protected-access myapp.showConnectDialog() # ask the user if we may connect # only show after wizards and connect dialogs have completed @@ -4315,4 +4331,4 @@ def run(): QtCore.QTimer.singleShot( 30000, lambda: myapp.setStatusIcon(state.statusIconColor)) - app.exec_() + _app.exec_() diff --git a/src/bitmessageqt/account.py b/src/bitmessageqt/account.py index dcfb89236..37415cfd1 100644 --- a/src/bitmessageqt/account.py +++ b/src/bitmessageqt/account.py @@ -59,19 +59,19 @@ def getSortedSubscriptions(count=False): return ret -def accountClass(address): +def accountClass(address): # pylint: disable=too-many-return-statements """Return a BMAccount for the address""" if not config.has_section(address): # .. todo:: This BROADCAST section makes no sense if address == str_broadcast_subscribers: - subscription = BroadcastAccount(address) - if subscription.type != AccountMixin.BROADCAST: + subscriptionB = BroadcastAccount(address) + if subscriptionB.type != AccountMixin.BROADCAST: return None - else: - subscription = SubscriptionAccount(address) - if subscription.type != AccountMixin.SUBSCRIPTION: - # e.g. deleted chan - return NoAccount(address) + return subscriptionB + subscription = SubscriptionAccount(address) + if subscription.type != AccountMixin.SUBSCRIPTION: + # e.g. deleted chan + return NoAccount(address) return subscription try: gateway = config.get(address, "gateway") diff --git a/src/bitmessageqt/bitmessage_icons_rc.py b/src/bitmessageqt/bitmessage_icons_rc.py index e8d04eb24..f2020788b 100644 --- a/src/bitmessageqt/bitmessage_icons_rc.py +++ b/src/bitmessageqt/bitmessage_icons_rc.py @@ -7,6 +7,7 @@ # # WARNING! All changes made in this file will be lost! +# pylint: disable=too-many-lines from PyQt4 import QtCore # pylint: disable=import-error qt_resource_data = "\ diff --git a/src/bitmessageqt/foldertree.py b/src/bitmessageqt/foldertree.py index 6984f094a..f418f74dc 100644 --- a/src/bitmessageqt/foldertree.py +++ b/src/bitmessageqt/foldertree.py @@ -410,6 +410,7 @@ def setLabel(self, label=None): AccountMixin.NORMAL, AccountMixin.CHAN, AccountMixin.MAILINGLIST): try: + # pylint: disable=redefined-variable-type newLabel = unicode( config.get(self.address, 'label'), 'utf-8', 'ignore') diff --git a/src/bitmessageqt/migrationwizard.py b/src/bitmessageqt/migrationwizard.py index 83138059f..d5ba0d3dd 100644 --- a/src/bitmessageqt/migrationwizard.py +++ b/src/bitmessageqt/migrationwizard.py @@ -16,7 +16,7 @@ def __init__(self): layout.addWidget(label) self.setLayout(layout) - def nextId(self): + def nextId(self): # pylint: disable=no-self-use return 1 @@ -32,7 +32,7 @@ def __init__(self, addresses): # pylint: disable=unused-argument layout.addWidget(label) self.setLayout(layout) - def nextId(self): + def nextId(self): # pylint: disable=no-self-use return 10 @@ -48,7 +48,7 @@ def __init__(self): layout.addWidget(label) self.setLayout(layout) - def nextId(self): + def nextId(self): # pylint: disable=no-self-use return 10 @@ -66,6 +66,7 @@ def __init__(self): class Ui_MigrationWizard(QtGui.QWizard): + # pylint: disable=redefined-variable-type def __init__(self, addresses): super(QtGui.QWizard, self).__init__() diff --git a/src/bitmessageqt/uisignaler.py b/src/bitmessageqt/uisignaler.py index 3ee968b16..67aab3480 100644 --- a/src/bitmessageqt/uisignaler.py +++ b/src/bitmessageqt/uisignaler.py @@ -17,6 +17,7 @@ def get(cls): cls._instance = UISignaler() return cls._instance + # pylint: disable=too-many-branches def run(self): while True: command, data = queues.UISignalQueue.get() diff --git a/src/class_singleWorker.py b/src/class_singleWorker.py index 508eb4b00..7203ab4ed 100644 --- a/src/class_singleWorker.py +++ b/src/class_singleWorker.py @@ -1399,7 +1399,7 @@ def requestPubKey(self, toAddress): TTL = 2.5 * 24 * 60 * 60 TTL *= 2 ** retryNumber if TTL > 28 * 24 * 60 * 60: - TTL = 28 * 24 * 60 * 60 + TTL = float(28 * 24 * 60 * 60) # add some randomness to the TTL TTL = TTL + helper_random.randomrandrange(-300, 300) embeddedTime = int(time.time() + TTL) diff --git a/src/class_sqlThread.py b/src/class_sqlThread.py index ab9e1c31a..6b37d7cbe 100644 --- a/src/class_sqlThread.py +++ b/src/class_sqlThread.py @@ -108,8 +108,7 @@ def run(self): # usedpersonally field in their pubkeys table. Let's add it. if settingsversion == 2: item = '''ALTER TABLE pubkeys ADD usedpersonally text DEFAULT 'no' ''' - parameters = '' - self.cur.execute(item, parameters) + self.cur.execute(item) self.conn.commit() settingsversion = 3 @@ -119,16 +118,13 @@ def run(self): # in the inbox table. Let's add them. if settingsversion == 3: item = '''ALTER TABLE inbox ADD encodingtype int DEFAULT '2' ''' - parameters = '' - self.cur.execute(item, parameters) + self.cur.execute(item) item = '''ALTER TABLE inbox ADD read bool DEFAULT '1' ''' - parameters = '' - self.cur.execute(item, parameters) + self.cur.execute(item) item = '''ALTER TABLE sent ADD encodingtype int DEFAULT '2' ''' - parameters = '' - self.cur.execute(item, parameters) + self.cur.execute(item) self.conn.commit() settingsversion = 4 @@ -144,8 +140,7 @@ def run(self): # version we are on can stay embedded in the messages.dat file. Let us # check to see if the settings table exists yet. item = '''SELECT name FROM sqlite_master WHERE type='table' AND name='settings';''' - parameters = '' - self.cur.execute(item, parameters) + self.cur.execute(item) if self.cur.fetchall() == []: # The settings table doesn't exist. We need to make it. logger.debug( @@ -199,8 +194,7 @@ def run(self): # Let's get rid of the first20bytesofencryptedmessage field in # the inventory table. item = '''SELECT value FROM settings WHERE key='version';''' - parameters = '' - self.cur.execute(item, parameters) + self.cur.execute(item) if int(self.cur.fetchall()[0][0]) == 2: logger.debug( 'In messages.dat database, removing an obsolete field from' @@ -227,16 +221,14 @@ def run(self): # Add a new column to the inventory table to store tags. item = '''SELECT value FROM settings WHERE key='version';''' - parameters = '' - self.cur.execute(item, parameters) + self.cur.execute(item) currentVersion = int(self.cur.fetchall()[0][0]) if currentVersion == 1 or currentVersion == 3: logger.debug( 'In messages.dat database, adding tag field to' ' the inventory table.') item = '''ALTER TABLE inventory ADD tag blob DEFAULT '' ''' - parameters = '' - self.cur.execute(item, parameters) + self.cur.execute(item) item = '''update settings set value=? WHERE key='version';''' parameters = (4,) self.cur.execute(item, parameters) @@ -244,8 +236,7 @@ def run(self): # Add a new column to the pubkeys table to store the address version. # We're going to trash all of our pubkeys and let them be redownloaded. item = '''SELECT value FROM settings WHERE key='version';''' - parameters = '' - self.cur.execute(item, parameters) + self.cur.execute(item) currentVersion = int(self.cur.fetchall()[0][0]) if currentVersion == 4: self.cur.execute('''DROP TABLE pubkeys''') @@ -261,8 +252,7 @@ def run(self): # Add a new table: objectprocessorqueue with which to hold objects # that have yet to be processed if the user shuts down Bitmessage. item = '''SELECT value FROM settings WHERE key='version';''' - parameters = '' - self.cur.execute(item, parameters) + self.cur.execute(item) currentVersion = int(self.cur.fetchall()[0][0]) if currentVersion == 5: self.cur.execute('''DROP TABLE knownnodes''') @@ -277,8 +267,7 @@ def run(self): # In table inventory and objectprocessorqueue, objecttype is now # an integer (it was a human-friendly string previously) item = '''SELECT value FROM settings WHERE key='version';''' - parameters = '' - self.cur.execute(item, parameters) + self.cur.execute(item) currentVersion = int(self.cur.fetchall()[0][0]) if currentVersion == 6: logger.debug( @@ -303,8 +292,7 @@ def run(self): # clear it, and the pubkeys from inventory, so that they'll # be re-downloaded. item = '''SELECT value FROM settings WHERE key='version';''' - parameters = '' - self.cur.execute(item, parameters) + self.cur.execute(item) currentVersion = int(self.cur.fetchall()[0][0]) if currentVersion == 7: logger.debug( @@ -327,16 +315,14 @@ def run(self): # the message signature. We'll use this as temporary message UUID # in order to detect duplicates. item = '''SELECT value FROM settings WHERE key='version';''' - parameters = '' - self.cur.execute(item, parameters) + self.cur.execute(item) currentVersion = int(self.cur.fetchall()[0][0]) if currentVersion == 8: logger.debug( 'In messages.dat database, adding sighash field to' ' the inbox table.') item = '''ALTER TABLE inbox ADD sighash blob DEFAULT '' ''' - parameters = '' - self.cur.execute(item, parameters) + self.cur.execute(item) item = '''update settings set value=? WHERE key='version';''' parameters = (9,) self.cur.execute(item, parameters) @@ -345,8 +331,7 @@ def run(self): # can combine the pubkeyretrynumber and msgretrynumber into one. item = '''SELECT value FROM settings WHERE key='version';''' - parameters = '' - self.cur.execute(item, parameters) + self.cur.execute(item) currentVersion = int(self.cur.fetchall()[0][0]) if currentVersion == 9: logger.info( @@ -406,8 +391,7 @@ def run(self): # Update the address colunm to unique in addressbook table item = '''SELECT value FROM settings WHERE key='version';''' - parameters = '' - self.cur.execute(item, parameters) + self.cur.execute(item) currentVersion = int(self.cur.fetchall()[0][0]) if currentVersion == 10: logger.debug( @@ -470,8 +454,7 @@ def run(self): # Let us check to see the last time we vaccumed the messages.dat file. # If it has been more than a month let's do it now. item = '''SELECT value FROM settings WHERE key='lastvacuumtime';''' - parameters = '' - self.cur.execute(item, parameters) + self.cur.execute(item) queryreturn = self.cur.fetchall() for row in queryreturn: value, = row @@ -643,5 +626,5 @@ def create_function(self): self.conn.create_function("enaddr", 3, func=encodeAddress, deterministic=True) except (TypeError, sqlite3.NotSupportedError) as err: logger.debug( - "Got error while pass deterministic in sqlite create function {}, Passing 3 params".format(err)) + "Got error while pass deterministic in sqlite create function %s, Passing 3 params", err) self.conn.create_function("enaddr", 3, encodeAddress) diff --git a/src/helper_sent.py b/src/helper_sent.py index dda5d8f02..0efaba33b 100644 --- a/src/helper_sent.py +++ b/src/helper_sent.py @@ -16,7 +16,7 @@ def insert(msgid=None, toAddress='[Broadcast subscribers]', fromAddress=None, su lastActionTime=None, sleeptill=0, retryNumber=0, encoding=2, ttl=None, folder='sent'): """Perform an insert into the `sent` table""" # pylint: disable=unused-variable - # pylint: disable-msg=too-many-locals + # pylint: disable=too-many-locals valid_addr = True if not ripe or not ackdata: diff --git a/src/inventory.py b/src/inventory.py index 5b739e84b..b73fbd038 100644 --- a/src/inventory.py +++ b/src/inventory.py @@ -16,7 +16,7 @@ def create_inventory_instance(backend="sqlite"): "{}Inventory".format(backend.title()))() -class Inventory: +class Inventory(object): """ Inventory class which uses storage backends to manage the inventory. @@ -26,8 +26,8 @@ def __init__(self): self._realInventory = create_inventory_instance(self._moduleName) self.numberOfInventoryLookupsPerformed = 0 - # cheap inheritance copied from asyncore def __getattr__(self, attr): + """cheap inheritance copied from asyncore""" if attr == "__contains__": self.numberOfInventoryLookupsPerformed += 1 try: @@ -40,8 +40,8 @@ def __getattr__(self, attr): else: return realRet - # hint for pylint: this is dictionary like object def __getitem__(self, key): + """hint for pylint, this is dictionary like object""" return self._realInventory[key] def __setitem__(self, key, value): diff --git a/src/proofofwork.py b/src/proofofwork.py index 70733eb99..8568b24fd 100644 --- a/src/proofofwork.py +++ b/src/proofofwork.py @@ -367,6 +367,7 @@ def init(): except ValueError: try: # MinGW + # pylint: disable=redefined-variable-type bso = ctypes.CDLL(libfile) logger.info('Loaded C PoW DLL (cdecl) %s', BITMSGLIB) BMPOW = bso.BitmessagePOW diff --git a/src/pyelliptic/ecc.py b/src/pyelliptic/ecc.py index bfdc2dd68..0499b5175 100644 --- a/src/pyelliptic/ecc.py +++ b/src/pyelliptic/ecc.py @@ -62,7 +62,7 @@ def __init__( if isinstance(curve, str): self.curve = OpenSSL.get_curve(curve) else: - self.curve = curve + self.curve = curve # pylint: disable=redefined-variable-type if pubkey_x is not None and pubkey_y is not None: self._set_keys(pubkey_x, pubkey_y, raw_privkey)