1
0

flake8: enable more mandatory tests

This commit is contained in:
SomberNight
2022-10-31 16:13:22 +00:00
parent 7db396aad9
commit 01b5e3f8e0
32 changed files with 173 additions and 171 deletions

View File

@@ -52,9 +52,9 @@ class ElectrumGui(Logger):
if hasattr(QGuiApplication, 'setDesktopFileName'):
QGuiApplication.setDesktopFileName('electrum.desktop')
if hasattr(QtCore.Qt, "AA_EnableHighDpiScaling"):
QtCore.QCoreApplication.setAttribute(QtCore.Qt.AA_EnableHighDpiScaling);
QtCore.QCoreApplication.setAttribute(QtCore.Qt.AA_EnableHighDpiScaling)
if not "QT_QUICK_CONTROLS_STYLE" in os.environ:
if "QT_QUICK_CONTROLS_STYLE" not in os.environ:
os.environ["QT_QUICK_CONTROLS_STYLE"] = "Material"
self.gui_thread = threading.current_thread()

View File

@@ -125,5 +125,5 @@ class QEAddressDetails(QObject):
if self._wallet.derivationPrefix:
self._derivationPath = self._derivationPath.replace('m', self._wallet.derivationPrefix)
self._numtx = self._wallet.wallet.adb.get_address_history_len(self._address)
assert(self._numtx == self.historyModel.rowCount(0))
assert self._numtx == self.historyModel.rowCount(0)
self.detailsChanged.emit()

View File

@@ -44,25 +44,25 @@ class QEWalletListModel(QAbstractListModel):
if role_name == 'path':
return wallet_path
if role_name == 'active':
return wallet != None
return wallet is not None
def add_wallet(self, wallet_path = None, wallet: Abstract_Wallet = None):
if wallet_path == None and wallet == None:
if wallet_path is None and wallet is None:
return
# only add wallet instance if instance not yet in model
if wallet:
for name,path,w in self.wallets:
if w == wallet:
return
self.beginInsertRows(QModelIndex(), len(self.wallets), len(self.wallets));
if wallet == None:
self.beginInsertRows(QModelIndex(), len(self.wallets), len(self.wallets))
if wallet is None:
wallet_name = os.path.basename(wallet_path)
else:
wallet_name = wallet.basename()
wallet_path = standardize_path(wallet_path)
item = (wallet_name, wallet_path, wallet)
self.wallets.append(item);
self.endInsertRows();
self.wallets.append(item)
self.endInsertRows()
def remove_wallet(self, path):
i = 0
@@ -148,7 +148,7 @@ class QEDaemon(AuthMixin, QObject):
@pyqtSlot(str)
@pyqtSlot(str, str)
def load_wallet(self, path=None, password=None):
if path == None:
if path is None:
self._path = self.daemon.config.get('wallet_path') # command line -w option
if self._path is None:
self._path = self.daemon.config.get('gui_last_wallet')
@@ -175,7 +175,7 @@ class QEDaemon(AuthMixin, QObject):
try:
wallet = self.daemon.load_wallet(self._path, password)
if wallet != None:
if wallet is not None:
self._current_wallet = QEWallet.getInstanceFor(wallet)
if not wallet_already_open:
self._loaded_wallets.add_wallet(wallet_path=self._path, wallet=wallet)

View File

@@ -37,7 +37,7 @@ class QEQRParser(QObject):
self._logger.warning("Already processing an image. Check 'busy' property before calling scanImage")
return
if image == None:
if image is None:
self._logger.warning("No image to decode")
return

View File

@@ -59,7 +59,7 @@ class QETransactionListModel(QAbstractListModel):
item['key'] = item['txid'] if 'txid' in item else item['payment_hash']
if not 'lightning' in item:
if 'lightning' not in item:
item['lightning'] = False
if item['lightning']: