diff --git a/contrib/deterministic-build/find_restricted_dependencies.py b/contrib/deterministic-build/find_restricted_dependencies.py index 2bcb90b40077..9562f7a13ce1 100755 --- a/contrib/deterministic-build/find_restricted_dependencies.py +++ b/contrib/deterministic-build/find_restricted_dependencies.py @@ -42,10 +42,8 @@ def check_restriction(p, r): if check_restriction(dep, restricted): print(dep_basename, sep=" ") print( - ( - f"Installing {dep} from {p} although it is only needed for " - f"{restricted}" - ), + f"Installing {dep} from {p} although it is only needed for " + f"{restricted}", file=sys.stderr, ) except TypeError: diff --git a/electrumabc/asert_daa.py b/electrumabc/asert_daa.py index 9819e4dcc6a2..add25f022f14 100644 --- a/electrumabc/asert_daa.py +++ b/electrumabc/asert_daa.py @@ -51,8 +51,9 @@ def _get_asert_activation_mtp(): pass if not isinstance(mtp, int) or mtp <= 1510600000: print_error( - "Error: Environment variable ASERT_MTP ignored because it is invalid: {}" - .format(str(mtp)) + "Error: Environment variable ASERT_MTP ignored because it is invalid: {}".format( + str(mtp) + ) ) mtp = default_mtp if mtp != default_mtp: diff --git a/electrumabc/caches.py b/electrumabc/caches.py index 76893a5eb2ee..71d668d9566f 100644 --- a/electrumabc/caches.py +++ b/electrumabc/caches.py @@ -71,9 +71,9 @@ def get(self, key, default=None): res = self.d.get(key) if res is not None: # cache hit - res[0] = ( - _ExpiringCacheMgr.tick - ) # update tick access time for this cache hit + res[ + 0 + ] = _ExpiringCacheMgr.tick # update tick access time for this cache hit return res[1] # cache miss return default @@ -355,10 +355,8 @@ def inner(obj): ) except Exception as e: warnings.warn( - ( - f"warning: unable to process object '{obj}' due to" - f" exception: {repr(e)}" - ), + f"warning: unable to process object '{obj}' due to" + f" exception: {repr(e)}", RuntimeWarning, stacklevel=2, ) diff --git a/electrumabc/commands.py b/electrumabc/commands.py index c2221e14103c..68907f82dcbc 100644 --- a/electrumabc/commands.py +++ b/electrumabc/commands.py @@ -849,7 +849,9 @@ def trigger_callback(self, *args, **kwargs): q.get(timeout=min(max(time_remaining() / 2.0, 0.001), 10.0)) except queue.Empty: pass - kwargs["fee_calc_timeout"] = ( + kwargs[ + "fee_calc_timeout" + ] = ( time_remaining() ) # since we blocked above, recompute time_remaining for kwargs return self.wallet.export_history(**kwargs) diff --git a/electrumabc/dnssec.py b/electrumabc/dnssec.py index 6a873d5e1f11..659aee183e8d 100644 --- a/electrumabc/dnssec.py +++ b/electrumabc/dnssec.py @@ -206,10 +206,8 @@ def new(self): 1, "IN", "DNSKEY", - ( - "257 3 8" - " AwEAAaz/tAm8yTn4Mfeh5eyI96WSVexTBAvkMgJzkKTOiW1vkIbzxeF3+/4RgWOq7HrxRixHlFlExOLAJr5emLvN7SWXgnLh4+B5xQlNVz8Og8kvArMtNROxVQuCaSnIDdD5LKyWbRd2n9WGe2R8PzgCmr3EgVLrjyBxWezF0jLHwVN8efS3rCj/EWgvIWgb9tarpVUDK/b58Da+sqqls3eNbuv7pr+eoZG+SrDK6nWeL3c6H5Apxz7LjVc1uTIdsIXxuOLYA4/ilBmSVIzuDWfdRUfhHdY6+cn8HFRm+2hM8AnXGXws9555KrUB5qihylGa8subX2Nn6UwNR1AkUTV74bU=" - ), + "257 3 8" + " AwEAAaz/tAm8yTn4Mfeh5eyI96WSVexTBAvkMgJzkKTOiW1vkIbzxeF3+/4RgWOq7HrxRixHlFlExOLAJr5emLvN7SWXgnLh4+B5xQlNVz8Og8kvArMtNROxVQuCaSnIDdD5LKyWbRd2n9WGe2R8PzgCmr3EgVLrjyBxWezF0jLHwVN8efS3rCj/EWgvIWgb9tarpVUDK/b58Da+sqqls3eNbuv7pr+eoZG+SrDK6nWeL3c6H5Apxz7LjVc1uTIdsIXxuOLYA4/ilBmSVIzuDWfdRUfhHdY6+cn8HFRm+2hM8AnXGXws9555KrUB5qihylGa8subX2Nn6UwNR1AkUTV74bU=", ), # KSK-2010: dns.rrset.from_text( @@ -217,14 +215,12 @@ def new(self): 15202, "IN", "DNSKEY", - ( - "257 3 8 AwEAAagAIKlVZrpC6Ia7gEzahOR+9W29euxhJhVVLOyQbSEW0O8gcCjF" - " FVQUTf6v58fLjwBd0YI0EzrAcQqBGCzh/RStIoO8g0NfnfL2MTJRkxoX" - " bfDaUeVPQuYEhg37NZWAJQ9VnMVDxP/VHL496M/QZxkjf5/Efucp2gaD" - " X6RS6CXpoY68LsvPVjR0ZSwzz1apAzvN9dlzEheX7ICJBBtuA6G3LQpz" - " W5hOA2hzCTMjJPJ8LbqF6dsV6DoBQzgul0sGIcGOYl7OyQdXfZ57relS" - " Qageu+ipAdTTJ25AsRTAoub8ONGcLmqrAmRLKBP1dfwhYB4N7knNnulq QxA+Uk1ihz0=" - ), + "257 3 8 AwEAAagAIKlVZrpC6Ia7gEzahOR+9W29euxhJhVVLOyQbSEW0O8gcCjF" + " FVQUTf6v58fLjwBd0YI0EzrAcQqBGCzh/RStIoO8g0NfnfL2MTJRkxoX" + " bfDaUeVPQuYEhg37NZWAJQ9VnMVDxP/VHL496M/QZxkjf5/Efucp2gaD" + " X6RS6CXpoY68LsvPVjR0ZSwzz1apAzvN9dlzEheX7ICJBBtuA6G3LQpz" + " W5hOA2hzCTMjJPJ8LbqF6dsV6DoBQzgul0sGIcGOYl7OyQdXfZ57relS" + " Qageu+ipAdTTJ25AsRTAoub8ONGcLmqrAmRLKBP1dfwhYB4N7knNnulq QxA+Uk1ihz0=", ), ] diff --git a/electrumabc/interface.py b/electrumabc/interface.py index 1025dbfc8032..9bf6a6c8306f 100644 --- a/electrumabc/interface.py +++ b/electrumabc/interface.py @@ -195,10 +195,8 @@ def get_socket(self): try: os.remove(cert_path) self.print_error( - ( - "Server is now using a CA-signed certificate, deleted" - " previous self-signed certificate:" - ), + "Server is now using a CA-signed certificate, deleted" + " previous self-signed certificate:", cert_path, ) except OSError: diff --git a/electrumabc/json_db.py b/electrumabc/json_db.py index 6f2c6aba6b2a..448f8c2fc627 100644 --- a/electrumabc/json_db.py +++ b/electrumabc/json_db.py @@ -472,8 +472,9 @@ def get_seed_version(self): if seed_version > FINAL_SEED_VERSION: raise WalletFileException( "This version of Electrum is too old to open this wallet.\n" - "(highest supported storage version: {}, version of this file: {})" - .format(FINAL_SEED_VERSION, seed_version) + "(highest supported storage version: {}, version of this file: {})".format( + FINAL_SEED_VERSION, seed_version + ) ) if seed_version >= 12: return seed_version diff --git a/electrumabc/mnemo.py b/electrumabc/mnemo.py index 789c44e78639..981927eae3dc 100644 --- a/electrumabc/mnemo.py +++ b/electrumabc/mnemo.py @@ -289,9 +289,9 @@ def __init__(self, lang=None): self.data.words = tuple(load_wordlist(filename)) self.data.word_indices = dict() for i, word in enumerate(self.data.words): - self.data.word_indices[word] = ( - i # saves on O(N) lookups for words. The alternative is to call wordlist.index(w) for each word which is slow. - ) + self.data.word_indices[ + word + ] = i # saves on O(N) lookups for words. The alternative is to call wordlist.index(w) for each word which is slow. self.print_error("wordlist has %d words" % len(self.data.words)) assert len(self.data.words) == len( self.data.word_indices diff --git a/electrumabc/network.py b/electrumabc/network.py index 85f017c8f5c7..5fc6d81d626a 100644 --- a/electrumabc/network.py +++ b/electrumabc/network.py @@ -1478,10 +1478,8 @@ def on_header(self, interface, request, response): if not request: interface.print_error( - ( - "disconnecting server for sending unsolicited header, no request," - f" params={response['params']}" - ), + "disconnecting server for sending unsolicited header, no request," + f" params={response['params']}", blacklist=True, ) self.connection_down(interface.server) @@ -1494,8 +1492,9 @@ def on_header(self, interface, request, response): # sort of rewrite. if height != response_height: interface.print_error( - "unsolicited header request={} request_height={} response_height={}" - .format(request_params, height, response_height) + "unsolicited header request={} request_height={} response_height={}".format( + request_params, height, response_height + ) ) self.connection_down(interface.server) return diff --git a/electrumabc/paymentrequest.py b/electrumabc/paymentrequest.py index c5a35818a9b7..4a7005dfac75 100644 --- a/electrumabc/paymentrequest.py +++ b/electrumabc/paymentrequest.py @@ -660,10 +660,8 @@ class PaymentRequestBitPay20(PaymentRequest, PrintError): Details = namedtuple( "BitPay20Details", - ( - "outputs, memo, payment_url, time, expires, network, currency," - " required_fee_rate" - ), + "outputs, memo, payment_url, time, expires, network, currency," + " required_fee_rate", ) class Raw: @@ -937,10 +935,8 @@ def verify(self, contacts, *, timeout=10.0): else: # TODO: Fixme -- for now this branch will always be taken because we turned off key download in _get_signing_keys() above self.print_error( - ( - "Warning: Could not verify whether signing public key is" - " valid:" - ), + "Warning: Could not verify whether signing public key is" + " valid:", pubkey.hex(), "(PGP verification is currently disabled)", ) diff --git a/electrumabc/plugins.py b/electrumabc/plugins.py index c1a8c3d069ea..582232550ab4 100644 --- a/electrumabc/plugins.py +++ b/electrumabc/plugins.py @@ -163,9 +163,9 @@ def retranslate_internal_plugin_metadata(self, name): ) else: d[key] = val # rewrite translated string - d[ut_key] = ( - ut_val # save untranslated metadata for later so that this function may be called again from GUI - ) + d[ + ut_key + ] = ut_val # save untranslated metadata for later so that this function may be called again from GUI def load_internal_plugins(self): for loader, name, ispkg in pkgutil.iter_modules( @@ -653,12 +653,10 @@ def myhook(self, arg1, arg2): this_thread = threading.current_thread() if this_thread is not threading.main_thread(): warn( - ( - f'run_hook "{name}" being called from outside the main' - f" thread (thr: {this_thread.name}) may lead to undefined" - " behavior. Please use util.do_in_main_thread to call run_hook" - " if the hook in question does not return any results." - ), + f'run_hook "{name}" being called from outside the main' + f" thread (thr: {this_thread.name}) may lead to undefined" + " behavior. Please use util.do_in_main_thread to call run_hook" + " if the hook in question does not return any results.", stacklevel=2, ) f_list = hooks.get(name) diff --git a/electrumabc/synchronizer.py b/electrumabc/synchronizer.py index ed287c1ccb33..a214ed123738 100644 --- a/electrumabc/synchronizer.py +++ b/electrumabc/synchronizer.py @@ -358,8 +358,9 @@ def process(): chk_txid = tx.txid_fast() if tx_hash != chk_txid: self.print_error( - "received tx does not match expected txid ({} != {}), skipping" - .format(tx_hash, chk_txid) + "received tx does not match expected txid ({} != {}), skipping".format( + tx_hash, chk_txid + ) ) return del chk_txid diff --git a/electrumabc/tests/test_avalanche.py b/electrumabc/tests/test_avalanche.py index 29858f5d5d40..461ccec82122 100644 --- a/electrumabc/tests/test_avalanche.py +++ b/electrumabc/tests/test_avalanche.py @@ -214,17 +214,15 @@ def test_1_stake(self): }, ], Address.from_string("ecash:qrupwtz3a7lngsf6xz9qxr75k9jvt07d3uexmwmpqy"), - ( - "d97587e6c882615796011ec8f9a7b1c621023beefdde700a6bc02036335b4df141c8b" - "c67bb05a971f5ac2745fd683797dde30169a79ff23e1d58c64afad42ad81cffe53967" - "e16beb692fc5776bb442c79c5d91de00cf21804712806594010038e168a32102449fb" - "5237efe8f647d32e8b64f06c22d1d40368eaca2a71ffc6a13ecc8bce680e6569b4412" - "fbb651e44282419f62e9b3face655d3a96e286f70dd616592d6837ccf55cadd71eb53" - "50a4c46f23ca69230c27f6c0a7c1ed15aee38ab4cbc6f8d031976a914f8172c51efbf" - "34413a308a030fd4b164c5bfcd8f88ac2fe2dbc2d5d28ed70f4bf9e3e7e76db091570" - "8100f048a17f6347d95e1135d6403241db4f4b42aa170919bd0847d158d087d9b0d9b" - "92ad41114cf03a3d44ec84" - ), + "d97587e6c882615796011ec8f9a7b1c621023beefdde700a6bc02036335b4df141c8b" + "c67bb05a971f5ac2745fd683797dde30169a79ff23e1d58c64afad42ad81cffe53967" + "e16beb692fc5776bb442c79c5d91de00cf21804712806594010038e168a32102449fb" + "5237efe8f647d32e8b64f06c22d1d40368eaca2a71ffc6a13ecc8bce680e6569b4412" + "fbb651e44282419f62e9b3face655d3a96e286f70dd616592d6837ccf55cadd71eb53" + "50a4c46f23ca69230c27f6c0a7c1ed15aee38ab4cbc6f8d031976a914f8172c51efbf" + "34413a308a030fd4b164c5bfcd8f88ac2fe2dbc2d5d28ed70f4bf9e3e7e76db091570" + "8100f048a17f6347d95e1135d6403241db4f4b42aa170919bd0847d158d087d9b0d9b" + "92ad41114cf03a3d44ec84", UInt256.from_hex( "199bd28f711413cf2cf04a2520f3ccadbff296d9be231c00cb6308528a0b51ca", ), diff --git a/electrumabc/tests/test_dnssec.py b/electrumabc/tests/test_dnssec.py index edb386ad91df..87bb754f5447 100644 --- a/electrumabc/tests/test_dnssec.py +++ b/electrumabc/tests/test_dnssec.py @@ -13,14 +13,10 @@ def test_validate_rrsig_ecdsa(self): 3599, 1, 48, - ( - "257 3 13 mdsswUyr3DPW132mOi8V9xESWE8jTo0d" - " xCjjnopKl+GqJxpVXckHAeF+KkxLbxIL fDLUT0rAK9iUzy1L53eKGQ==" - ), - ( - "256 3 13 koPbw9wmYZ7ggcjnQ6ayHyhHaDNMYELK" - " TqT+qRGrZpWSccr/lBcrm10Z1PuQHB3A zhii+sb0PYFkH1ruxLhe5g==" - ), + "257 3 13 mdsswUyr3DPW132mOi8V9xESWE8jTo0d" + " xCjjnopKl+GqJxpVXckHAeF+KkxLbxIL fDLUT0rAK9iUzy1L53eKGQ==", + "256 3 13 koPbw9wmYZ7ggcjnQ6ayHyhHaDNMYELK" + " TqT+qRGrZpWSccr/lBcrm10Z1PuQHB3A zhii+sb0PYFkH1ruxLhe5g==", ) rrsig = dns.rdtypes.ANY.RRSIG.RRSIG.from_text( 1, @@ -46,10 +42,8 @@ def test_validate_rrsig_rsa(self): 12698, 1, 43, - ( - "2371 13 2" - " 3b7f818a879ecb9931dae983d4529afedeb53993759d8080735083f954d40bc8" - ), + "2371 13 2" + " 3b7f818a879ecb9931dae983d4529afedeb53993759d8080735083f954d40bc8", ) rrsig = dns.rdtypes.ANY.RRSIG.RRSIG.from_text( 1, @@ -67,34 +61,26 @@ def test_validate_rrsig_rsa(self): 866, 1, 48, - ( - "256 3 7 AwEAAXxsMmN/JgpEE9Y4uFNRJm7Q9GBw" - " mEYUCsCxuKlgBU9WrQEFRrvAeMamUBeX 4SE8s3V/TEk/TgGmPPp0pMkKD7mseluK" - " 6Ard2HZ6O3nPAzL4i8py/UDRUmYNSCxw fdfjUWRmcB9H+NKWMsJoDhAkLFqg5HS7" - " f0j4Vb99Wac24Fk7" - ), - ( - "256 3 7 AwEAAcLdAPt3vn/ND00zZlyTx7OBko+9" - " YeCrSl2eGuEXjef0Lqf0tKGikoHwnmTH tT8J/aGqkZImLMVByJbknE0wKDnbvbKD" - " oTQxPwUQZLH6k3sTdsPKESKDSBSc6VFM q35gx6CeuRYZ9KkGWiUsKqJhXPo6tyJF" - " CBxfaNQQyrzBnv4/" - ), - ( - "257 3 7 AwEAAZTjbIO5kIpxWUtyXc8avsKyHIIZ" - " +LjC2Dv8naO+Tz6X2fqzDC1bdq7HlZwt kaqTkMVVJ+8gE9FIreGJ4c8G1GdbjQgb" - " P1OyYIG7OHTc4hv5T2NlyWr6k6QFz98Q 4zwFIGTFVvwBhmrMDYsOTtXakK6QwHov" - " A1+83BsUACxlidpwB0hQacbD6x+I2RCD zYuTzj64Jv0/9XsX6AYV3ebcgn4hL1jI" - " R2eJYyXlrAoWxdzxcW//5yeL5RVWuhRx ejmnSVnCuxkfS4AQ485KH2tpdbWcCopL" - " JZs6tw8q3jWcpTGzdh/v3xdYfNpQNcPI mFlxAun3BtORPA2r8ti6MNoJEHU=" - ), - ( - "257 3 7 AwEAAcMnWBKLuvG/LwnPVykcmpvnntwx" - " fshHlHRhlY0F3oz8AMcuF8gw9McCw+Bo C2YxWaiTpNPuxjSNhUlBtcJmcdkz3/r7" - " PIn0oDf14ept1Y9pdPh8SbIBIWx50ZPf VRlj8oQXv2Y6yKiQik7bi3MT37zMRU2k" - " w2oy3cgrsGAzGN4s/C6SFYon5N1Q2O4h GDbeOq538kATOy0GFELjuauV9guX/431" - " msYu4Rgb5lLuQ3Mx5FSIxXpI/RaAn2mh M4nEZ/5IeRPKZVGydcuLBS8GZlxW4qbb" - " 8MgRZ8bwMg0pqWRHmhirGmJIt3UuzvN1 pSFBfX7ysI9PPhSnwXCNDXk0kk0=" - ), + "256 3 7 AwEAAXxsMmN/JgpEE9Y4uFNRJm7Q9GBw" + " mEYUCsCxuKlgBU9WrQEFRrvAeMamUBeX 4SE8s3V/TEk/TgGmPPp0pMkKD7mseluK" + " 6Ard2HZ6O3nPAzL4i8py/UDRUmYNSCxw fdfjUWRmcB9H+NKWMsJoDhAkLFqg5HS7" + " f0j4Vb99Wac24Fk7", + "256 3 7 AwEAAcLdAPt3vn/ND00zZlyTx7OBko+9" + " YeCrSl2eGuEXjef0Lqf0tKGikoHwnmTH tT8J/aGqkZImLMVByJbknE0wKDnbvbKD" + " oTQxPwUQZLH6k3sTdsPKESKDSBSc6VFM q35gx6CeuRYZ9KkGWiUsKqJhXPo6tyJF" + " CBxfaNQQyrzBnv4/", + "257 3 7 AwEAAZTjbIO5kIpxWUtyXc8avsKyHIIZ" + " +LjC2Dv8naO+Tz6X2fqzDC1bdq7HlZwt kaqTkMVVJ+8gE9FIreGJ4c8G1GdbjQgb" + " P1OyYIG7OHTc4hv5T2NlyWr6k6QFz98Q 4zwFIGTFVvwBhmrMDYsOTtXakK6QwHov" + " A1+83BsUACxlidpwB0hQacbD6x+I2RCD zYuTzj64Jv0/9XsX6AYV3ebcgn4hL1jI" + " R2eJYyXlrAoWxdzxcW//5yeL5RVWuhRx ejmnSVnCuxkfS4AQ485KH2tpdbWcCopL" + " JZs6tw8q3jWcpTGzdh/v3xdYfNpQNcPI mFlxAun3BtORPA2r8ti6MNoJEHU=", + "257 3 7 AwEAAcMnWBKLuvG/LwnPVykcmpvnntwx" + " fshHlHRhlY0F3oz8AMcuF8gw9McCw+Bo C2YxWaiTpNPuxjSNhUlBtcJmcdkz3/r7" + " PIn0oDf14ept1Y9pdPh8SbIBIWx50ZPf VRlj8oQXv2Y6yKiQik7bi3MT37zMRU2k" + " w2oy3cgrsGAzGN4s/C6SFYon5N1Q2O4h GDbeOq538kATOy0GFELjuauV9guX/431" + " msYu4Rgb5lLuQ3Mx5FSIxXpI/RaAn2mh M4nEZ/5IeRPKZVGydcuLBS8GZlxW4qbb" + " 8MgRZ8bwMg0pqWRHmhirGmJIt3UuzvN1 pSFBfX7ysI9PPhSnwXCNDXk0kk0=", ) keys = {dns.name.Name([b"org", b""]): rrset2} origin = None @@ -111,10 +97,8 @@ def test_validate_rrsig_fail(self): 86400, 1, 43, - ( - "2371 13 2" - " 3b7f818a879ecb9931dae983d4529afedeb53993759d8080735083f954d40bc8" - ), + "2371 13 2" + " 3b7f818a879ecb9931dae983d4529afedeb53993759d8080735083f954d40bc8", "106 5 1 4F219DCE274F820EA81EA1150638DABE21EB27FC", ) rrsig = dns.rdtypes.ANY.RRSIG.RRSIG.from_text( @@ -133,24 +117,18 @@ def test_validate_rrsig_fail(self): 866, 1, 48, - ( - "256 3 7 AwEAAZwBxCB7AIhIWiqjusg2lfHSi8orabyy5BM/UtidQEZKIvU5Mrh7" - " 7eV4C3WyTOwd2AwoGYAUgPjzAC5lFFnCg0LsQpsV7sYy5k+bZBlpxF1o" - " 9KuBOe+iUQt2YM4TjTD38mW1aN8OFf8mkMxkRzo3dfskzsT881CdJRiD Cg18hJJt" - ), - ( - "256 3 7 AwEAAdZenjsGF9Xmh+hjv1FV0w8rRC6SHKeMNuk53BRsqruVK2xCbLGm" - " gtue1yMElMs5+4B5A+uZY8pj4c5fHgC06h3gd0XoIF+KvWhk5WDqohrv" - " 0nUADQjBBAGRaaO4FDTuu8i19sRg3p3h1LoAgZi+Gcls+JxOdnohVUkp 0by82buT" - ), - ( - "257 3 7 AwEAAcMnWBKLuvG/LwnPVykcmpvnntwxfshHlHRhlY0F3oz8AMcuF8gw" - " 9McCw+BoC2YxWaiTpNPuxjSNhUlBtcJmcdkz3/r7PIn0oDf14ept1Y9p" - " dPh8SbIBIWx50ZPfVRlj8oQXv2Y6yKiQik7bi3MT37zMRU2kw2oy3cgr" - " sGAzGN4s/C6SFYon5N1Q2O4hGDbeOq538kATOy0GFELjuauV9guX/431" - " msYu4Rgb5lLuQ3Mx5FSIxXpI/RaAn2mhM4nEZ/5IeRPKZVGydcuLBS8G" - " ZlxW4qbb8MgRZ8bwMg0pqWRHmhirGmJIt3UuzvN1pSFBfX7ysI9PPhSn wXCNDXk0kk0=" - ), + "256 3 7 AwEAAZwBxCB7AIhIWiqjusg2lfHSi8orabyy5BM/UtidQEZKIvU5Mrh7" + " 7eV4C3WyTOwd2AwoGYAUgPjzAC5lFFnCg0LsQpsV7sYy5k+bZBlpxF1o" + " 9KuBOe+iUQt2YM4TjTD38mW1aN8OFf8mkMxkRzo3dfskzsT881CdJRiD Cg18hJJt", + "256 3 7 AwEAAdZenjsGF9Xmh+hjv1FV0w8rRC6SHKeMNuk53BRsqruVK2xCbLGm" + " gtue1yMElMs5+4B5A+uZY8pj4c5fHgC06h3gd0XoIF+KvWhk5WDqohrv" + " 0nUADQjBBAGRaaO4FDTuu8i19sRg3p3h1LoAgZi+Gcls+JxOdnohVUkp 0by82buT", + "257 3 7 AwEAAcMnWBKLuvG/LwnPVykcmpvnntwxfshHlHRhlY0F3oz8AMcuF8gw" + " 9McCw+BoC2YxWaiTpNPuxjSNhUlBtcJmcdkz3/r7PIn0oDf14ept1Y9p" + " dPh8SbIBIWx50ZPfVRlj8oQXv2Y6yKiQik7bi3MT37zMRU2kw2oy3cgr" + " sGAzGN4s/C6SFYon5N1Q2O4hGDbeOq538kATOy0GFELjuauV9guX/431" + " msYu4Rgb5lLuQ3Mx5FSIxXpI/RaAn2mhM4nEZ/5IeRPKZVGydcuLBS8G" + " ZlxW4qbb8MgRZ8bwMg0pqWRHmhirGmJIt3UuzvN1pSFBfX7ysI9PPhSn wXCNDXk0kk0=", ) keys = {dns.name.Name([b"org", b""]): rrset2} origin = None diff --git a/electrumabc/tests/test_mnemonic.py b/electrumabc/tests/test_mnemonic.py index d916340a61fe..39ffba1a4449 100644 --- a/electrumabc/tests/test_mnemonic.py +++ b/electrumabc/tests/test_mnemonic.py @@ -13,10 +13,8 @@ def test_to_seed(self): ) self.assertEqual( bh2u(seed), - ( - "741b72fd15effece6bfe5a26a52184f66811bd2be363190e07a42cca442b1a5b" - "b22b3ad0eb338197287e6d314866c7fba863ac65d3f156087a5052ebc7157fce" - ), + "741b72fd15effece6bfe5a26a52184f66811bd2be363190e07a42cca442b1a5b" + "b22b3ad0eb338197287e6d314866c7fba863ac65d3f156087a5052ebc7157fce", ) def test_random_seeds(self): diff --git a/electrumabc/tests/test_util.py b/electrumabc/tests/test_util.py index c9db4777b029..fb192271d100 100644 --- a/electrumabc/tests/test_util.py +++ b/electrumabc/tests/test_util.py @@ -256,14 +256,12 @@ def test_parse_URI_multiple_args(self): ) self._do_test_parse_URI( - ( - "ecash:15mKKb2eos1hWa6tisdPwwDC1a5J1y9nma?" - "amount=10.04&" - "label=electrum-test&" - "message=electrum%20test&" - "test=none&" - "r=http://domain.tld/page" - ), + "ecash:15mKKb2eos1hWa6tisdPwwDC1a5J1y9nma?" + "amount=10.04&" + "label=electrum-test&" + "message=electrum%20test&" + "test=none&" + "r=http://domain.tld/page", { "address": "15mKKb2eos1hWa6tisdPwwDC1a5J1y9nma", "amount": 1004, @@ -304,10 +302,8 @@ def test_parse_URI_parameter_polution(self): self.assertRaises( Exception, parse_URI, - ( - "ecash:15mKKb2eos1hWa6tisdPwwDC1a5J1y9nma?amount=0.0003&label=test&" - "amount=30.0" - ), + "ecash:15mKKb2eos1hWa6tisdPwwDC1a5J1y9nma?amount=0.0003&label=test&" + "amount=30.0", ) diff --git a/electrumabc/transaction.py b/electrumabc/transaction.py index d82803ca7c85..1f95deb294dc 100644 --- a/electrumabc/transaction.py +++ b/electrumabc/transaction.py @@ -1266,7 +1266,9 @@ def fetch_input_data( # we already have results, don't do anything. return False eph = self.ephemeral - eph["fetched_inputs"] = ( + eph[ + "fetched_inputs" + ] = ( inps ) = inps.copy() # paranoia: in case another thread is running on this list # Lazy imports to keep this functionality very self-contained @@ -1434,10 +1436,8 @@ def put_in_queue_and_cache(r): ): # txid may be '' if KeyError from r['result'] above bad_txids.add(txid) print_error( - ( - "fetch_input_data: put_in_queue_and_cache fail for" - " txid:" - ), + "fetch_input_data: put_in_queue_and_cache fail for" + " txid:", txid, repr(e), ) diff --git a/electrumabc/util.py b/electrumabc/util.py index 3608dcc66c3f..18e9037598b8 100644 --- a/electrumabc/util.py +++ b/electrumabc/util.py @@ -877,11 +877,9 @@ def default_do_in_main_thread_handler(func, *args, **kwargs): this_thread = threading.current_thread() if this_thread is not threading.main_thread(): print_stderr( - ( - "Warning: do_in_main_thread called with the default handler" - f" from outside the main thread (thr: {this_thread.name});" - " such usage may lead to undefined behavior. Traceback:\n" - ), + "Warning: do_in_main_thread called with the default handler" + f" from outside the main thread (thr: {this_thread.name});" + " such usage may lead to undefined behavior. Traceback:\n", "".join(traceback.format_stack()), ) func(*args, **kwargs) @@ -1029,10 +1027,8 @@ def __call__(self, *args, **kwargs): else: print_error( self, - ( - f"MethodProxy for '{self.qname}' called on a dead reference. " - f"Referent was: {self.sname})" - ), + f"MethodProxy for '{self.qname}' called on a dead reference. " + f"Referent was: {self.sname})", ) diff --git a/electrumabc/verifier.py b/electrumabc/verifier.py index 1b5faf70a5bb..37caee97f287 100644 --- a/electrumabc/verifier.py +++ b/electrumabc/verifier.py @@ -220,8 +220,9 @@ def verify_merkle(self, response): return if header.get("merkle_root") != merkle_root: self.print_error( - "merkle verification failed for {} (merkle root mismatch {} != {})" - .format(tx_hash, header.get("merkle_root"), merkle_root) + "merkle verification failed for {} (merkle root mismatch {} != {})".format( + tx_hash, header.get("merkle_root"), merkle_root + ) ) return # we passed all the tests diff --git a/electrumabc/wallet.py b/electrumabc/wallet.py index 6a62d0c9e3d5..e44d8759d2d1 100644 --- a/electrumabc/wallet.py +++ b/electrumabc/wallet.py @@ -831,10 +831,8 @@ def _get_wallet_delta(self, tx, *, ver=1) -> Union[WalletDelta, WalletDelta2]: TxInfo = namedtuple( "TxInfo", - ( - "tx_hash, status, label, can_broadcast, amount, fee, height, conf," - " timestamp, exp_n" - ), + "tx_hash, status, label, can_broadcast, amount, fee, height, conf," + " timestamp, exp_n, status_enum", ) class StatusEnum(Enum): @@ -1368,10 +1366,8 @@ def add_transaction(self, tx_hash, tx): if not tx.inputs(): # bad tx came in off the wire -- all 0's or something, see #987 self.print_error( - ( - "add_transaction: WARNING a tx came in from the network with 0" - " inputs! Bad server? Ignoring tx:" - ), + "add_transaction: WARNING a tx came in from the network with 0" + " inputs! Bad server? Ignoring tx:", tx_hash, ) return @@ -1802,9 +1798,9 @@ def done(): fee = do_get_fee(tx_hash) if fee is not None: - self.tx_fees[tx_hash] = ( - fee # save fee to wallet if we bothered to dl/calculate it. - ) + self.tx_fees[ + tx_hash + ] = fee # save fee to wallet if we bothered to dl/calculate it. return fee def fmt_amt(v, is_diff): @@ -3508,7 +3504,6 @@ def get_auxiliary_pubkey_index(self, key: PublicKey, password) -> Optional[int]: class SimpleDeterministicWallet(SimpleWallet, DeterministicWallet): - """Deterministic Wallet with a single pubkey per address""" def __init__(self, storage): diff --git a/electrumabc/x509.py b/electrumabc/x509.py index 254ea2c205b5..e73c5388cd70 100644 --- a/electrumabc/x509.py +++ b/electrumabc/x509.py @@ -378,8 +378,7 @@ def check_date(self): ) if not_before > now: raise CertificateError( - "Certificate for {} has not yet entered its valid date range. ({})" - .format( + "Certificate for {} has not yet entered its valid date range. ({})".format( self.get_common_name(), time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(not_before)), ) diff --git a/electrumabc_gui/qt/avalanche/delegation_editor.py b/electrumabc_gui/qt/avalanche/delegation_editor.py index 62078b5fab69..9ebc7e629722 100644 --- a/electrumabc_gui/qt/avalanche/delegation_editor.py +++ b/electrumabc_gui/qt/avalanche/delegation_editor.py @@ -222,11 +222,9 @@ def _build(self) -> Optional[str]: QtWidgets.QMessageBox.critical( self, "Wrong delegator key", - ( - "The provided delegator key does not match the proof master key or" - " the previous delegated public key (if adding a level to an" - " existing delegation)." - ), + "The provided delegator key does not match the proof master key or" + " the previous delegated public key (if adding a level to an" + " existing delegation).", ) return diff --git a/electrumabc_gui/qt/avalanche/proof_editor.py b/electrumabc_gui/qt/avalanche/proof_editor.py index ba87498ff944..672685e2f88f 100644 --- a/electrumabc_gui/qt/avalanche/proof_editor.py +++ b/electrumabc_gui/qt/avalanche/proof_editor.py @@ -317,10 +317,8 @@ def add_utxos(self, utxos: List[dict]): QtWidgets.QMessageBox.critical( self, _("Missing key or signature"), - ( - f'UTXO {utxo["prevout_hash"]}:{utxo["prevout_n"]} with address ' - f"{address.to_ui_string()} does not belong to this wallet." - ), + f'UTXO {utxo["prevout_hash"]}:{utxo["prevout_n"]} with address ' + f"{address.to_ui_string()} does not belong to this wallet.", ) return @@ -341,10 +339,8 @@ def add_utxos(self, utxos: List[dict]): QtWidgets.QMessageBox.warning( self, _("Excluded coins"), - ( - f"{unconfirmed_count} coins have been ignored because they are " - "unconfirmed or do not have a block height specified." - ), + f"{unconfirmed_count} coins have been ignored because they are " + "unconfirmed or do not have a block height specified.", ) self.add_stakes(stakes) @@ -538,11 +534,9 @@ def load_proof(self, proof: Proof): QtWidgets.QMessageBox.warning( self, "Missing private key", - ( - "Unable to guess private key associated with this proof's public" - " key. You can fill it manually if you know it, or leave it blank" - " if you just want to sign your stakes, " - ), + "Unable to guess private key associated with this proof's public" + " key. You can fill it manually if you know it, or leave it blank" + " if you just want to sign your stakes, ", ) self.master_pubkey_view.setText(proof.master_pub.to_hex()) @@ -599,20 +593,16 @@ def _build(self) -> Optional[Proof]: QtWidgets.QMessageBox.critical( self, "No valid master key", - ( - "You need to specify either a master private key or a master " - "public key before generate a proof." - ), + "You need to specify either a master private key or a master " + "public key before generate a proof.", ) return QtWidgets.QMessageBox.warning( self, "Invalid private key", - ( - "Unable to parse private key. The generated proof will not be" - " signed. This is OK if you just intend to sign your stakes and" - " sign the proof later in a master wallet." - ), + "Unable to parse private key. The generated proof will not be" + " signed. This is OK if you just intend to sign your stakes and" + " sign the proof later in a master wallet.", ) master = None else: diff --git a/electrumabc_gui/qt/console.py b/electrumabc_gui/qt/console.py index 1a5b66452db5..b111ee596863 100644 --- a/electrumabc_gui/qt/console.py +++ b/electrumabc_gui/qt/console.py @@ -44,7 +44,9 @@ class ConsoleWarningOverlay(QtWidgets.QWidget): QLabel, QLabel link {{ border-radius: {0}px; }} - """.format(BORDER_RADIUS) + """.format( + BORDER_RADIUS + ) CONFIRM_TEXT = _("I UNDERSTAND THE RISK").upper() diff --git a/electrumabc_gui/qt/consolidate_coins_dialog.py b/electrumabc_gui/qt/consolidate_coins_dialog.py index 14513ba187c5..202c4997d39e 100644 --- a/electrumabc_gui/qt/consolidate_coins_dialog.py +++ b/electrumabc_gui/qt/consolidate_coins_dialog.py @@ -290,11 +290,9 @@ def warn_burn_tokens(self, include_slp_is_checked: bool): button = QtWidgets.QMessageBox.warning( self, "SLP tokens may be lost", - ( - f"{PROJECT_NAME} does not support transferring SLP tokens. If you" - " include them in the consolidation transaction, they will be" - " burned." - ), + f"{PROJECT_NAME} does not support transferring SLP tokens. If you" + " include them in the consolidation transaction, they will be" + " burned.", buttons=QtWidgets.QMessageBox.Cancel | QtWidgets.QMessageBox.Ok, ) if button == QtWidgets.QMessageBox.Cancel: diff --git a/electrumabc_gui/qt/invoice_dialog.py b/electrumabc_gui/qt/invoice_dialog.py index 88742cf0aba3..c1ba41bb3f13 100644 --- a/electrumabc_gui/qt/invoice_dialog.py +++ b/electrumabc_gui/qt/invoice_dialog.py @@ -431,11 +431,9 @@ def _on_test_api_clicked(self): QtWidgets.QMessageBox.critical( self, "Error fetching exchange rate", - ( - f"Unable to fetch the XEC/{self._currency} exchange rate using the " - "specified API parameters.\n\nThe error message was:\n\n" - f"{type(e).__name__}: {e}" - ), + f"Unable to fetch the XEC/{self._currency} exchange rate using the " + "specified API parameters.\n\nThe error message was:\n\n" + f"{type(e).__name__}: {e}", ) return diff --git a/electrumabc_gui/qt/main_window.py b/electrumabc_gui/qt/main_window.py index 2a152bac4432..b7cb532f445c 100644 --- a/electrumabc_gui/qt/main_window.py +++ b/electrumabc_gui/qt/main_window.py @@ -2505,14 +2505,10 @@ def _chk_no_segwit_suspects(self): segwits.add(line) if segwits: msg = ngettext( - ( - "Possible BTC Segwit address in 'Pay to' field. Please use CashAddr" - " format for p2sh addresses.\n\n{segwit_addresses}" - ), - ( - "Possible BTC Segwit addresses in 'Pay to' field. Please use" - " CashAddr format for p2sh addresses.\n\n{segwit_addresses}" - ), + "Possible BTC Segwit address in 'Pay to' field. Please use CashAddr" + " format for p2sh addresses.\n\n{segwit_addresses}", + "Possible BTC Segwit addresses in 'Pay to' field. Please use" + " CashAddr format for p2sh addresses.\n\n{segwit_addresses}", len(segwits), ).format(segwit_addresses="\n".join(segwits)) detail = _( @@ -3940,8 +3936,7 @@ def do_process_from_multiple_files(self): except SerializationError as e: self.show_critical( f"{PROJECT_NAME} was unable to deserialize the" - f" transaction in file {filename}:\n" - + str(e) + f" transaction in file {filename}:\n" + str(e) ) if not transactions: return @@ -4516,9 +4511,9 @@ def on_success(history): lines.append(cols) else: if has_fiat_columns and ccy: - item["fiat_currency"] = ( - ccy # add the currency to each entry in the json. this wastes space but json is bloated anyway so this won't hurt too much, we hope - ) + item[ + "fiat_currency" + ] = ccy # add the currency to each entry in the json. this wastes space but json is bloated anyway so this won't hurt too much, we hope elif not has_fiat_columns: # No need to include these fields as they will always be 'No Data' item.pop("fiat_value", None) diff --git a/electrumabc_gui/qt/qrcodewidget.py b/electrumabc_gui/qt/qrcodewidget.py index 2633c9686cf7..b36de87844c0 100644 --- a/electrumabc_gui/qt/qrcodewidget.py +++ b/electrumabc_gui/qt/qrcodewidget.py @@ -52,8 +52,9 @@ def _paint_blank(self): def _bad_data(self, data): self.print_error( - "Failed to generate QR image -- data too long! Data length was: {} bytes" - .format(len(data or "")) + "Failed to generate QR image -- data too long! Data length was: {} bytes".format( + len(data or "") + ) ) self.qr = None diff --git a/electrumabc_gui/qt/util.py b/electrumabc_gui/qt/util.py index f731cf94eb4f..7a922de37a43 100644 --- a/electrumabc_gui/qt/util.py +++ b/electrumabc_gui/qt/util.py @@ -392,10 +392,8 @@ def on_chk(b): except RuntimeError as e: # C++ object deleted -- can happen with misbehaving client code that kills parent from dialog ok print_error( - ( - "MsgBoxMixin WARNING: client code is killing the dialog box's" - " parent before function return:" - ), + "MsgBoxMixin WARNING: client code is killing the dialog box's" + " parent before function return:", str(e), ) return ret @@ -617,7 +615,9 @@ def func(): _filter = ( "*.csv" if text.endswith(".csv") - else "*.json" if text.endswith(".json") else None + else "*.json" + if text.endswith(".json") + else None ) p, __ = QtWidgets.QFileDialog.getSaveFileName(None, select_msg, text, _filter) if p: @@ -1350,8 +1350,9 @@ def _doIt(self): else: if time_taken > float(self.rate): self.print_error( - "method took too long: {} > {}. Fudging timestamps to compensate." - .format(time_taken, self.rate) + "method took too long: {} > {}. Fudging timestamps to compensate.".format( + time_taken, self.rate + ) ) self.last_ts = tf # Hmm. This function takes longer than its rate to complete. so mark its last run time as 'now'. This breaks the rate but at least prevents this function from starving the CPU (benforces a delay). else: diff --git a/electrumabc_plugins/fusion/qt.py b/electrumabc_plugins/fusion/qt.py index b35f1335baca..05b1eade882f 100644 --- a/electrumabc_plugins/fusion/qt.py +++ b/electrumabc_plugins/fusion/qt.py @@ -245,14 +245,10 @@ def get_spend_only_fused_coins_checkbox_attributes(wallet): fuse_depth, ).format(min=fuse_depth) tooltip = ngettext( - ( - "If checked, only spend coins that have been anonymized by\n" - "CashFusion, after having been fused at least {min} time." - ), - ( - "If checked, only spend coins that have been anonymized by\n" - "CashFusion, after having been fused at least {min} times." - ), + "If checked, only spend coins that have been anonymized by\n" + "CashFusion, after having been fused at least {min} time.", + "If checked, only spend coins that have been anonymized by\n" + "CashFusion, after having been fused at least {min} times.", fuse_depth, ).format(min=fuse_depth) else: diff --git a/electrumabc_plugins/satochip/qt.py b/electrumabc_plugins/satochip/qt.py index 8b0766585a38..419a9e68cb74 100644 --- a/electrumabc_plugins/satochip/qt.py +++ b/electrumabc_plugins/satochip/qt.py @@ -112,9 +112,11 @@ def connect_and_doit(): grid.setColumnStretch(3, 1) # see - title = QtWidgets.QLabel("""
+ title = QtWidgets.QLabel( + """
Satochip Wallet -
satochip.io""") +
satochip.io""" + ) title.setTextInteractionFlags(Qt.LinksAccessibleByMouse) grid.addWidget(title, 0, 0, 1, 2, Qt.AlignHCenter) @@ -347,10 +349,8 @@ def reset_seed(self, client): reply_encrypt = d["reply_encrypt"] except Exception: self.give_error( - ( - "No response received from 2FA.\nPlease ensure that the" - " Satochip-2FA plugin is enabled in Tools>Optional Features" - ), + "No response received from 2FA.\nPlease ensure that the" + " Satochip-2FA plugin is enabled in Tools>Optional Features", True, ) reply_decrypt = client.cc.card_crypt_transaction_2FA(reply_encrypt, False) @@ -405,8 +405,7 @@ def set_2FA(self, client): try: help_txt = ( "Scan the QR-code with your Satochip-2FA app and make a backup" - " of the following secret: " - + secret_2FA_hex + " of the following secret: " + secret_2FA_hex ) d = QRDialog( data=secret_2FA_hex, diff --git a/electrumabc_plugins/satochip/satochip.py b/electrumabc_plugins/satochip/satochip.py index 966d3d6d0d5d..cb28bb297a44 100644 --- a/electrumabc_plugins/satochip/satochip.py +++ b/electrumabc_plugins/satochip/satochip.py @@ -153,10 +153,8 @@ def get_xpub(self, bip32_path, xtype): ) except Exception as e: # attributeError? self.print_error( - ( - "get_xpub(): exception when getting authentikey from" - " self.handler.win.wallet.storage:" - ), + "get_xpub(): exception when getting authentikey from" + " self.handler.win.wallet.storage:", str(e), ) @@ -382,10 +380,8 @@ def sign_message(self, sequence, message, password, sigtype=SignatureType.ECASH) except Exception: # Note the below give_error call will itself raise Message. :/ self.give_error( - ( - "No response received from 2FA.\nPlease ensure that the" - " Satochip-2FA plugin is enabled in Tools>Optional Features" - ), + "No response received from 2FA.\nPlease ensure that the" + " Satochip-2FA plugin is enabled in Tools>Optional Features", True, ) return @@ -525,11 +521,9 @@ def sign_transaction(self, tx: Transaction, password, *, use_cache=False): except Exception: # Note: give_error here will raise again.. :/ self.give_error( - ( - "No response received from 2FA.\nPlease ensure that" - " the Satochip-2FA plugin is enabled in" - " Tools>Optional Features" - ), + "No response received from 2FA.\nPlease ensure that" + " the Satochip-2FA plugin is enabled in" + " Tools>Optional Features", True, ) break @@ -784,8 +778,7 @@ def setup_device(self, device_info, wizard, purpose): try: help_txt = ( "Scan the QR-code with your Satochip-2FA app and make a" - " backup of the following secret: " - + secret_2FA_hex + " backup of the following secret: " + secret_2FA_hex ) d = QRDialog( secret_2FA_hex,