From a5d12e2da62951916458aaddcaf571a71a93b9db Mon Sep 17 00:00:00 2001 From: PiRK Date: Thu, 20 Jul 2023 15:27:43 +0200 Subject: [PATCH] [lint] remove the --preview flag when running black Summary: I thought using the `--preview` flag would make the future transition from black 23.X to 24.X smoother, but unfortunately it is not as stable as I imagined. There is no guarantee that the result of running the linter with this flag will not change on minor upgrade, as we just saw with black 23.7.0 reverting a rule for string formatting (https://github.com/psf/black/pull/3640). The result in this diff was obtained in two steps: - adopt the latest expected future style for multiline concatatenated strings, by first running `arc lint --everything` after upgrading black to 23.7.0 - remove the `--preview` flag from `.arclint`, and rerun `arc lint --everything` The second step does not revert the first one because manually splitting long strings over multiple lines is already compatible with `black` 23.X (it just won't do it automatically for you). Test Plan: check we get the same result for all 23.X versions: ``` pip index versions black for version in 23.1.0 23.3.0 23.7.0 do pip install black==${version} arc lint --everything done ``` Reviewers: #bitcoin_abc, Fabien Reviewed By: #bitcoin_abc, Fabien Subscribers: Fabien Differential Revision: https://reviews.bitcoinabc.org/D14294 --- .arclint | 3 - contrib/buildbot/phabricator_wrapper.py | 27 ++--- contrib/buildbot/server.py | 25 +++-- contrib/buildbot/test/test_endpoint_status.py | 19 ++-- contrib/buildbot/testutil.py | 5 +- .../chainparams/test_make_chainparams.py | 12 +-- contrib/devtools/test-security-check.py | 9 +- contrib/devtools/test-symbol-check.py | 54 ++++++---- contrib/linearize/linearize-data.py | 6 +- contrib/macdeploy/macdeployqtplus.py | 10 +- contrib/seeds/makeseeds.py | 6 +- contrib/teamcity/build-configurations.py | 9 +- .../nanobench_json_to_teamcity_messages.py | 6 +- contrib/tracing/p2p_monitor.py | 6 +- .../find_restricted_dependencies.py | 6 +- electrum/electrumabc/asert_daa.py | 5 +- electrum/electrumabc/caches.py | 12 +-- electrum/electrumabc/commands.py | 4 +- electrum/electrumabc/dnssec.py | 20 ++-- electrum/electrumabc/interface.py | 6 +- electrum/electrumabc/json_db.py | 5 +- electrum/electrumabc/mnemo.py | 6 +- electrum/electrumabc/network.py | 11 +- electrum/electrumabc/paymentrequest.py | 12 +-- electrum/electrumabc/plugins.py | 16 ++- electrum/electrumabc/synchronizer.py | 5 +- electrum/electrumabc/tests/test_avalanche.py | 20 ++-- electrum/electrumabc/tests/test_dnssec.py | 102 +++++++----------- electrum/electrumabc/tests/test_mnemonic.py | 6 +- electrum/electrumabc/tests/test_util.py | 20 ++-- electrum/electrumabc/transaction.py | 10 +- electrum/electrumabc/util.py | 14 +-- electrum/electrumabc/verifier.py | 5 +- electrum/electrumabc/wallet.py | 19 ++-- electrum/electrumabc/x509.py | 3 +- .../qt/avalanche/delegation_editor.py | 8 +- .../qt/avalanche/proof_editor.py | 34 +++--- electrum/electrumabc_gui/qt/console.py | 4 +- .../qt/consolidate_coins_dialog.py | 8 +- electrum/electrumabc_gui/qt/invoice_dialog.py | 8 +- electrum/electrumabc_gui/qt/main_window.py | 21 ++-- electrum/electrumabc_gui/qt/qrcodewidget.py | 5 +- electrum/electrumabc_gui/qt/util.py | 15 +-- electrum/electrumabc_plugins/fusion/qt.py | 12 +-- electrum/electrumabc_plugins/satochip/qt.py | 15 ++- .../electrumabc_plugins/satochip/satochip.py | 23 ++-- test/functional/abc_rpc_isfinal.py | 6 +- test/functional/feature_config_args.py | 6 +- .../mining_prioritisetransaction.py | 12 +-- test/functional/rpc_blockchain.py | 12 +-- test/functional/rpc_createmultisig.py | 3 +- test/functional/rpc_decodescript.py | 30 ++---- test/functional/rpc_fundrawtransaction.py | 6 +- test/functional/rpc_help.py | 8 +- test/functional/rpc_misc.py | 6 +- test/functional/rpc_rawtransaction.py | 12 +-- test/functional/rpc_txoutproof.py | 24 ++--- test/functional/test_framework/authproxy.py | 3 +- test/functional/test_framework/descriptors.py | 4 +- test/functional/tool_wallet.py | 24 +++-- test/functional/wallet_basic.py | 12 +-- test/functional/wallet_createwallet.py | 20 ++-- test/functional/wallet_encryption.py | 12 +-- test/functional/wallet_importdescriptors.py | 24 ++--- test/functional/wallet_keypool.py | 6 +- test/functional/wallet_listsinceblock.py | 6 +- test/functional/wallet_multiwallet.py | 46 +++----- 67 files changed, 396 insertions(+), 543 deletions(-) diff --git a/.arclint b/.arclint index f41fcb2536..8f7e6ca4f4 100644 --- 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 index b5c1dab3c1..e99c663458 100755 --- a/contrib/buildbot/phabricator_wrapper.py +++ b/contrib/buildbot/phabricator_wrapper.py @@ -190,17 +190,17 @@ def decorateCommitMap(self, commitMapIn): 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 @@ def createBrokenBuildTask( 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 @@ def createBrokenBuildTask( ] ) 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 @@ def updateRevisionSummary(self, revisionId, summary): ) 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 index 1d670d5db4..dde2355e5a 100755 --- a/contrib/buildbot/server.py +++ b/contrib/buildbot/server.py @@ -971,11 +971,9 @@ def handle_build_result( 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 @@ def handle_build_result( "{}: 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 @@ def handle_build_result( ) 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 @@ def handle_build_result( 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 index 89f923737d..5586f66bf7 100755 --- a/contrib/buildbot/test/test_endpoint_status.py +++ b/contrib/buildbot/test/test_endpoint_status.py @@ -584,8 +584,7 @@ def test_status_master_failureAndTaskDoesNotExist_authorDefaultName(self): "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 @@ def test_status_master_failureAndTaskDoesNotExist_authorSlackUsername(self): "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 @@ def test_status_master_failureAndTaskDoesNotExist_scheduledBuild(self): "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 @@ def test_status_master_failureAndTaskDoesNotExist_multipleChanges(self): "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 @@ def test_status_revision_buildFailed(self): "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 @@ def build_line( 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 index 30bcb699ff..0d734efb94 100755 --- a/contrib/buildbot/testutil.py +++ b/contrib/buildbot/testutil.py @@ -12,8 +12,9 @@ class AnyWith(cls): 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 index b7e5a5849b..11f5a5fabc 100755 --- a/contrib/devtools/chainparams/test_make_chainparams.py +++ b/contrib/devtools/chainparams/test_make_chainparams.py @@ -142,9 +142,11 @@ def __init__( 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 @@ def test_wrong_chain(self): 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 index cddef310cd..3d9446ded8 100755 --- 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 @@ def test_PE(self): ), ( 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 index fc833ec8da..e52ceb6c4d 100755 --- a/contrib/devtools/test-symbol-check.py +++ b/contrib/devtools/test-symbol-check.py @@ -44,7 +44,8 @@ def test_ELF(self): # 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 @@ def test_ELF(self): renameat2(0, "test", 0, "test_", RENAME_EXCHANGE); return 0; } - """) + """ + ) self.assertEqual( call_symbol_check(cc, source, executable, []), @@ -76,7 +78,8 @@ def test_ELF(self): source = "test2.c" executable = "test2" with open(source, "w", encoding="utf8") as f: - f.write(""" + f.write( + """ #include int main() @@ -84,7 +87,8 @@ def test_ELF(self): login(0); return 0; } - """) + """ + ) self.assertEqual( call_symbol_check(cc, source, executable, ["-lutil"]), @@ -102,7 +106,8 @@ def test_ELF(self): executable = "test3" with open(source, "w", encoding="utf8") as f: - f.write(""" + f.write( + """ #include int main() @@ -110,7 +115,8 @@ def test_ELF(self): printf("42"); return 0; } - """) + """ + ) self.assertEqual(call_symbol_check(cc, source, executable, []), (0, "")) @@ -120,7 +126,8 @@ def test_MACHO(self): 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 @@ def test_MACHO(self): return 0; } - """) + """ + ) self.assertEqual( call_symbol_check( @@ -154,7 +162,8 @@ def test_MACHO(self): source = "test2.c" executable = "test2" with open(source, "w", encoding="utf8") as f: - f.write(""" + f.write( + """ #include int main() @@ -162,7 +171,8 @@ def test_MACHO(self): CGMainDisplayID(); return 0; } - """) + """ + ) self.assertEqual( call_symbol_check( @@ -184,12 +194,14 @@ def test_MACHO(self): 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 @@ def test_PE(self): 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 @@ def test_PE(self): PdhConnectMachineA(NULL); return 0; } - """) + """ + ) self.assertEqual( call_symbol_check( @@ -242,12 +256,14 @@ def test_PE(self): 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 @@ def test_PE(self): 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 @@ def test_PE(self): CoFreeUnusedLibrariesEx(0,0); return 0; } - """) + """ + ) self.assertEqual( call_symbol_check( diff --git a/contrib/linearize/linearize-data.py b/contrib/linearize/linearize-data.py index af1445acd0..434d1340e5 100755 --- a/contrib/linearize/linearize-data.py +++ b/contrib/linearize/linearize-data.py @@ -319,9 +319,9 @@ def run(self): 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 index 8b01b68a78..5f511a5830 100755 --- a/contrib/macdeploy/macdeployqtplus.py +++ b/contrib/macdeploy/macdeployqtplus.py @@ -153,9 +153,7 @@ def fromOtoolLibraryLine(cls, line: str) -> Optional["FrameworkInfo"]: 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 @@ def deployPlugins( ) -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 index 21bdf21e48..f0b2ec3b4d 100755 --- a/contrib/seeds/makeseeds.py +++ b/contrib/seeds/makeseeds.py @@ -232,10 +232,8 @@ def main(): 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 index 8f3f384d3e..e86d0a032b 100755 --- a/contrib/teamcity/build-configurations.py +++ b/contrib/teamcity/build-configurations.py @@ -267,10 +267,8 @@ def create_build_steps(self, artifact_dir, preview_url, ip_address): 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 @@ def create_build_steps(self, artifact_dir, preview_url, ip_address): "-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 index 033a53418d..76aac2c447 100755 --- 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 index a08003ef66..587ef2e9ac 100755 --- a/contrib/tracing/p2p_monitor.py +++ b/contrib/tracing/p2p_monitor.py @@ -235,10 +235,8 @@ def render(screen, peers, cur_list_pos, scroll, ROWS_AVALIABLE_FOR_LIST, info_pa 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 index 2bcb90b400..9562f7a13c 100755 --- a/electrum/contrib/deterministic-build/find_restricted_dependencies.py +++ b/electrum/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/electrum/electrumabc/asert_daa.py b/electrum/electrumabc/asert_daa.py index 9819e4dcc6..add25f022f 100644 --- a/electrum/electrumabc/asert_daa.py +++ b/electrum/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/electrum/electrumabc/caches.py b/electrum/electrumabc/caches.py index 75a1c75e5e..c89e70bf97 100644 --- a/electrum/electrumabc/caches.py +++ b/electrum/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/electrum/electrumabc/commands.py b/electrum/electrumabc/commands.py index 9a8fbf322d..7699d40c6c 100644 --- a/electrum/electrumabc/commands.py +++ b/electrum/electrumabc/commands.py @@ -850,7 +850,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/electrum/electrumabc/dnssec.py b/electrum/electrumabc/dnssec.py index f00afb6f88..927832765d 100644 --- 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 index cb3d2a52c6..743416d73a 100644 --- a/electrum/electrumabc/interface.py +++ b/electrum/electrumabc/interface.py @@ -196,10 +196,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/electrum/electrumabc/json_db.py b/electrum/electrumabc/json_db.py index 3301a1b1bd..5dc8ae8c42 100644 --- a/electrum/electrumabc/json_db.py +++ b/electrum/electrumabc/json_db.py @@ -470,8 +470,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/electrum/electrumabc/mnemo.py b/electrum/electrumabc/mnemo.py index cc2995d906..8b9524ad50 100644 --- a/electrum/electrumabc/mnemo.py +++ b/electrum/electrumabc/mnemo.py @@ -289,9 +289,9 @@ def __init__(self, lang=None): 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 index 102a995e4e..60e5b82522 100644 --- a/electrum/electrumabc/network.py +++ b/electrum/electrumabc/network.py @@ -1484,10 +1484,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) @@ -1500,8 +1498,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/electrum/electrumabc/paymentrequest.py b/electrum/electrumabc/paymentrequest.py index 8fceeaf77f..5f29f6fe28 100644 --- a/electrum/electrumabc/paymentrequest.py +++ b/electrum/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/electrum/electrumabc/plugins.py b/electrum/electrumabc/plugins.py index 206fe0a5db..2d7035deba 100644 --- a/electrum/electrumabc/plugins.py +++ b/electrum/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/electrum/electrumabc/synchronizer.py b/electrum/electrumabc/synchronizer.py index 0a62589fd9..545fba45bb 100644 --- a/electrum/electrumabc/synchronizer.py +++ b/electrum/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/electrum/electrumabc/tests/test_avalanche.py b/electrum/electrumabc/tests/test_avalanche.py index 29858f5d5d..461ccec821 100644 --- a/electrum/electrumabc/tests/test_avalanche.py +++ b/electrum/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/electrum/electrumabc/tests/test_dnssec.py b/electrum/electrumabc/tests/test_dnssec.py index edb386ad91..87bb754f54 100644 --- a/electrum/electrumabc/tests/test_dnssec.py +++ b/electrum/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/electrum/electrumabc/tests/test_mnemonic.py b/electrum/electrumabc/tests/test_mnemonic.py index d916340a61..39ffba1a44 100644 --- a/electrum/electrumabc/tests/test_mnemonic.py +++ b/electrum/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/electrum/electrumabc/tests/test_util.py b/electrum/electrumabc/tests/test_util.py index c9db4777b0..fb192271d1 100644 --- a/electrum/electrumabc/tests/test_util.py +++ b/electrum/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/electrum/electrumabc/transaction.py b/electrum/electrumabc/transaction.py index 638ae0768e..e112894ad4 100644 --- a/electrum/electrumabc/transaction.py +++ b/electrum/electrumabc/transaction.py @@ -1251,7 +1251,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 @@ -1419,10 +1421,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/electrum/electrumabc/util.py b/electrum/electrumabc/util.py index 417c4ea64a..9022ea2e21 100644 --- a/electrum/electrumabc/util.py +++ b/electrum/electrumabc/util.py @@ -707,11 +707,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) @@ -859,10 +857,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/electrum/electrumabc/verifier.py b/electrum/electrumabc/verifier.py index 1b5faf70a5..37caee97f2 100644 --- a/electrum/electrumabc/verifier.py +++ b/electrum/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/electrum/electrumabc/wallet.py b/electrum/electrumabc/wallet.py index 70e5eba3d0..08d917249d 100644 --- a/electrum/electrumabc/wallet.py +++ b/electrum/electrumabc/wallet.py @@ -835,10 +835,8 @@ def get_wallet_delta(self, tx) -> WalletDelta: 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 @@ 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 @@ -1792,9 +1788,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): @@ -3504,7 +3500,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/electrum/electrumabc/x509.py b/electrum/electrumabc/x509.py index ec89f490a3..89a090d785 100644 --- a/electrum/electrumabc/x509.py +++ b/electrum/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/electrum/electrumabc_gui/qt/avalanche/delegation_editor.py b/electrum/electrumabc_gui/qt/avalanche/delegation_editor.py index e96df78fd1..24bddbbe7d 100644 --- a/electrum/electrumabc_gui/qt/avalanche/delegation_editor.py +++ b/electrum/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/electrum/electrumabc_gui/qt/avalanche/proof_editor.py b/electrum/electrumabc_gui/qt/avalanche/proof_editor.py index 7bae701a59..1f6e51cddd 100644 --- a/electrum/electrumabc_gui/qt/avalanche/proof_editor.py +++ b/electrum/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/electrum/electrumabc_gui/qt/console.py b/electrum/electrumabc_gui/qt/console.py index 9fbcd5bdd7..a9fed2197d 100644 --- a/electrum/electrumabc_gui/qt/console.py +++ b/electrum/electrumabc_gui/qt/console.py @@ -45,7 +45,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/electrum/electrumabc_gui/qt/consolidate_coins_dialog.py b/electrum/electrumabc_gui/qt/consolidate_coins_dialog.py index 14513ba187..202c4997d3 100644 --- a/electrum/electrumabc_gui/qt/consolidate_coins_dialog.py +++ b/electrum/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/electrum/electrumabc_gui/qt/invoice_dialog.py b/electrum/electrumabc_gui/qt/invoice_dialog.py index 1ec1254c52..104e44428b 100644 --- a/electrum/electrumabc_gui/qt/invoice_dialog.py +++ b/electrum/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/electrum/electrumabc_gui/qt/main_window.py b/electrum/electrumabc_gui/qt/main_window.py index 5c7f9567de..90d32ab4ae 100644 --- a/electrum/electrumabc_gui/qt/main_window.py +++ b/electrum/electrumabc_gui/qt/main_window.py @@ -2503,14 +2503,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 = _( @@ -3933,8 +3929,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 @@ -4509,9 +4504,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/electrum/electrumabc_gui/qt/qrcodewidget.py b/electrum/electrumabc_gui/qt/qrcodewidget.py index 2633c9686c..b36de87844 100644 --- a/electrum/electrumabc_gui/qt/qrcodewidget.py +++ b/electrum/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/electrum/electrumabc_gui/qt/util.py b/electrum/electrumabc_gui/qt/util.py index 98109dafd7..dae3f59924 100644 --- a/electrum/electrumabc_gui/qt/util.py +++ b/electrum/electrumabc_gui/qt/util.py @@ -382,10 +382,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 @@ -607,7 +605,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: @@ -1062,8 +1062,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/electrum/electrumabc_plugins/fusion/qt.py b/electrum/electrumabc_plugins/fusion/qt.py index 9d27d182d2..f4df489c56 100644 --- a/electrum/electrumabc_plugins/fusion/qt.py +++ b/electrum/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/electrum/electrumabc_plugins/satochip/qt.py b/electrum/electrumabc_plugins/satochip/qt.py index 8b0766585a..419a9e68cb 100644 --- a/electrum/electrumabc_plugins/satochip/qt.py +++ b/electrum/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/electrum/electrumabc_plugins/satochip/satochip.py b/electrum/electrumabc_plugins/satochip/satochip.py index 966d3d6d0d..cb28bb297a 100644 --- a/electrum/electrumabc_plugins/satochip/satochip.py +++ b/electrum/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, diff --git a/test/functional/abc_rpc_isfinal.py b/test/functional/abc_rpc_isfinal.py index 6e222ce151..77d3431720 100755 --- a/test/functional/abc_rpc_isfinal.py +++ b/test/functional/abc_rpc_isfinal.py @@ -111,10 +111,8 @@ def is_finalblock(blockhash): # 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 index 158e623f10..cbb2f1b604 100755 --- a/test/functional/feature_config_args.py +++ b/test/functional/feature_config_args.py @@ -343,10 +343,8 @@ def run_test(self): 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 index 191c2e2f2a..bad53ba2eb 100755 --- a/test/functional/mining_prioritisetransaction.py +++ b/test/functional/mining_prioritisetransaction.py @@ -62,10 +62,8 @@ def run_test(self): ) 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 @@ def run_test(self): ) 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 index 65cdd38506..0656c6a2b5 100755 --- a/test/functional/rpc_blockchain.py +++ b/test/functional/rpc_blockchain.py @@ -216,10 +216,8 @@ def _test_getchaintxstats(self): ) 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 @@ def _test_getblockheader(self): ) 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 index 336430d3ec..84a50c77ba 100755 --- a/test/functional/rpc_createmultisig.py +++ b/test/functional/rpc_createmultisig.py @@ -143,8 +143,7 @@ def do_multisig(self): ) 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 index 9bb5767383..b9f0cff7be 100755 --- a/test/functional/rpc_decodescript.py +++ b/test/functional/rpc_decodescript.py @@ -129,9 +129,7 @@ def decodescript_script_pub_key(self): "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 @@ def decoderawtransaction_asm_sighashtype(self): 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 @@ def decoderawtransaction_asm_sighashtype(self): 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 @@ def decoderawtransaction_asm_sighashtype(self): 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 index 076b44fcc6..0f9bd67005 100755 --- a/test/functional/rpc_fundrawtransaction.py +++ b/test/functional/rpc_fundrawtransaction.py @@ -632,10 +632,8 @@ def test_locked_wallet(self): 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 index cf211ecf87..656d8f76f5 100755 --- a/test/functional/rpc_help.py +++ b/test/functional/rpc_help.py @@ -72,11 +72,9 @@ def test_client_conversion_table(self): 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 index 94700b38ef..53c68e704b 100755 --- a/test/functional/rpc_misc.py +++ b/test/functional/rpc_misc.py @@ -27,10 +27,8 @@ def run_test(self): 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 index 0cd39ba18f..96ee24de5f 100755 --- a/test/functional/rpc_rawtransaction.py +++ b/test/functional/rpc_rawtransaction.py @@ -134,10 +134,8 @@ def run_test(self): ) 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 @@ def run_test(self): ) 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 index bd997eaf55..0b3f3133f4 100755 --- a/test/functional/rpc_txoutproof.py +++ b/test/functional/rpc_txoutproof.py @@ -75,20 +75,16 @@ def run_test(self): # 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 @@ def run_test(self): # 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 index 0216f4a4a1..a2356460ce 100644 --- a/test/functional/test_framework/authproxy.py +++ b/test/functional/test_framework/authproxy.py @@ -133,8 +133,7 @@ def _request(self, method, path, postdata): 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 index 76ab1582fc..aa89bc1e54 100644 --- 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 index bffa55caf8..7d783173c7 100755 --- a/test/functional/tool_wallet.py +++ b/test/functional/tool_wallet.py @@ -88,10 +88,8 @@ def test_invalid_tool_commands_and_args(self): # `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 @@ def test_tool_wallet_info(self): # 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 @@ def test_tool_wallet_info(self): 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 @@ def test_tool_wallet_info_after_transaction(self): 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 @@ def test_tool_wallet_info_after_transaction(self): 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 @@ def test_tool_wallet_create_on_existing_wallet(self): 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 @@ def test_tool_wallet_create_on_existing_wallet(self): 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 index 2349edda1d..5c2be2d711 100755 --- a/test/functional/wallet_basic.py +++ b/test/functional/wallet_basic.py @@ -148,20 +148,16 @@ def run_test(self): 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 index 13601fd569..f92cfcb5a0 100755 --- a/test/functional/wallet_createwallet.py +++ b/test/functional/wallet_createwallet.py @@ -264,10 +264,8 @@ def run_test(self): 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 @@ def run_test(self): 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 @@ def run_test(self): 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 index 6c6135a015..2da1d2a755 100755 --- a/test/functional/wallet_encryption.py +++ b/test/functional/wallet_encryption.py @@ -34,20 +34,16 @@ def run_test(self): 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 index 7f3c8c723f..7ce2a3a894 100755 --- a/test/functional/wallet_importdescriptors.py +++ b/test/functional/wallet_importdescriptors.py @@ -665,18 +665,14 @@ def run_test(self): 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 @@ def run_test(self): 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 index b5f4be59df..481f977471 100755 --- a/test/functional/wallet_keypool.py +++ b/test/functional/wallet_keypool.py @@ -122,10 +122,8 @@ def run_test(self): # 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 index 53014999fd..42e94ffed5 100755 --- a/test/functional/wallet_listsinceblock.py +++ b/test/functional/wallet_listsinceblock.py @@ -90,10 +90,8 @@ def test_invalid_blockhash(self): ) 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 index 08220e4964..973cc16202 100755 --- a/test/functional/wallet_multiwallet.py +++ b/test/functional/wallet_multiwallet.py @@ -291,10 +291,8 @@ def wallet_file(name): # 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 @@ def wallet_file(name): 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 @@ def wallet_file(name): ) 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 @@ def wallet_file(name): ) 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 @@ def wallet_file(name): ) 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 @@ def wallet_file(name): ) 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 @@ def wallet_file(name): 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, )