1
0

minor, code style, imports

This commit is contained in:
Sander van Grieken
2024-02-05 21:25:13 +01:00
parent 4228911609
commit 482ec89b5d
5 changed files with 15 additions and 15 deletions

View File

@@ -9,8 +9,8 @@ from typing import TYPE_CHECKING, Set
from PyQt6.QtCore import (pyqtSlot, pyqtSignal, pyqtProperty, QObject, QT_VERSION_STR, PYQT_VERSION_STR,
qInstallMessageHandler, QTimer, QSortFilterProxyModel)
from PyQt6.QtGui import QGuiApplication, QFontDatabase, QScreen
from PyQt6.QtQml import qmlRegisterType, qmlRegisterUncreatableType, QQmlApplicationEngine
from PyQt6.QtGui import QGuiApplication, QFontDatabase
from PyQt6.QtQml import qmlRegisterType, QQmlApplicationEngine
import electrum
from electrum import version, constants
@@ -219,7 +219,7 @@ class QEAppController(BaseCrashReporter, QObject):
self.logger.debug(f'now {self._plugins.count()} plugins loaded')
plugin = self._plugins.get(plugin_name)
self.logger.debug(f'plugin with name {plugin_name} is {str(type(plugin))}')
if plugin and hasattr(plugin,'so'):
if plugin and hasattr(plugin, 'so'):
return plugin.so
else:
self.logger.debug('None!')
@@ -264,9 +264,9 @@ class QEAppController(BaseCrashReporter, QObject):
'reportstring': self.get_report_string()
}
@pyqtSlot(object,object,object,object)
@pyqtSlot(object, object, object, object)
def crash(self, config, e, text, tb):
self.exc_args = (e, text, tb) # for BaseCrashReporter
self.exc_args = (e, text, tb) # for BaseCrashReporter
self.showException.emit(self.crashData())
@pyqtSlot()
@@ -305,7 +305,7 @@ class QEAppController(BaseCrashReporter, QObject):
# if traceback contains special HTML characters, e.g. '<',
# they need to be escaped to avoid formatting issues.
traceback_str = super()._get_traceback_str_to_display()
return html.escape(traceback_str).replace('&#x27;','&apos;')
return html.escape(traceback_str).replace('&#x27;', '&apos;')
def get_user_description(self):
return self._crash_user_text

View File

@@ -23,7 +23,7 @@ from .qewallet import QEWallet
class QEChannelOpener(QObject, AuthMixin):
_logger = get_logger(__name__)
validationError = pyqtSignal([str,str], arguments=['code','message'])
validationError = pyqtSignal([str, str], arguments=['code', 'message'])
conflictingBackup = pyqtSignal([str], arguments=['message'])
channelOpening = pyqtSignal([str], arguments=['peer'])
channelOpenError = pyqtSignal([str], arguments=['message'])

View File

@@ -76,7 +76,7 @@ class QEWalletListModel(QAbstractListModel):
available.append(i.path)
for path in sorted(available):
wallet = self.daemon.get_wallet(path)
self.add_wallet(wallet_path = path)
self.add_wallet(wallet_path=path)
def add_wallet(self, wallet_path):
self.beginInsertRows(QModelIndex(), len(self._wallets), len(self._wallets))
@@ -142,10 +142,10 @@ class QEDaemon(AuthMixin, QObject):
loadingChanged = pyqtSignal()
requestNewPassword = pyqtSignal()
walletLoaded = pyqtSignal([str,str], arguments=['name','path'])
walletRequiresPassword = pyqtSignal([str,str], arguments=['name','path'])
walletLoaded = pyqtSignal([str, str], arguments=['name', 'path'])
walletRequiresPassword = pyqtSignal([str, str], arguments=['name', 'path'])
walletOpenError = pyqtSignal([str], arguments=["error"])
walletDeleteError = pyqtSignal([str,str], arguments=['code', 'message'])
walletDeleteError = pyqtSignal([str, str], arguments=['code', 'message'])
def __init__(self, daemon: 'Daemon', plugins: 'Plugins', parent=None):
super().__init__(parent)

View File

@@ -138,7 +138,7 @@ class QENetwork(QObject, QtEventListener):
if not histogram:
histogram = [[FEERATE_DEFAULT_RELAY/1000,1]]
# cap the histogram to a limited number of megabytes
bytes_limit=10*1000*1000
bytes_limit = 10*1000*1000
bytes_current = 0
capped_histogram = []
for item in sorted(histogram, key=lambda x: x[0], reverse=True):

View File

@@ -236,7 +236,7 @@ class QETransactionListModel(QAbstractListModel, QtEventListener):
tx['timestamp'] = info.timestamp
tx['section'] = self.get_section_by_timestamp(info.timestamp)
tx['date'] = self.format_date_by_section(tx['section'], datetime.fromtimestamp(info.timestamp))
index = self.index(i,0)
index = self.index(i, 0)
roles = [self._ROLE_RMAP[x] for x in ['section', 'height', 'confirmations', 'timestamp', 'date']]
self.dataChanged.emit(index, index, roles)
return
@@ -264,7 +264,7 @@ class QETransactionListModel(QAbstractListModel, QtEventListener):
for i, tx in enumerate(self.tx_history):
if tx['key'] == key:
tx['label'] = label
index = self.index(i,0)
index = self.index(i, 0)
self.dataChanged.emit(index, index, [self._ROLE_RMAP['label']])
return
@@ -275,7 +275,7 @@ class QETransactionListModel(QAbstractListModel, QtEventListener):
if 'height' in tx_item:
if tx_item['height'] > 0:
tx_item['confirmations'] = height - tx_item['height'] + 1
index = self.index(i,0)
index = self.index(i, 0)
roles = [self._ROLE_RMAP['confirmations']]
self.dataChanged.emit(index, index, roles)
elif tx_item['height'] in (TX_HEIGHT_FUTURE, TX_HEIGHT_LOCAL):