flake8: enable more mandatory tests
This commit is contained in:
+4
-1
@@ -149,7 +149,10 @@ task:
|
||||
matrix:
|
||||
- name: Flake8 Mandatory
|
||||
env:
|
||||
ELECTRUM_LINTERS: E9,F63,F7,F82,W191
|
||||
# list of error codes:
|
||||
# - https://flake8.pycqa.org/en/latest/user/error-codes.html
|
||||
# - https://pycodestyle.pycqa.org/en/latest/intro.html#error-codes
|
||||
ELECTRUM_LINTERS: E9,E101,E129,E273,E274,E703,E71,F63,F7,F82,W191,W29
|
||||
- name: Flake8 Non-Mandatory
|
||||
env:
|
||||
ELECTRUM_LINTERS: E,F,W,C90
|
||||
|
||||
@@ -11,7 +11,7 @@ class ApkDiff:
|
||||
sourceZip = ZipFile(sourceApk, 'r')
|
||||
destinationZip = ZipFile(destinationApk, 'r')
|
||||
|
||||
if self.compareManifests(sourceZip, destinationZip) and self.compareEntries(sourceZip, destinationZip) == True:
|
||||
if self.compareManifests(sourceZip, destinationZip) and self.compareEntries(sourceZip, destinationZip):
|
||||
print("APKs match!")
|
||||
return True
|
||||
else:
|
||||
@@ -50,7 +50,7 @@ class ApkDiff:
|
||||
sourceEntry = sourceZip.open(sourceEntryInfo, 'r')
|
||||
destinationEntry = destinationZip.open(destinationEntryInfo, 'r')
|
||||
|
||||
if self.compareFiles(sourceEntry, destinationEntry) != True:
|
||||
if not self.compareFiles(sourceEntry, destinationEntry):
|
||||
print("APK entry %s does not match %s!" % (sourceEntryInfo.filename, destinationEntryInfo.filename))
|
||||
return False
|
||||
|
||||
|
||||
@@ -482,7 +482,7 @@ COIN_CHOOSERS = {
|
||||
|
||||
def get_name(config):
|
||||
kind = config.get('coin_chooser')
|
||||
if not kind in COIN_CHOOSERS:
|
||||
if kind not in COIN_CHOOSERS:
|
||||
kind = 'Privacy'
|
||||
return kind
|
||||
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
|
||||
|
||||
@@ -135,7 +135,7 @@ class Drawer(Factory.RelativeLayout):
|
||||
return
|
||||
|
||||
def on_touch_move(self, touch):
|
||||
if not touch.grab_current is self:
|
||||
if touch.grab_current is not self:
|
||||
return
|
||||
self._touch = False
|
||||
# skip on tablet mode
|
||||
@@ -175,7 +175,7 @@ class Drawer(Factory.RelativeLayout):
|
||||
return
|
||||
|
||||
def on_touch_up(self, touch):
|
||||
if not touch.grab_current is self:
|
||||
if touch.grab_current is not self:
|
||||
return
|
||||
|
||||
self._triigger_gc()
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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']:
|
||||
|
||||
@@ -79,7 +79,7 @@ class QrReaderValidatorCounting(AbstractQrReaderValidator):
|
||||
|
||||
for result in results:
|
||||
# Increment the detection count
|
||||
if not result in self.result_counts:
|
||||
if result not in self.result_counts:
|
||||
self.result_counts[result] = 0
|
||||
self.result_counts[result] += 1
|
||||
|
||||
|
||||
@@ -138,7 +138,7 @@ class ElectrumGui(BaseElectrumGui, EventListener):
|
||||
else:
|
||||
msg = _("Not connected")
|
||||
|
||||
return(msg)
|
||||
return msg
|
||||
|
||||
|
||||
def print_contacts(self):
|
||||
|
||||
+1
-1
@@ -246,7 +246,7 @@ def lnencode(addr: 'LnAddr', privkey) -> str:
|
||||
# both.
|
||||
if 'd' in tags_set and 'h' in tags_set:
|
||||
raise ValueError("Cannot include both 'd' and 'h'")
|
||||
if not 'd' in tags_set and not 'h' in tags_set:
|
||||
if 'd' not in tags_set and 'h' not in tags_set:
|
||||
raise ValueError("Must include either 'd' or 'h'")
|
||||
|
||||
# We actually sign the hrp, then data (padded to 8 bits with zeroes).
|
||||
|
||||
@@ -350,8 +350,8 @@ class DigitalBitbox_Client(HardwareClientBase):
|
||||
HWW_CID = 0xFF000000
|
||||
HWW_CMD = 0x80 + 0x40 + 0x01
|
||||
data_len = len(data)
|
||||
seq = 0;
|
||||
idx = 0;
|
||||
seq = 0
|
||||
idx = 0
|
||||
write = []
|
||||
while idx < data_len:
|
||||
if idx == 0:
|
||||
@@ -373,7 +373,7 @@ class DigitalBitbox_Client(HardwareClientBase):
|
||||
cmd = read[4]
|
||||
data_len = read[5] * 256 + read[6]
|
||||
data = read[7:]
|
||||
idx = len(read) - 7;
|
||||
idx = len(read) - 7
|
||||
while idx < data_len:
|
||||
# CONT response
|
||||
read = bytearray(self.dbb_hid.read(self.usbReportSize))
|
||||
|
||||
@@ -330,7 +330,7 @@ class Plugin(RevealerPlugin):
|
||||
|
||||
painter.end()
|
||||
img = bitmap.toImage()
|
||||
if (self.rawnoise == False):
|
||||
if not self.rawnoise:
|
||||
self.make_rawnoise()
|
||||
|
||||
self.make_cypherseed(img, self.rawnoise, False, is_seed)
|
||||
|
||||
+91
-91
@@ -159,96 +159,96 @@ def RMD160Transform(state, block): #uint32 state[5], uchar block[64]
|
||||
e = state[4]
|
||||
|
||||
#/* Round 1 */
|
||||
a, c = R(a, b, c, d, e, F0, K0, 11, 0, x);
|
||||
e, b = R(e, a, b, c, d, F0, K0, 14, 1, x);
|
||||
d, a = R(d, e, a, b, c, F0, K0, 15, 2, x);
|
||||
c, e = R(c, d, e, a, b, F0, K0, 12, 3, x);
|
||||
b, d = R(b, c, d, e, a, F0, K0, 5, 4, x);
|
||||
a, c = R(a, b, c, d, e, F0, K0, 8, 5, x);
|
||||
e, b = R(e, a, b, c, d, F0, K0, 7, 6, x);
|
||||
d, a = R(d, e, a, b, c, F0, K0, 9, 7, x);
|
||||
c, e = R(c, d, e, a, b, F0, K0, 11, 8, x);
|
||||
b, d = R(b, c, d, e, a, F0, K0, 13, 9, x);
|
||||
a, c = R(a, b, c, d, e, F0, K0, 14, 10, x);
|
||||
e, b = R(e, a, b, c, d, F0, K0, 15, 11, x);
|
||||
d, a = R(d, e, a, b, c, F0, K0, 6, 12, x);
|
||||
c, e = R(c, d, e, a, b, F0, K0, 7, 13, x);
|
||||
b, d = R(b, c, d, e, a, F0, K0, 9, 14, x);
|
||||
a, c = R(a, b, c, d, e, F0, K0, 8, 15, x); #/* #15 */
|
||||
a, c = R(a, b, c, d, e, F0, K0, 11, 0, x)
|
||||
e, b = R(e, a, b, c, d, F0, K0, 14, 1, x)
|
||||
d, a = R(d, e, a, b, c, F0, K0, 15, 2, x)
|
||||
c, e = R(c, d, e, a, b, F0, K0, 12, 3, x)
|
||||
b, d = R(b, c, d, e, a, F0, K0, 5, 4, x)
|
||||
a, c = R(a, b, c, d, e, F0, K0, 8, 5, x)
|
||||
e, b = R(e, a, b, c, d, F0, K0, 7, 6, x)
|
||||
d, a = R(d, e, a, b, c, F0, K0, 9, 7, x)
|
||||
c, e = R(c, d, e, a, b, F0, K0, 11, 8, x)
|
||||
b, d = R(b, c, d, e, a, F0, K0, 13, 9, x)
|
||||
a, c = R(a, b, c, d, e, F0, K0, 14, 10, x)
|
||||
e, b = R(e, a, b, c, d, F0, K0, 15, 11, x)
|
||||
d, a = R(d, e, a, b, c, F0, K0, 6, 12, x)
|
||||
c, e = R(c, d, e, a, b, F0, K0, 7, 13, x)
|
||||
b, d = R(b, c, d, e, a, F0, K0, 9, 14, x)
|
||||
a, c = R(a, b, c, d, e, F0, K0, 8, 15, x) #/* #15 */
|
||||
#/* Round 2 */
|
||||
e, b = R(e, a, b, c, d, F1, K1, 7, 7, x);
|
||||
d, a = R(d, e, a, b, c, F1, K1, 6, 4, x);
|
||||
c, e = R(c, d, e, a, b, F1, K1, 8, 13, x);
|
||||
b, d = R(b, c, d, e, a, F1, K1, 13, 1, x);
|
||||
a, c = R(a, b, c, d, e, F1, K1, 11, 10, x);
|
||||
e, b = R(e, a, b, c, d, F1, K1, 9, 6, x);
|
||||
d, a = R(d, e, a, b, c, F1, K1, 7, 15, x);
|
||||
c, e = R(c, d, e, a, b, F1, K1, 15, 3, x);
|
||||
b, d = R(b, c, d, e, a, F1, K1, 7, 12, x);
|
||||
a, c = R(a, b, c, d, e, F1, K1, 12, 0, x);
|
||||
e, b = R(e, a, b, c, d, F1, K1, 15, 9, x);
|
||||
d, a = R(d, e, a, b, c, F1, K1, 9, 5, x);
|
||||
c, e = R(c, d, e, a, b, F1, K1, 11, 2, x);
|
||||
b, d = R(b, c, d, e, a, F1, K1, 7, 14, x);
|
||||
a, c = R(a, b, c, d, e, F1, K1, 13, 11, x);
|
||||
e, b = R(e, a, b, c, d, F1, K1, 12, 8, x); #/* #31 */
|
||||
e, b = R(e, a, b, c, d, F1, K1, 7, 7, x)
|
||||
d, a = R(d, e, a, b, c, F1, K1, 6, 4, x)
|
||||
c, e = R(c, d, e, a, b, F1, K1, 8, 13, x)
|
||||
b, d = R(b, c, d, e, a, F1, K1, 13, 1, x)
|
||||
a, c = R(a, b, c, d, e, F1, K1, 11, 10, x)
|
||||
e, b = R(e, a, b, c, d, F1, K1, 9, 6, x)
|
||||
d, a = R(d, e, a, b, c, F1, K1, 7, 15, x)
|
||||
c, e = R(c, d, e, a, b, F1, K1, 15, 3, x)
|
||||
b, d = R(b, c, d, e, a, F1, K1, 7, 12, x)
|
||||
a, c = R(a, b, c, d, e, F1, K1, 12, 0, x)
|
||||
e, b = R(e, a, b, c, d, F1, K1, 15, 9, x)
|
||||
d, a = R(d, e, a, b, c, F1, K1, 9, 5, x)
|
||||
c, e = R(c, d, e, a, b, F1, K1, 11, 2, x)
|
||||
b, d = R(b, c, d, e, a, F1, K1, 7, 14, x)
|
||||
a, c = R(a, b, c, d, e, F1, K1, 13, 11, x)
|
||||
e, b = R(e, a, b, c, d, F1, K1, 12, 8, x) #/* #31 */
|
||||
#/* Round 3 */
|
||||
d, a = R(d, e, a, b, c, F2, K2, 11, 3, x);
|
||||
c, e = R(c, d, e, a, b, F2, K2, 13, 10, x);
|
||||
b, d = R(b, c, d, e, a, F2, K2, 6, 14, x);
|
||||
a, c = R(a, b, c, d, e, F2, K2, 7, 4, x);
|
||||
e, b = R(e, a, b, c, d, F2, K2, 14, 9, x);
|
||||
d, a = R(d, e, a, b, c, F2, K2, 9, 15, x);
|
||||
c, e = R(c, d, e, a, b, F2, K2, 13, 8, x);
|
||||
b, d = R(b, c, d, e, a, F2, K2, 15, 1, x);
|
||||
a, c = R(a, b, c, d, e, F2, K2, 14, 2, x);
|
||||
e, b = R(e, a, b, c, d, F2, K2, 8, 7, x);
|
||||
d, a = R(d, e, a, b, c, F2, K2, 13, 0, x);
|
||||
c, e = R(c, d, e, a, b, F2, K2, 6, 6, x);
|
||||
b, d = R(b, c, d, e, a, F2, K2, 5, 13, x);
|
||||
a, c = R(a, b, c, d, e, F2, K2, 12, 11, x);
|
||||
e, b = R(e, a, b, c, d, F2, K2, 7, 5, x);
|
||||
d, a = R(d, e, a, b, c, F2, K2, 5, 12, x); #/* #47 */
|
||||
d, a = R(d, e, a, b, c, F2, K2, 11, 3, x)
|
||||
c, e = R(c, d, e, a, b, F2, K2, 13, 10, x)
|
||||
b, d = R(b, c, d, e, a, F2, K2, 6, 14, x)
|
||||
a, c = R(a, b, c, d, e, F2, K2, 7, 4, x)
|
||||
e, b = R(e, a, b, c, d, F2, K2, 14, 9, x)
|
||||
d, a = R(d, e, a, b, c, F2, K2, 9, 15, x)
|
||||
c, e = R(c, d, e, a, b, F2, K2, 13, 8, x)
|
||||
b, d = R(b, c, d, e, a, F2, K2, 15, 1, x)
|
||||
a, c = R(a, b, c, d, e, F2, K2, 14, 2, x)
|
||||
e, b = R(e, a, b, c, d, F2, K2, 8, 7, x)
|
||||
d, a = R(d, e, a, b, c, F2, K2, 13, 0, x)
|
||||
c, e = R(c, d, e, a, b, F2, K2, 6, 6, x)
|
||||
b, d = R(b, c, d, e, a, F2, K2, 5, 13, x)
|
||||
a, c = R(a, b, c, d, e, F2, K2, 12, 11, x)
|
||||
e, b = R(e, a, b, c, d, F2, K2, 7, 5, x)
|
||||
d, a = R(d, e, a, b, c, F2, K2, 5, 12, x) #/* #47 */
|
||||
#/* Round 4 */
|
||||
c, e = R(c, d, e, a, b, F3, K3, 11, 1, x);
|
||||
b, d = R(b, c, d, e, a, F3, K3, 12, 9, x);
|
||||
a, c = R(a, b, c, d, e, F3, K3, 14, 11, x);
|
||||
e, b = R(e, a, b, c, d, F3, K3, 15, 10, x);
|
||||
d, a = R(d, e, a, b, c, F3, K3, 14, 0, x);
|
||||
c, e = R(c, d, e, a, b, F3, K3, 15, 8, x);
|
||||
b, d = R(b, c, d, e, a, F3, K3, 9, 12, x);
|
||||
a, c = R(a, b, c, d, e, F3, K3, 8, 4, x);
|
||||
e, b = R(e, a, b, c, d, F3, K3, 9, 13, x);
|
||||
d, a = R(d, e, a, b, c, F3, K3, 14, 3, x);
|
||||
c, e = R(c, d, e, a, b, F3, K3, 5, 7, x);
|
||||
b, d = R(b, c, d, e, a, F3, K3, 6, 15, x);
|
||||
a, c = R(a, b, c, d, e, F3, K3, 8, 14, x);
|
||||
e, b = R(e, a, b, c, d, F3, K3, 6, 5, x);
|
||||
d, a = R(d, e, a, b, c, F3, K3, 5, 6, x);
|
||||
c, e = R(c, d, e, a, b, F3, K3, 12, 2, x); #/* #63 */
|
||||
c, e = R(c, d, e, a, b, F3, K3, 11, 1, x)
|
||||
b, d = R(b, c, d, e, a, F3, K3, 12, 9, x)
|
||||
a, c = R(a, b, c, d, e, F3, K3, 14, 11, x)
|
||||
e, b = R(e, a, b, c, d, F3, K3, 15, 10, x)
|
||||
d, a = R(d, e, a, b, c, F3, K3, 14, 0, x)
|
||||
c, e = R(c, d, e, a, b, F3, K3, 15, 8, x)
|
||||
b, d = R(b, c, d, e, a, F3, K3, 9, 12, x)
|
||||
a, c = R(a, b, c, d, e, F3, K3, 8, 4, x)
|
||||
e, b = R(e, a, b, c, d, F3, K3, 9, 13, x)
|
||||
d, a = R(d, e, a, b, c, F3, K3, 14, 3, x)
|
||||
c, e = R(c, d, e, a, b, F3, K3, 5, 7, x)
|
||||
b, d = R(b, c, d, e, a, F3, K3, 6, 15, x)
|
||||
a, c = R(a, b, c, d, e, F3, K3, 8, 14, x)
|
||||
e, b = R(e, a, b, c, d, F3, K3, 6, 5, x)
|
||||
d, a = R(d, e, a, b, c, F3, K3, 5, 6, x)
|
||||
c, e = R(c, d, e, a, b, F3, K3, 12, 2, x) #/* #63 */
|
||||
#/* Round 5 */
|
||||
b, d = R(b, c, d, e, a, F4, K4, 9, 4, x);
|
||||
a, c = R(a, b, c, d, e, F4, K4, 15, 0, x);
|
||||
e, b = R(e, a, b, c, d, F4, K4, 5, 5, x);
|
||||
d, a = R(d, e, a, b, c, F4, K4, 11, 9, x);
|
||||
c, e = R(c, d, e, a, b, F4, K4, 6, 7, x);
|
||||
b, d = R(b, c, d, e, a, F4, K4, 8, 12, x);
|
||||
a, c = R(a, b, c, d, e, F4, K4, 13, 2, x);
|
||||
e, b = R(e, a, b, c, d, F4, K4, 12, 10, x);
|
||||
d, a = R(d, e, a, b, c, F4, K4, 5, 14, x);
|
||||
c, e = R(c, d, e, a, b, F4, K4, 12, 1, x);
|
||||
b, d = R(b, c, d, e, a, F4, K4, 13, 3, x);
|
||||
a, c = R(a, b, c, d, e, F4, K4, 14, 8, x);
|
||||
e, b = R(e, a, b, c, d, F4, K4, 11, 11, x);
|
||||
d, a = R(d, e, a, b, c, F4, K4, 8, 6, x);
|
||||
c, e = R(c, d, e, a, b, F4, K4, 5, 15, x);
|
||||
b, d = R(b, c, d, e, a, F4, K4, 6, 13, x); #/* #79 */
|
||||
b, d = R(b, c, d, e, a, F4, K4, 9, 4, x)
|
||||
a, c = R(a, b, c, d, e, F4, K4, 15, 0, x)
|
||||
e, b = R(e, a, b, c, d, F4, K4, 5, 5, x)
|
||||
d, a = R(d, e, a, b, c, F4, K4, 11, 9, x)
|
||||
c, e = R(c, d, e, a, b, F4, K4, 6, 7, x)
|
||||
b, d = R(b, c, d, e, a, F4, K4, 8, 12, x)
|
||||
a, c = R(a, b, c, d, e, F4, K4, 13, 2, x)
|
||||
e, b = R(e, a, b, c, d, F4, K4, 12, 10, x)
|
||||
d, a = R(d, e, a, b, c, F4, K4, 5, 14, x)
|
||||
c, e = R(c, d, e, a, b, F4, K4, 12, 1, x)
|
||||
b, d = R(b, c, d, e, a, F4, K4, 13, 3, x)
|
||||
a, c = R(a, b, c, d, e, F4, K4, 14, 8, x)
|
||||
e, b = R(e, a, b, c, d, F4, K4, 11, 11, x)
|
||||
d, a = R(d, e, a, b, c, F4, K4, 8, 6, x)
|
||||
c, e = R(c, d, e, a, b, F4, K4, 5, 15, x)
|
||||
b, d = R(b, c, d, e, a, F4, K4, 6, 13, x) #/* #79 */
|
||||
|
||||
aa = a;
|
||||
bb = b;
|
||||
cc = c;
|
||||
dd = d;
|
||||
ee = e;
|
||||
aa = a
|
||||
bb = b
|
||||
cc = c
|
||||
dd = d
|
||||
ee = e
|
||||
|
||||
a = state[0]
|
||||
b = state[1]
|
||||
@@ -342,12 +342,12 @@ def RMD160Transform(state, block): #uint32 state[5], uchar block[64]
|
||||
c, e = R(c, d, e, a, b, F0, KK4, 11, 9, x)
|
||||
b, d = R(b, c, d, e, a, F0, KK4, 11, 11, x) #/* #79 */
|
||||
|
||||
t = (state[1] + cc + d) % 0x100000000;
|
||||
state[1] = (state[2] + dd + e) % 0x100000000;
|
||||
state[2] = (state[3] + ee + a) % 0x100000000;
|
||||
state[3] = (state[4] + aa + b) % 0x100000000;
|
||||
state[4] = (state[0] + bb + c) % 0x100000000;
|
||||
state[0] = t % 0x100000000;
|
||||
t = (state[1] + cc + d) % 0x100000000
|
||||
state[1] = (state[2] + dd + e) % 0x100000000
|
||||
state[2] = (state[3] + ee + a) % 0x100000000
|
||||
state[3] = (state[4] + aa + b) % 0x100000000
|
||||
state[4] = (state[0] + bb + c) % 0x100000000
|
||||
state[0] = t % 0x100000000
|
||||
|
||||
pass
|
||||
|
||||
|
||||
+2
-2
@@ -49,11 +49,11 @@ def SHA1(x):
|
||||
# Check that os.urandom works
|
||||
import zlib
|
||||
length = len(zlib.compress(os.urandom(1000)))
|
||||
assert(length > 900)
|
||||
assert length > 900
|
||||
|
||||
def getRandomBytes(howMany):
|
||||
b = bytearray(os.urandom(howMany))
|
||||
assert(len(b) == howMany)
|
||||
assert len(b) == howMany
|
||||
return b
|
||||
|
||||
prngName = "os.urandom"
|
||||
|
||||
@@ -69,7 +69,7 @@ async def worker(work_queue: asyncio.Queue, results_queue: asyncio.Queue, flag):
|
||||
# only check non-onion addresses
|
||||
addr = None
|
||||
for a in work['addrs']:
|
||||
if not "onion" in a[0]:
|
||||
if "onion" not in a[0]:
|
||||
addr = a
|
||||
if not addr:
|
||||
await results_queue.put(None)
|
||||
|
||||
@@ -1935,13 +1935,13 @@ class PartialTransaction(Transaction):
|
||||
hashPrevouts = bip143_shared_txdigest_fields.hashPrevouts
|
||||
else:
|
||||
hashPrevouts = '00' * 32
|
||||
if (not(sighash & Sighash.ANYONECANPAY) and (sighash & 0x1f) != Sighash.SINGLE and (sighash & 0x1f) != Sighash.NONE):
|
||||
if not (sighash & Sighash.ANYONECANPAY) and (sighash & 0x1f) != Sighash.SINGLE and (sighash & 0x1f) != Sighash.NONE:
|
||||
hashSequence = bip143_shared_txdigest_fields.hashSequence
|
||||
else:
|
||||
hashSequence = '00' * 32
|
||||
if ((sighash & 0x1f) != Sighash.SINGLE and (sighash & 0x1f) != Sighash.NONE):
|
||||
if (sighash & 0x1f) != Sighash.SINGLE and (sighash & 0x1f) != Sighash.NONE:
|
||||
hashOutputs = bip143_shared_txdigest_fields.hashOutputs
|
||||
elif ((sighash & 0x1f) == Sighash.SINGLE and txin_index < len(outputs)):
|
||||
elif (sighash & 0x1f) == Sighash.SINGLE and txin_index < len(outputs):
|
||||
hashOutputs = bh2u(sha256d(outputs[txin_index].serialize_to_network()))
|
||||
else:
|
||||
hashOutputs = '00' * 32
|
||||
|
||||
+3
-3
@@ -61,7 +61,7 @@ class AbstractWizard:
|
||||
else:
|
||||
self._logger.error(f'accept handler for view {view} not callable')
|
||||
|
||||
if not 'next' in nav:
|
||||
if 'next' not in nav:
|
||||
# finished
|
||||
self.finished(wizard_data)
|
||||
return (None, wizard_data, {})
|
||||
@@ -107,7 +107,7 @@ class AbstractWizard:
|
||||
|
||||
nav = self.navmap[view]
|
||||
|
||||
if not 'last' in nav:
|
||||
if 'last' not in nav:
|
||||
return False
|
||||
|
||||
lastnav = nav['last']
|
||||
@@ -219,7 +219,7 @@ class NewWalletWizard(AbstractWizard):
|
||||
storage = WalletStorage(path)
|
||||
|
||||
k = None
|
||||
if not 'keystore_type' in data:
|
||||
if 'keystore_type' not in data:
|
||||
assert data['wallet_type'] == 'imported'
|
||||
addresses = {}
|
||||
if 'private_key_list' in data:
|
||||
|
||||
Reference in New Issue
Block a user