diff --git a/.arclint b/.arclint --- a/.arclint +++ b/.arclint @@ -25,9 +25,6 @@ "(^contrib/apple-sdk-tools/)", "(^electrum/electrumabc_gui/qt/icons.py)", "(\\_pb2.py$)" - ], - "flags": [ - "--preview" ] }, "flake8": { diff --git a/contrib/buildbot/phabricator_wrapper.py b/contrib/buildbot/phabricator_wrapper.py --- a/contrib/buildbot/phabricator_wrapper.py +++ b/contrib/buildbot/phabricator_wrapper.py @@ -190,17 +190,17 @@ for rev in revs: if revisionPHID == rev["phid"]: decoratedCommit["revision"] = rev - decoratedCommit["link"] = ( - f"https://reviews.bitcoinabc.org/D{rev['id']}" - ) + decoratedCommit[ + "link" + ] = f"https://reviews.bitcoinabc.org/D{rev['id']}" break for author in authors: if author["phid"] == rev["fields"]["authorPHID"]: decoratedCommit["author"] = author - decoratedCommit["authorSlackUsername"] = ( - self.getAuthorSlackUsername(author) - ) + decoratedCommit[ + "authorSlackUsername" + ] = self.getAuthorSlackUsername(author) break commitMap[commitHash] = decoratedCommit return commitMap @@ -295,8 +295,9 @@ res = self.getBrokenBuildTask(title) if len(res.data) != 0: self.logger.info( - "Open broken build task (T{}) exists. Skipping creation of a new one." - .format(res.data[0]["id"]) + "Open broken build task (T{}) exists. Skipping creation of a new one.".format( + res.data[0]["id"] + ) ) return None @@ -313,8 +314,9 @@ ] ) self.logger.info( - "Response from 'maniphest.edit' creating new task with title '{}': {}" - .format(title, newTask) + "Response from 'maniphest.edit' creating new task with title '{}': {}".format( + title, newTask + ) ) return newTask["object"] @@ -334,8 +336,9 @@ ) else: self.logger.info( - "Update of revision summary skipped due to deployment environment: '{}'" - .format(self.deployment) + "Update of revision summary skipped due to deployment environment: '{}'".format( + self.deployment + ) ) def get_project_members(self, project_PHID): diff --git a/contrib/buildbot/server.py b/contrib/buildbot/server.py --- a/contrib/buildbot/server.py +++ b/contrib/buildbot/server.py @@ -971,11 +971,9 @@ if not isMaster: phab.commentOnRevision( revisionPHID, - ( - "(IMPORTANT) The build failed due to an unexpected" - " infrastructure outage. The administrators have been" - " notified to investigate. Sorry for the inconvenience." - ), + "(IMPORTANT) The build failed due to an unexpected" + " infrastructure outage. The administrators have been" + " notified to investigate. Sorry for the inconvenience.", buildName, ) return SUCCESS, 200 @@ -1008,8 +1006,9 @@ "{}: Please set your slack username in your Phabricator profile" " so the landbot can send you direct messages: {}\n{}".format( authorSlackUsername, - "https://reviews.bitcoinabc.org/people/editprofile/{}" - .format(author["id"]), + "https://reviews.bitcoinabc.org/people/editprofile/{}".format( + author["id"] + ), landBotMessage, ) ) @@ -1037,9 +1036,10 @@ ) if updatedTask: # Only message once all of master is green - (buildFailures, testFailures) = ( - tc.getLatestBuildAndTestFailures("BitcoinABC") - ) + ( + buildFailures, + testFailures, + ) = tc.getLatestBuildAndTestFailures("BitcoinABC") if len(buildFailures) == 0 and len(testFailures) == 0: if not create_server.db["master_is_green"]: create_server.db["master_is_green"] = True @@ -1166,9 +1166,8 @@ for line in buildLog.splitlines(keepends=True): logLines.append(line) - msg += ( - "Tail of the build log:\n```lines=16,COUNTEREXAMPLE\n{}```" - .format("".join(logLines[-60:])) + msg += "Tail of the build log:\n```lines=16,COUNTEREXAMPLE\n{}```".format( + "".join(logLines[-60:]) ) else: # Print the failure log for each test diff --git a/contrib/buildbot/test/test_endpoint_status.py b/contrib/buildbot/test/test_endpoint_status.py --- a/contrib/buildbot/test/test_endpoint_status.py +++ b/contrib/buildbot/test/test_endpoint_status.py @@ -584,8 +584,7 @@ "value": ( "[[ {} | build-name ]] is broken on branch" " 'refs/heads/master'\n\nAssociated" - " commits:\nrABCdeadbeef00000111222333444555666777888000" - .format( + " commits:\nrABCdeadbeef00000111222333444555666777888000".format( self.teamcity.build_url( "viewLog.html", { @@ -668,8 +667,7 @@ "value": ( "[[ {} | build-name ]] is broken on branch" " 'refs/heads/master'\n\nAssociated" - " commits:\nrABCdeadbeef00000111222333444555666777888000" - .format( + " commits:\nrABCdeadbeef00000111222333444555666777888000".format( self.teamcity.build_url( "viewLog.html", { @@ -743,8 +741,7 @@ "value": ( "[[ {} | build-name ]] is broken on branch" " 'refs/heads/master'\n\nAssociated" - " commits:\nrABCdeadbeef00000111222333444555666777888000" - .format( + " commits:\nrABCdeadbeef00000111222333444555666777888000".format( self.teamcity.build_url( "viewLog.html", { @@ -821,8 +818,7 @@ "value": ( "[[ {} | build-name ]] is broken on branch" " 'refs/heads/master'\n\nAssociated" - " commits:\nrABCdeadbeef00000111222333444555666777888000\nrABCdeadbeef00000111222333444555666777888001" - .format( + " commits:\nrABCdeadbeef00000111222333444555666777888000\nrABCdeadbeef00000111222333444555666777888001".format( self.teamcity.build_url( "viewLog.html", { @@ -1109,8 +1105,7 @@ "type": "comment", "value": ( "(IMPORTANT) Build [[{} | build-name (linux)]] failed.\n\nTail" - " of the build log:\n```lines=16,COUNTEREXAMPLE\ndummy log```" - .format( + " of the build log:\n```lines=16,COUNTEREXAMPLE\ndummy log```".format( self.teamcity.build_url( "viewLog.html", { @@ -1702,7 +1697,9 @@ color=( "lightgrey" if status == BuildStatus.Unknown - else "brightgreen" if status == BuildStatus.Success else "red" + else "brightgreen" + if status == BuildStatus.Success + else "red" ), ) return '| [[{} | {}]] | {{image uri="{}", alt="{}"}} |\n'.format( diff --git a/contrib/buildbot/testutil.py b/contrib/buildbot/testutil.py --- a/contrib/buildbot/testutil.py +++ b/contrib/buildbot/testutil.py @@ -12,8 +12,9 @@ def __eq__(self, other): if not isinstance(other, cls): raise AssertionError( - "Argument class type did not match.\nExpected:\n{}\n\nActual:\n{}" - .format(pformat(cls), pformat(other)) + "Argument class type did not match.\nExpected:\n{}\n\nActual:\n{}".format( + pformat(cls), pformat(other) + ) ) if attrs is not None: for attr, expectedValue in attrs.items(): diff --git a/contrib/devtools/chainparams/test_make_chainparams.py b/contrib/devtools/chainparams/test_make_chainparams.py --- a/contrib/devtools/chainparams/test_make_chainparams.py +++ b/contrib/devtools/chainparams/test_make_chainparams.py @@ -142,9 +142,11 @@ def checkFailCounter(self): self.failCounter -= 1 if self.failCounter < 0: - raise Exception("""error code: -99 + raise Exception( + """error code: -99 error message: - mock error""") + mock error""" + ) def getblockchaininfo(self): self.checkFailCounter() @@ -285,10 +287,8 @@ CheckMockFailure( self, args, - ( - "expected was 'getblockheader" - " 0000000000000000003ef673ae12bc6017481830d37b9c52ce1e79c080e812b8'" - ), + "expected was 'getblockheader" + " 0000000000000000003ef673ae12bc6017481830d37b9c52ce1e79c080e812b8'", ) def test_bitcoin_cli_failures_testnet(self): diff --git a/contrib/devtools/test-security-check.py b/contrib/devtools/test-security-check.py --- a/contrib/devtools/test-security-check.py +++ b/contrib/devtools/test-security-check.py @@ -16,14 +16,16 @@ def write_testcode(filename): with open(filename, "w", encoding="utf8") as f: - f.write(""" + f.write( + """ #include int main() { printf("the quick brown fox jumps over the lazy god\\n"); return 0; } - """) + """ + ) def clean_files(source, executable): @@ -328,8 +330,7 @@ ), ( 1, - executable - + ": failed PIE DYNAMIC_BASE HIGH_ENTROPY_VA RELOC_SECTION" + executable + ": failed PIE DYNAMIC_BASE HIGH_ENTROPY_VA RELOC_SECTION" " CONTROL_FLOW", ), ) diff --git a/contrib/devtools/test-symbol-check.py b/contrib/devtools/test-symbol-check.py --- a/contrib/devtools/test-symbol-check.py +++ b/contrib/devtools/test-symbol-check.py @@ -44,7 +44,8 @@ # renameat2 was introduced in GLIBC 2.28, so is newer than the upper limit # of glibc for all platforms with open(source, "w", encoding="utf8") as f: - f.write(""" + f.write( + """ #define _GNU_SOURCE #include #include @@ -57,7 +58,8 @@ renameat2(0, "test", 0, "test_", RENAME_EXCHANGE); return 0; } - """) + """ + ) self.assertEqual( call_symbol_check(cc, source, executable, []), @@ -76,7 +78,8 @@ source = "test2.c" executable = "test2" with open(source, "w", encoding="utf8") as f: - f.write(""" + f.write( + """ #include int main() @@ -84,7 +87,8 @@ login(0); return 0; } - """) + """ + ) self.assertEqual( call_symbol_check(cc, source, executable, ["-lutil"]), @@ -102,7 +106,8 @@ executable = "test3" with open(source, "w", encoding="utf8") as f: - f.write(""" + f.write( + """ #include int main() @@ -110,7 +115,8 @@ printf("42"); return 0; } - """) + """ + ) self.assertEqual(call_symbol_check(cc, source, executable, []), (0, "")) @@ -120,7 +126,8 @@ cc = determine_wellknown_cmd("CC", "clang") with open(source, "w", encoding="utf8") as f: - f.write(""" + f.write( + """ #include int main() @@ -129,7 +136,8 @@ return 0; } - """) + """ + ) self.assertEqual( call_symbol_check( @@ -154,7 +162,8 @@ source = "test2.c" executable = "test2" with open(source, "w", encoding="utf8") as f: - f.write(""" + f.write( + """ #include int main() @@ -162,7 +171,8 @@ CGMainDisplayID(); return 0; } - """) + """ + ) self.assertEqual( call_symbol_check( @@ -184,12 +194,14 @@ source = "test3.c" executable = "test3" with open(source, "w", encoding="utf8") as f: - f.write(""" + f.write( + """ int main() { return 0; } - """) + """ + ) self.assertEqual( call_symbol_check( @@ -207,7 +219,8 @@ cc = determine_wellknown_cmd("CC", "x86_64-w64-mingw32-gcc") with open(source, "w", encoding="utf8") as f: - f.write(""" + f.write( + """ #include int main() @@ -215,7 +228,8 @@ PdhConnectMachineA(NULL); return 0; } - """) + """ + ) self.assertEqual( call_symbol_check( @@ -242,12 +256,14 @@ executable = "test2.exe" with open(source, "w", encoding="utf8") as f: - f.write(""" + f.write( + """ int main() { return 0; } - """) + """ + ) self.assertEqual( call_symbol_check( @@ -267,7 +283,8 @@ source = "test3.c" executable = "test3.exe" with open(source, "w", encoding="utf8") as f: - f.write(""" + f.write( + """ #include int main() @@ -275,7 +292,8 @@ CoFreeUnusedLibrariesEx(0,0); return 0; } - """) + """ + ) self.assertEqual( call_symbol_check( diff --git a/contrib/linearize/linearize-data.py b/contrib/linearize/linearize-data.py --- a/contrib/linearize/linearize-data.py +++ b/contrib/linearize/linearize-data.py @@ -319,9 +319,9 @@ if "netmagic" not in settings: settings["netmagic"] = "f9beb4d9" if "genesis" not in settings: - settings["genesis"] = ( - "000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f" - ) + settings[ + "genesis" + ] = "000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f" if "input" not in settings: settings["input"] = "input" if "hashlist" not in settings: diff --git a/contrib/macdeploy/macdeployqtplus.py b/contrib/macdeploy/macdeployqtplus.py --- a/contrib/macdeploy/macdeployqtplus.py +++ b/contrib/macdeploy/macdeployqtplus.py @@ -153,9 +153,7 @@ info.binaryPath = os.path.join(info.binaryDirectory, info.binaryName) info.version = parts[i + 2] - info.deployedInstallName = ( - f"@executable_path/../Frameworks/{os.path.join(info.frameworkName, info.binaryPath)}" - ) + info.deployedInstallName = f"@executable_path/../Frameworks/{os.path.join(info.frameworkName, info.binaryPath)}" info.destinationDirectory = os.path.join( cls.bundleFrameworkDirectory, info.frameworkName, info.binaryDirectory ) @@ -614,12 +612,14 @@ ) -ap = ArgumentParser(description="""Improved version of macdeployqt. +ap = ArgumentParser( + description="""Improved version of macdeployqt. Outputs a ready-to-deploy app in a folder "dist" and optionally wraps it in a .dmg file. Note, that the "dist" folder will be deleted before deploying on each run. -Optionally, Qt translation files (.qm) can be added to the bundle.""") +Optionally, Qt translation files (.qm) can be added to the bundle.""" +) ap.add_argument( "app_bundle", diff --git a/contrib/seeds/makeseeds.py b/contrib/seeds/makeseeds.py --- a/contrib/seeds/makeseeds.py +++ b/contrib/seeds/makeseeds.py @@ -232,10 +232,8 @@ ips = [parseline(line) for line in lines] print( - ( - "\x1b[7m IPv4 IPv6 Onion Pass " - " \x1b[0m" - ), + "\x1b[7m IPv4 IPv6 Onion Pass " + " \x1b[0m", file=sys.stderr, ) print(f"{ip_stats(ips):s} Initial", file=sys.stderr) diff --git a/contrib/teamcity/build-configurations.py b/contrib/teamcity/build-configurations.py --- a/contrib/teamcity/build-configurations.py +++ b/contrib/teamcity/build-configurations.py @@ -267,10 +267,8 @@ script_file = self.build_directory.joinpath("docker_timeout.sh") self.create_script_file( script_file, - ( - f'cd "${{HOME}}" && echo "docker stop {tag_name}" | at now' - f" +{timeout_minutes} minutes" - ), + f'cd "${{HOME}}" && echo "docker stop {tag_name}" | at now' + f" +{timeout_minutes} minutes", ) self.build_steps.append( @@ -381,7 +379,8 @@ "-G", generator_name, str(self.project_root), - ] + self.cmake_flags, + ] + + self.cmake_flags, } ) diff --git a/contrib/teamcity/nanobench_json_to_teamcity_messages.py b/contrib/teamcity/nanobench_json_to_teamcity_messages.py --- a/contrib/teamcity/nanobench_json_to_teamcity_messages.py +++ b/contrib/teamcity/nanobench_json_to_teamcity_messages.py @@ -10,7 +10,8 @@ from teamcity.messages import TeamcityServiceMessages if len(sys.argv) != 3: - print(f""" + print( + f""" Usage: {sys.argv[0]} @@ -19,7 +20,8 @@ Requires the teamcity-messages python library: pip3 install teamcity-messages -""") +""" + ) sys.exit(1) suite_name = sys.argv[1] diff --git a/contrib/tracing/p2p_monitor.py b/contrib/tracing/p2p_monitor.py --- a/contrib/tracing/p2p_monitor.py +++ b/contrib/tracing/p2p_monitor.py @@ -235,10 +235,8 @@ screen.addstr( 1, 0, - ( - " Navigate with UP/DOWN or J/K and select a peer with ENTER or SPACE to see" - " individual P2P messages" - ), + " Navigate with UP/DOWN or J/K and select a peer with ENTER or SPACE to see" + " individual P2P messages", curses.A_NORMAL, ) screen.addstr( diff --git a/electrum/contrib/deterministic-build/find_restricted_dependencies.py b/electrum/contrib/deterministic-build/find_restricted_dependencies.py --- a/electrum/contrib/deterministic-build/find_restricted_dependencies.py +++ b/electrum/contrib/deterministic-build/find_restricted_dependencies.py @@ -42,10 +42,8 @@ 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/electrum/electrumabc/asert_daa.py b/electrum/electrumabc/asert_daa.py --- a/electrum/electrumabc/asert_daa.py +++ b/electrum/electrumabc/asert_daa.py @@ -51,8 +51,9 @@ 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/electrum/electrumabc/caches.py b/electrum/electrumabc/caches.py --- a/electrum/electrumabc/caches.py +++ b/electrum/electrumabc/caches.py @@ -71,9 +71,9 @@ 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 @@ ) 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/electrum/electrumabc/commands.py b/electrum/electrumabc/commands.py --- a/electrum/electrumabc/commands.py +++ b/electrum/electrumabc/commands.py @@ -850,7 +850,9 @@ 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/electrum/electrumabc/dnssec.py b/electrum/electrumabc/dnssec.py --- a/electrum/electrumabc/dnssec.py +++ b/electrum/electrumabc/dnssec.py @@ -62,10 +62,8 @@ 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( @@ -73,14 +71,12 @@ 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/electrum/electrumabc/interface.py b/electrum/electrumabc/interface.py --- a/electrum/electrumabc/interface.py +++ b/electrum/electrumabc/interface.py @@ -196,10 +196,8 @@ 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/electrum/electrumabc/json_db.py b/electrum/electrumabc/json_db.py --- a/electrum/electrumabc/json_db.py +++ b/electrum/electrumabc/json_db.py @@ -470,8 +470,9 @@ 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/electrum/electrumabc/mnemo.py b/electrum/electrumabc/mnemo.py --- a/electrum/electrumabc/mnemo.py +++ b/electrum/electrumabc/mnemo.py @@ -289,9 +289,9 @@ self.data.words = tuple(load_wordlist(filename)) self.data.word_indices = {} 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/electrum/electrumabc/network.py b/electrum/electrumabc/network.py --- a/electrum/electrumabc/network.py +++ b/electrum/electrumabc/network.py @@ -1484,10 +1484,8 @@ 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) @@ -1500,8 +1498,9 @@ # 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/electrum/electrumabc/paymentrequest.py b/electrum/electrumabc/paymentrequest.py --- a/electrum/electrumabc/paymentrequest.py +++ b/electrum/electrumabc/paymentrequest.py @@ -660,10 +660,8 @@ 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 @@ 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/electrum/electrumabc/plugins.py b/electrum/electrumabc/plugins.py --- a/electrum/electrumabc/plugins.py +++ b/electrum/electrumabc/plugins.py @@ -163,9 +163,9 @@ ) 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 @@ 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/electrum/electrumabc/synchronizer.py b/electrum/electrumabc/synchronizer.py --- a/electrum/electrumabc/synchronizer.py +++ b/electrum/electrumabc/synchronizer.py @@ -358,8 +358,9 @@ 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/electrum/electrumabc/tests/test_avalanche.py b/electrum/electrumabc/tests/test_avalanche.py --- a/electrum/electrumabc/tests/test_avalanche.py +++ b/electrum/electrumabc/tests/test_avalanche.py @@ -214,17 +214,15 @@ }, ], 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/electrum/electrumabc/tests/test_dnssec.py b/electrum/electrumabc/tests/test_dnssec.py --- a/electrum/electrumabc/tests/test_dnssec.py +++ b/electrum/electrumabc/tests/test_dnssec.py @@ -13,14 +13,10 @@ 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 @@ 12698, 1, 43, - ( - "2371 13 2" - " 3b7f818a879ecb9931dae983d4529afedeb53993759d8080735083f954d40bc8" - ), + "2371 13 2" + " 3b7f818a879ecb9931dae983d4529afedeb53993759d8080735083f954d40bc8", ) rrsig = dns.rdtypes.ANY.RRSIG.RRSIG.from_text( 1, @@ -67,34 +61,26 @@ 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 @@ 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 @@ 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/electrum/electrumabc/tests/test_mnemonic.py b/electrum/electrumabc/tests/test_mnemonic.py --- a/electrum/electrumabc/tests/test_mnemonic.py +++ b/electrum/electrumabc/tests/test_mnemonic.py @@ -13,10 +13,8 @@ ) self.assertEqual( bh2u(seed), - ( - "741b72fd15effece6bfe5a26a52184f66811bd2be363190e07a42cca442b1a5b" - "b22b3ad0eb338197287e6d314866c7fba863ac65d3f156087a5052ebc7157fce" - ), + "741b72fd15effece6bfe5a26a52184f66811bd2be363190e07a42cca442b1a5b" + "b22b3ad0eb338197287e6d314866c7fba863ac65d3f156087a5052ebc7157fce", ) def test_random_seeds(self): diff --git a/electrum/electrumabc/tests/test_util.py b/electrum/electrumabc/tests/test_util.py --- a/electrum/electrumabc/tests/test_util.py +++ b/electrum/electrumabc/tests/test_util.py @@ -256,14 +256,12 @@ ) 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 @@ 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/electrum/electrumabc/transaction.py b/electrum/electrumabc/transaction.py --- a/electrum/electrumabc/transaction.py +++ b/electrum/electrumabc/transaction.py @@ -1251,7 +1251,9 @@ # 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 @@ -1419,10 +1421,8 @@ ): # 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/electrum/electrumabc/util.py b/electrum/electrumabc/util.py --- a/electrum/electrumabc/util.py +++ b/electrum/electrumabc/util.py @@ -707,11 +707,9 @@ 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) @@ -859,10 +857,8 @@ 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/electrum/electrumabc/verifier.py b/electrum/electrumabc/verifier.py --- a/electrum/electrumabc/verifier.py +++ b/electrum/electrumabc/verifier.py @@ -220,8 +220,9 @@ 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/electrum/electrumabc/wallet.py b/electrum/electrumabc/wallet.py --- a/electrum/electrumabc/wallet.py +++ b/electrum/electrumabc/wallet.py @@ -835,10 +835,8 @@ TxInfo = namedtuple( "TxInfo", - ( - "tx_hash, status, label, can_broadcast, amount, fee, height, conf," - " timestamp, exp_n, status_enum" - ), + "tx_hash, status, label, can_broadcast, amount, fee, height, conf," + " timestamp, exp_n, status_enum", ) class StatusEnum(Enum): @@ -1358,10 +1356,8 @@ 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 @@ -1792,9 +1788,9 @@ 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): @@ -3504,7 +3500,6 @@ class SimpleDeterministicWallet(SimpleWallet, DeterministicWallet): - """Deterministic Wallet with a single pubkey per address""" def __init__(self, storage): diff --git a/electrum/electrumabc/x509.py b/electrum/electrumabc/x509.py --- a/electrum/electrumabc/x509.py +++ b/electrum/electrumabc/x509.py @@ -378,8 +378,7 @@ ) 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/electrum/electrumabc_gui/qt/avalanche/delegation_editor.py b/electrum/electrumabc_gui/qt/avalanche/delegation_editor.py --- a/electrum/electrumabc_gui/qt/avalanche/delegation_editor.py +++ b/electrum/electrumabc_gui/qt/avalanche/delegation_editor.py @@ -222,11 +222,9 @@ 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/electrum/electrumabc_gui/qt/avalanche/proof_editor.py b/electrum/electrumabc_gui/qt/avalanche/proof_editor.py --- a/electrum/electrumabc_gui/qt/avalanche/proof_editor.py +++ b/electrum/electrumabc_gui/qt/avalanche/proof_editor.py @@ -317,10 +317,8 @@ 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 @@ 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 @@ 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 @@ 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/electrum/electrumabc_gui/qt/console.py b/electrum/electrumabc_gui/qt/console.py --- a/electrum/electrumabc_gui/qt/console.py +++ b/electrum/electrumabc_gui/qt/console.py @@ -45,7 +45,9 @@ QLabel, QLabel link {{ border-radius: {0}px; }} - """.format(BORDER_RADIUS) + """.format( + BORDER_RADIUS + ) CONFIRM_TEXT = _("I UNDERSTAND THE RISK").upper() diff --git a/electrum/electrumabc_gui/qt/consolidate_coins_dialog.py b/electrum/electrumabc_gui/qt/consolidate_coins_dialog.py --- a/electrum/electrumabc_gui/qt/consolidate_coins_dialog.py +++ b/electrum/electrumabc_gui/qt/consolidate_coins_dialog.py @@ -290,11 +290,9 @@ 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/electrum/electrumabc_gui/qt/invoice_dialog.py b/electrum/electrumabc_gui/qt/invoice_dialog.py --- a/electrum/electrumabc_gui/qt/invoice_dialog.py +++ b/electrum/electrumabc_gui/qt/invoice_dialog.py @@ -431,11 +431,9 @@ 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/electrum/electrumabc_gui/qt/main_window.py b/electrum/electrumabc_gui/qt/main_window.py --- a/electrum/electrumabc_gui/qt/main_window.py +++ b/electrum/electrumabc_gui/qt/main_window.py @@ -2503,14 +2503,10 @@ 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 = _( @@ -3933,8 +3929,7 @@ 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 @@ -4509,9 +4504,9 @@ 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/electrum/electrumabc_gui/qt/qrcodewidget.py b/electrum/electrumabc_gui/qt/qrcodewidget.py --- a/electrum/electrumabc_gui/qt/qrcodewidget.py +++ b/electrum/electrumabc_gui/qt/qrcodewidget.py @@ -52,8 +52,9 @@ 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/electrum/electrumabc_gui/qt/util.py b/electrum/electrumabc_gui/qt/util.py --- a/electrum/electrumabc_gui/qt/util.py +++ b/electrum/electrumabc_gui/qt/util.py @@ -382,10 +382,8 @@ 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 @@ -607,7 +605,9 @@ _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: @@ -1062,8 +1062,9 @@ 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/electrum/electrumabc_plugins/fusion/qt.py b/electrum/electrumabc_plugins/fusion/qt.py --- a/electrum/electrumabc_plugins/fusion/qt.py +++ b/electrum/electrumabc_plugins/fusion/qt.py @@ -245,14 +245,10 @@ 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/electrum/electrumabc_plugins/satochip/qt.py b/electrum/electrumabc_plugins/satochip/qt.py --- a/electrum/electrumabc_plugins/satochip/qt.py +++ b/electrum/electrumabc_plugins/satochip/qt.py @@ -112,9 +112,11 @@ 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 @@ 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 @@ 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/electrum/electrumabc_plugins/satochip/satochip.py b/electrum/electrumabc_plugins/satochip/satochip.py --- a/electrum/electrumabc_plugins/satochip/satochip.py +++ b/electrum/electrumabc_plugins/satochip/satochip.py @@ -153,10 +153,8 @@ ) 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 @@ 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 @@ 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 @@ 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, diff --git a/test/functional/abc_rpc_isfinal.py b/test/functional/abc_rpc_isfinal.py --- a/test/functional/abc_rpc_isfinal.py +++ b/test/functional/abc_rpc_isfinal.py @@ -111,10 +111,8 @@ # Needs -txindex assert_raises_rpc_error( -5, - ( - "No such transaction. Use -txindex or provide a block hash to" - " enable blockchain transaction queries." - ), + "No such transaction. Use -txindex or provide a block hash to" + " enable blockchain transaction queries.", node.isfinaltransaction, wallet_txid, ) diff --git a/test/functional/feature_config_args.py b/test/functional/feature_config_args.py --- a/test/functional/feature_config_args.py +++ b/test/functional/feature_config_args.py @@ -343,10 +343,8 @@ self.nodes[0].assert_start_raises_init_error( [f"-conf={conf_file}"], - ( - "Error: Error reading configuration file: specified data directory" - f' "{new_data_dir}" does not exist.' - ), + "Error: Error reading configuration file: specified data directory" + f' "{new_data_dir}" does not exist.', ) # Create the directory and ensure the config file now works diff --git a/test/functional/mining_prioritisetransaction.py b/test/functional/mining_prioritisetransaction.py --- a/test/functional/mining_prioritisetransaction.py +++ b/test/functional/mining_prioritisetransaction.py @@ -62,10 +62,8 @@ ) assert_raises_rpc_error( -8, - ( - "txid must be hexadecimal string (not" - " 'Zd1d4e24ed99057e84c3f80fd8fbec79ed9e1acee37da269356ecea000000000')" - ), + "txid must be hexadecimal string (not" + " 'Zd1d4e24ed99057e84c3f80fd8fbec79ed9e1acee37da269356ecea000000000')", self.nodes[0].prioritisetransaction, txid="Zd1d4e24ed99057e84c3f80fd8fbec79ed9e1acee37da269356ecea000000000", fee_delta=0, @@ -83,10 +81,8 @@ ) assert_raises_rpc_error( -8, - ( - "Priority is no longer supported, dummy argument to" - " prioritisetransaction must be 0." - ), + "Priority is no longer supported, dummy argument to" + " prioritisetransaction must be 0.", self.nodes[0].prioritisetransaction, txid, 1, diff --git a/test/functional/rpc_blockchain.py b/test/functional/rpc_blockchain.py --- a/test/functional/rpc_blockchain.py +++ b/test/functional/rpc_blockchain.py @@ -216,10 +216,8 @@ ) assert_raises_rpc_error( -8, - ( - "blockhash must be hexadecimal string (not" - " 'ZZZ0000000000000000000000000000000000000000000000000000000000000')" - ), + "blockhash must be hexadecimal string (not" + " 'ZZZ0000000000000000000000000000000000000000000000000000000000000')", self.nodes[0].getchaintxstats, blockhash=( "ZZZ0000000000000000000000000000000000000000000000000000000000000" @@ -356,10 +354,8 @@ ) assert_raises_rpc_error( -8, - ( - "hash must be hexadecimal string (not" - " 'ZZZ7bb8b1697ea987f3b223ba7819250cae33efacb068d23dc24859824a77844')" - ), + "hash must be hexadecimal string (not" + " 'ZZZ7bb8b1697ea987f3b223ba7819250cae33efacb068d23dc24859824a77844')", node.getblockheader, "ZZZ7bb8b1697ea987f3b223ba7819250cae33efacb068d23dc24859824a77844", ) diff --git a/test/functional/rpc_createmultisig.py b/test/functional/rpc_createmultisig.py --- a/test/functional/rpc_createmultisig.py +++ b/test/functional/rpc_createmultisig.py @@ -143,8 +143,7 @@ ) if e.error["code"] == -18 and ( "Wallet file verification failed. Failed to load database " - f"path '{path}'. Path does not exist." - in e.error["message"] + f"path '{path}'. Path does not exist." in e.error["message"] ): node1.createwallet(wallet_name="wmulti", disable_private_keys=True) else: diff --git a/test/functional/rpc_decodescript.py b/test/functional/rpc_decodescript.py --- a/test/functional/rpc_decodescript.py +++ b/test/functional/rpc_decodescript.py @@ -129,9 +129,7 @@ "OP_IF " + public_key + " OP_CHECKSIGVERIFY OP_ELSE 500000 OP_CHECKLOCKTIMEVERIFY OP_DROP" - " OP_ENDIF " - + public_key - + " OP_CHECKSIG", + " OP_ENDIF " + public_key + " OP_CHECKSIG", rpc_result["asm"], ) @@ -146,10 +144,8 @@ tx = "0100000001696a20784a2c70143f634e95227dbdfdf0ecd51647052e70854512235f5986ca010000008a47304402207174775824bec6c2700023309a168231ec80b82c6069282f5133e6f11cbb04460220570edc55c7c5da2ca687ebd0372d3546ebc3f810516a002350cac72dfe192dfb014104d3f898e6487787910a690410b7a917ef198905c27fb9d3b0a42da12aceae0544fc7088d239d9a48f2828a15a09e84043001f27cc80d162cb95404e1210161536ffffffff0100e1f505000000001976a914eb6c6e0cdb2d256a32d97b8df1fc75d1920d9bca88ac00000000" rpc_result = self.nodes[0].decoderawtransaction(tx) assert_equal( - ( - "304402207174775824bec6c2700023309a168231ec80b82c6069282f5133e6f11cbb04460220570edc55c7c5da2ca687ebd0372d3546ebc3f810516a002350cac72dfe192dfb[ALL]" - " 04d3f898e6487787910a690410b7a917ef198905c27fb9d3b0a42da12aceae0544fc7088d239d9a48f2828a15a09e84043001f27cc80d162cb95404e1210161536" - ), + "304402207174775824bec6c2700023309a168231ec80b82c6069282f5133e6f11cbb04460220570edc55c7c5da2ca687ebd0372d3546ebc3f810516a002350cac72dfe192dfb[ALL]" + " 04d3f898e6487787910a690410b7a917ef198905c27fb9d3b0a42da12aceae0544fc7088d239d9a48f2828a15a09e84043001f27cc80d162cb95404e1210161536", rpc_result["vin"][0]["scriptSig"]["asm"], ) @@ -163,18 +159,14 @@ rpc_result["txid"], ) assert_equal( - ( - "0 3045022100ae3b4e589dfc9d48cb82d41008dc5fa6a86f94d5c54f9935531924602730ab8002202f88cf464414c4ed9fa11b773c5ee944f66e9b05cc1e51d97abc22ce098937ea[ALL]" - " 3045022100b44883be035600e9328a01b66c7d8439b74db64187e76b99a68f7893b701d5380220225bf286493e4c4adcf928c40f785422572eb232f84a0b83b0dea823c3a19c75[ALL]" - " 5221020743d44be989540d27b1b4bbbcfd17721c337cb6bc9af20eb8a32520b393532f2102c0120a1dda9e51a938d39ddd9fe0ebc45ea97e1d27a7cbd671d5431416d3dd87210213820eb3d5f509d7438c9eeecb4157b2f595105e7cd564b3cdbb9ead3da41eed53ae" - ), + "0 3045022100ae3b4e589dfc9d48cb82d41008dc5fa6a86f94d5c54f9935531924602730ab8002202f88cf464414c4ed9fa11b773c5ee944f66e9b05cc1e51d97abc22ce098937ea[ALL]" + " 3045022100b44883be035600e9328a01b66c7d8439b74db64187e76b99a68f7893b701d5380220225bf286493e4c4adcf928c40f785422572eb232f84a0b83b0dea823c3a19c75[ALL]" + " 5221020743d44be989540d27b1b4bbbcfd17721c337cb6bc9af20eb8a32520b393532f2102c0120a1dda9e51a938d39ddd9fe0ebc45ea97e1d27a7cbd671d5431416d3dd87210213820eb3d5f509d7438c9eeecb4157b2f595105e7cd564b3cdbb9ead3da41eed53ae", rpc_result["vin"][0]["scriptSig"]["asm"], ) assert_equal( - ( - "OP_DUP OP_HASH160 dc863734a218bfe83ef770ee9d41a27f824a6e56" - " OP_EQUALVERIFY OP_CHECKSIG" - ), + "OP_DUP OP_HASH160 dc863734a218bfe83ef770ee9d41a27f824a6e56" + " OP_EQUALVERIFY OP_CHECKSIG", rpc_result["vout"][0]["scriptPubKey"]["asm"], ) assert_equal( @@ -197,10 +189,8 @@ tx = "01000000018d1f5635abd06e2c7e2ddf58dc85b3de111e4ad6e0ab51bb0dcf5e84126d927300000000fdfe0000483045022100ae3b4e589dfc9d48cb82d41008dc5fa6a86f94d5c54f9935531924602730ab8002202f88cf464414c4ed9fa11b773c5ee944f66e9b05cc1e51d97abc22ce098937ea01483045022100b44883be035600e9328a01b66c7d8439b74db64187e76b99a68f7893b701d5380220225bf286493e4c4adcf928c40f785422572eb232f84a0b83b0dea823c3a19c75014c695221020743d44be989540d27b1b4bbbcfd17721c337cb6bc9af20eb8a32520b393532f2102c0120a1dda9e51a938d39ddd9fe0ebc45ea97e1d27a7cbd671d5431416d3dd87210213820eb3d5f509d7438c9eeecb4157b2f595105e7cd564b3cdbb9ead3da41eed53aeffffffff02611e0000000000001976a914301102070101010101010102060101010101010188acee2a02000000000017a91430110207010101010101010206010101010101018700000000" rpc_result = self.nodes[0].decoderawtransaction(tx) assert_equal( - ( - "OP_DUP OP_HASH160 3011020701010101010101020601010101010101" - " OP_EQUALVERIFY OP_CHECKSIG" - ), + "OP_DUP OP_HASH160 3011020701010101010101020601010101010101" + " OP_EQUALVERIFY OP_CHECKSIG", rpc_result["vout"][0]["scriptPubKey"]["asm"], ) assert_equal( diff --git a/test/functional/rpc_fundrawtransaction.py b/test/functional/rpc_fundrawtransaction.py --- a/test/functional/rpc_fundrawtransaction.py +++ b/test/functional/rpc_fundrawtransaction.py @@ -632,10 +632,8 @@ rawtx = self.nodes[1].createrawtransaction(inputs, outputs) assert_raises_rpc_error( -4, - ( - "Transaction needs a change address, but we can't generate it. Please" - " call keypoolrefill first." - ), + "Transaction needs a change address, but we can't generate it. Please" + " call keypoolrefill first.", self.nodes[1].fundrawtransaction, rawtx, ) diff --git a/test/functional/rpc_help.py b/test/functional/rpc_help.py --- a/test/functional/rpc_help.py +++ b/test/functional/rpc_help.py @@ -72,11 +72,9 @@ mapping_server_conversion ): raise AssertionError( - ( - f"RPC client conversion table ({file_conversion_table}) and " - "RPC server named arguments mismatch!\n" - f"{set(mapping_client).symmetric_difference(mapping_server_conversion)}" - ), + f"RPC client conversion table ({file_conversion_table}) and " + "RPC server named arguments mismatch!\n" + f"{set(mapping_client).symmetric_difference(mapping_server_conversion)}", ) # Check for conversion difference by argument name. diff --git a/test/functional/rpc_misc.py b/test/functional/rpc_misc.py --- a/test/functional/rpc_misc.py +++ b/test/functional/rpc_misc.py @@ -27,10 +27,8 @@ self.log.info("test CHECK_NONFATAL") assert_raises_rpc_error( -1, - ( - 'Internal bug detected: "request.params[9].get_str() !=' - ' "trigger_internal_bug""' - ), + 'Internal bug detected: "request.params[9].get_str() !=' + ' "trigger_internal_bug""', lambda: node.echo(arg9="trigger_internal_bug"), ) diff --git a/test/functional/rpc_rawtransaction.py b/test/functional/rpc_rawtransaction.py --- a/test/functional/rpc_rawtransaction.py +++ b/test/functional/rpc_rawtransaction.py @@ -134,10 +134,8 @@ ) assert_raises_rpc_error( -8, - ( - "txid must be hexadecimal string (not" - " 'ZZZ7bb8b1697ea987f3b223ba7819250cae33efacb068d23dc24859824a77844')" - ), + "txid must be hexadecimal string (not" + " 'ZZZ7bb8b1697ea987f3b223ba7819250cae33efacb068d23dc24859824a77844')", self.nodes[0].createrawtransaction, [ { @@ -492,10 +490,8 @@ ) assert_raises_rpc_error( -8, - ( - "parameter 3 must be hexadecimal string (not" - " 'ZZZ0000000000000000000000000000000000000000000000000000000000000')" - ), + "parameter 3 must be hexadecimal string (not" + " 'ZZZ0000000000000000000000000000000000000000000000000000000000000')", self.nodes[0].getrawtransaction, tx, True, diff --git a/test/functional/rpc_txoutproof.py b/test/functional/rpc_txoutproof.py --- a/test/functional/rpc_txoutproof.py +++ b/test/functional/rpc_txoutproof.py @@ -75,20 +75,16 @@ # Invalid txids assert_raises_rpc_error( -8, - ( - "txid must be of length 64 (not 32, for" - " '00000000000000000000000000000000')" - ), + "txid must be of length 64 (not 32, for" + " '00000000000000000000000000000000')", self.nodes[0].gettxoutproof, ["00000000000000000000000000000000"], blockhash, ) assert_raises_rpc_error( -8, - ( - "txid must be hexadecimal string (not" - " 'ZZZ0000000000000000000000000000000000000000000000000000000000000')" - ), + "txid must be hexadecimal string (not" + " 'ZZZ0000000000000000000000000000000000000000000000000000000000000')", self.nodes[0].gettxoutproof, ["ZZZ0000000000000000000000000000000000000000000000000000000000000"], blockhash, @@ -96,20 +92,16 @@ # Invalid blockhashes assert_raises_rpc_error( -8, - ( - "blockhash must be of length 64 (not 32, for" - " '00000000000000000000000000000000')" - ), + "blockhash must be of length 64 (not 32, for" + " '00000000000000000000000000000000')", self.nodes[0].gettxoutproof, [txid_spent], "00000000000000000000000000000000", ) assert_raises_rpc_error( -8, - ( - "blockhash must be hexadecimal string (not" - " 'ZZZ0000000000000000000000000000000000000000000000000000000000000')" - ), + "blockhash must be hexadecimal string (not" + " 'ZZZ0000000000000000000000000000000000000000000000000000000000000')", self.nodes[0].gettxoutproof, [txid_spent], "ZZZ0000000000000000000000000000000000000000000000000000000000000", diff --git a/test/functional/test_framework/authproxy.py b/test/functional/test_framework/authproxy.py --- a/test/functional/test_framework/authproxy.py +++ b/test/functional/test_framework/authproxy.py @@ -133,8 +133,7 @@ except OSError as e: retry = ( "[WinError 10053] An established connection was aborted by the software" - " in your host machine" - in str(e) + " in your host machine" in str(e) ) # Workaround for a bug on macOS. See # https://bugs.python.org/issue33450 diff --git a/test/functional/test_framework/descriptors.py b/test/functional/test_framework/descriptors.py --- a/test/functional/test_framework/descriptors.py +++ b/test/functional/test_framework/descriptors.py @@ -6,9 +6,7 @@ import re -INPUT_CHARSET = ( - "0123456789()[],'/*abcdefgh@:$%{}IJKLMNOPQRSTUVWXYZ&+-.;<=>?!^_|~ijklmnopqrstuvwxyzABCDEFGH`#\"\\ " -) +INPUT_CHARSET = "0123456789()[],'/*abcdefgh@:$%{}IJKLMNOPQRSTUVWXYZ&+-.;<=>?!^_|~ijklmnopqrstuvwxyzABCDEFGH`#\"\\ " CHECKSUM_CHARSET = "qpzry9x8gf2tvdw0s3jn54khce6mua7l" GENERATOR = [0xF5DEE51989, 0xA9FDCA3312, 0x1BAB10E32D, 0x3706B1677A, 0x644D626FFD] diff --git a/test/functional/tool_wallet.py b/test/functional/tool_wallet.py --- a/test/functional/tool_wallet.py +++ b/test/functional/tool_wallet.py @@ -88,10 +88,8 @@ # `bitcoin-wallet help` raises an error. Use `bitcoin-wallet -help`. self.assert_raises_tool_error("Invalid command: help", "help") self.assert_raises_tool_error( - ( - "Error: two methods provided (info and create). Only one method should" - " be provided." - ), + "Error: two methods provided (info and create). Only one method should" + " be provided.", "info", "create", ) @@ -129,7 +127,8 @@ # shasum_before = self.wallet_shasum() timestamp_before = self.wallet_timestamp() self.log.debug(f"Wallet file timestamp before calling info: {timestamp_before}") - out = textwrap.dedent("""\ + out = textwrap.dedent( + """\ Wallet info =========== Encrypted: no @@ -137,7 +136,8 @@ Keypool Size: 2 Transactions: 0 Address Book: 1 - """) + """ + ) self.assert_tool_output(out, f"-wallet={self.default_wallet_name}", "info") timestamp_after = self.wallet_timestamp() self.log.debug(f"Wallet file timestamp after calling info: {timestamp_after}") @@ -171,7 +171,8 @@ shasum_before = self.wallet_shasum() timestamp_before = self.wallet_timestamp() self.log.debug(f"Wallet file timestamp before calling info: {timestamp_before}") - out = textwrap.dedent("""\ + out = textwrap.dedent( + """\ Wallet info =========== Encrypted: no @@ -179,7 +180,8 @@ Keypool Size: 2 Transactions: 1 Address Book: 1 - """) + """ + ) self.assert_tool_output(out, f"-wallet={self.default_wallet_name}", "info") shasum_after = self.wallet_shasum() timestamp_after = self.wallet_timestamp() @@ -201,7 +203,8 @@ self.log.debug( f"Wallet file timestamp before calling create: {timestamp_before}" ) - out = textwrap.dedent("""\ + out = textwrap.dedent( + """\ Topping up keypool... Wallet info =========== @@ -210,7 +213,8 @@ Keypool Size: 2000 Transactions: 0 Address Book: 0 - """) + """ + ) self.assert_tool_output(out, "-wallet=foo", "create") shasum_after = self.wallet_shasum() timestamp_after = self.wallet_timestamp() diff --git a/test/functional/wallet_basic.py b/test/functional/wallet_basic.py --- a/test/functional/wallet_basic.py +++ b/test/functional/wallet_basic.py @@ -148,20 +148,16 @@ assert_equal(len(self.nodes[2].listlockunspent()), 0) assert_raises_rpc_error( -8, - ( - "txid must be of length 64 (not 34, for" - " '0000000000000000000000000000000000')" - ), + "txid must be of length 64 (not 34, for" + " '0000000000000000000000000000000000')", self.nodes[2].lockunspent, False, [{"txid": "0000000000000000000000000000000000", "vout": 0}], ) assert_raises_rpc_error( -8, - ( - "txid must be hexadecimal string (not" - " 'ZZZ0000000000000000000000000000000000000000000000000000000000000')" - ), + "txid must be hexadecimal string (not" + " 'ZZZ0000000000000000000000000000000000000000000000000000000000000')", self.nodes[2].lockunspent, False, [ diff --git a/test/functional/wallet_createwallet.py b/test/functional/wallet_createwallet.py --- a/test/functional/wallet_createwallet.py +++ b/test/functional/wallet_createwallet.py @@ -264,10 +264,8 @@ w7 = node.get_wallet_rpc("w7") assert_raises_rpc_error( -15, - ( - "Error: running with an unencrypted wallet, but walletpassphrase was" - " called." - ), + "Error: running with an unencrypted wallet, but walletpassphrase was" + " called.", w7.walletpassphrase, "", 10, @@ -280,10 +278,8 @@ w8 = node.get_wallet_rpc("w8") assert_raises_rpc_error( -15, - ( - "Error: running with an unencrypted wallet, but walletpassphrase was" - " called." - ), + "Error: running with an unencrypted wallet, but walletpassphrase was" + " called.", w7.walletpassphrase, "", 10, @@ -293,11 +289,9 @@ self.log.info("Using a passphrase with private keys disabled returns error") assert_raises_rpc_error( -4, - ( - "Passphrase provided but private keys are disabled. A passphrase is" - " only used to encrypt private keys, so cannot be used for wallets with" - " private keys disabled." - ), + "Passphrase provided but private keys are disabled. A passphrase is" + " only used to encrypt private keys, so cannot be used for wallets with" + " private keys disabled.", self.nodes[0].createwallet, wallet_name="w9", disable_private_keys=True, diff --git a/test/functional/wallet_encryption.py b/test/functional/wallet_encryption.py --- a/test/functional/wallet_encryption.py +++ b/test/functional/wallet_encryption.py @@ -34,20 +34,16 @@ assert self.nodes[0].verifymessage(address, sig, msg) assert_raises_rpc_error( -15, - ( - "Error: running with an unencrypted wallet, but walletpassphrase was" - " called" - ), + "Error: running with an unencrypted wallet, but walletpassphrase was" + " called", self.nodes[0].walletpassphrase, "ff", 1, ) assert_raises_rpc_error( -15, - ( - "Error: running with an unencrypted wallet, but walletpassphrasechange" - " was called." - ), + "Error: running with an unencrypted wallet, but walletpassphrasechange" + " was called.", self.nodes[0].walletpassphrasechange, "ff", "ff", diff --git a/test/functional/wallet_importdescriptors.py b/test/functional/wallet_importdescriptors.py --- a/test/functional/wallet_importdescriptors.py +++ b/test/functional/wallet_importdescriptors.py @@ -665,18 +665,14 @@ assert_equal(res[0]["success"], True) assert_equal( res[0]["warnings"][0], - ( - "Not all private keys provided. Some wallet functionality may return" - " unexpected errors" - ), + "Not all private keys provided. Some wallet functionality may return" + " unexpected errors", ) assert_equal(res[1]["success"], True) assert_equal( res[1]["warnings"][0], - ( - "Not all private keys provided. Some wallet functionality may return" - " unexpected errors" - ), + "Not all private keys provided. Some wallet functionality may return" + " unexpected errors", ) self.nodes[1].createwallet( @@ -709,18 +705,14 @@ assert_equal(res[0]["success"], True) assert_equal( res[0]["warnings"][0], - ( - "Not all private keys provided. Some wallet functionality may return" - " unexpected errors" - ), + "Not all private keys provided. Some wallet functionality may return" + " unexpected errors", ) assert_equal(res[1]["success"], True) assert_equal( res[1]["warnings"][0], - ( - "Not all private keys provided. Some wallet functionality may return" - " unexpected errors" - ), + "Not all private keys provided. Some wallet functionality may return" + " unexpected errors", ) rawtx = self.nodes[1].createrawtransaction( diff --git a/test/functional/wallet_keypool.py b/test/functional/wallet_keypool.py --- a/test/functional/wallet_keypool.py +++ b/test/functional/wallet_keypool.py @@ -122,10 +122,8 @@ # creating a 5,000 sat transaction with change should not be possible assert_raises_rpc_error( -4, - ( - "Transaction needs a change address, but we can't generate it. Please" - " call keypoolrefill first." - ), + "Transaction needs a change address, but we can't generate it. Please" + " call keypoolrefill first.", w2.walletcreatefundedpsbt, inputs=[], outputs=[{addr.pop(): 50.00}], diff --git a/test/functional/wallet_listsinceblock.py b/test/functional/wallet_listsinceblock.py --- a/test/functional/wallet_listsinceblock.py +++ b/test/functional/wallet_listsinceblock.py @@ -90,10 +90,8 @@ ) assert_raises_rpc_error( -8, - ( - "blockhash must be hexadecimal string (not" - " 'Z000000000000000000000000000000000000000000000000000000000000000')" - ), + "blockhash must be hexadecimal string (not" + " 'Z000000000000000000000000000000000000000000000000000000000000000')", self.nodes[0].listsinceblock, "Z000000000000000000000000000000000000000000000000000000000000000", ) diff --git a/test/functional/wallet_multiwallet.py b/test/functional/wallet_multiwallet.py --- a/test/functional/wallet_multiwallet.py +++ b/test/functional/wallet_multiwallet.py @@ -291,10 +291,8 @@ # accessing wallet RPC without using wallet endpoint fails assert_raises_rpc_error( -19, - ( - "Wallet file not specified (must request wallet RPC through" - " /wallet/ uri-path)." - ), + "Wallet file not specified (must request wallet RPC through" + " /wallet/ uri-path).", node.getwalletinfo, ) @@ -336,11 +334,9 @@ assert_equal(node.listwallets(), []) assert_raises_rpc_error( -18, - ( - "No wallet is loaded. Load a wallet using loadwallet or create a new" - " one with createwallet. (Note: A default wallet is no longer " - "automatically created)" - ), + "No wallet is loaded. Load a wallet using loadwallet or create a new" + " one with createwallet. (Note: A default wallet is no longer " + "automatically created)", node.getwalletinfo, ) @@ -394,10 +390,8 @@ ) assert_raises_rpc_error( -18, - ( - "Wallet file verification failed. Failed to load database path" - f" '{path}'. Path does not exist." - ), + "Wallet file verification failed. Failed to load database path" + f" '{path}'. Path does not exist.", self.nodes[0].loadwallet, "wallets", ) @@ -413,10 +407,8 @@ ) assert_raises_rpc_error( -4, - ( - "Wallet file verification failed. Refusing to load database. " - f"Data file '{path}' is already loaded." - ), + "Wallet file verification failed. Refusing to load database. " + f"Data file '{path}' is already loaded.", self.nodes[0].loadwallet, wallet_names[0], ) @@ -432,10 +424,8 @@ ) assert_raises_rpc_error( -4, - ( - "Wallet file verification failed. Refusing to load database. " - f"Data file '{path}' is already loaded." - ), + "Wallet file verification failed. Refusing to load database. " + f"Data file '{path}' is already loaded.", self.nodes[0].loadwallet, self.wallet_data_filename, ) @@ -475,10 +465,8 @@ ) assert_raises_rpc_error( -18, - ( - "Wallet file verification failed. Failed to load database path" - f" '{path}'. Data is not in recognized format." - ), + "Wallet file verification failed. Failed to load database path" + f" '{path}'. Data is not in recognized format.", self.nodes[0].loadwallet, "empty_wallet_dir", ) @@ -551,11 +539,9 @@ assert_equal(self.nodes[0].listwallets(), []) assert_raises_rpc_error( -18, - ( - "No wallet is loaded. Load a wallet using loadwallet or create a new" - " one with createwallet. (Note: A default wallet is no longer " - "automatically created)" - ), + "No wallet is loaded. Load a wallet using loadwallet or create a new" + " one with createwallet. (Note: A default wallet is no longer " + "automatically created)", self.nodes[0].getwalletinfo, )