From 91586dbbe5b68094758a0385376319bdfab403cb Mon Sep 17 00:00:00 2001 From: The MMGen Project Date: Fri, 7 Aug 2026 09:37:47 +0000 Subject: [PATCH] ruff RUF010 (use explicit conversion flag) --- pyproject.toml | 1 - setup.py | 2 +- test/cmdtest_d/input.py | 2 +- test/cmdtest_d/main.py | 2 +- test/cmdtest_d/swap.py | 2 +- test/modtest_d/amt.py | 2 +- 6 files changed, 5 insertions(+), 6 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 530f8be5..5293e997 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -32,7 +32,6 @@ ignore = [ "PLW0602", # Using global for `stdout_save` but no assignment is done "PLW1510", # `subprocess.run` without explicit `check` argument "RET501", # Do not explicitly `return None` in function if it is the only possible return value - "RUF010", # Use explicit conversion flag "RUF012", # Mutable default value for class attribute "RUF013", # PEP 484 prohibits implicit `Optional` "RUF015", # Prefer `next(s for s in res if 'ersion' in s)` over single element slice diff --git a/setup.py b/setup.py index a83175a2..0b47d89a 100755 --- a/setup.py +++ b/setup.py @@ -35,7 +35,7 @@ def build_libsecp256k1(): run(['git', 'clone', 'https://github.com/bitcoin-core/secp256k1.git'], check=True, cwd=cache_path) if not lib_file.exists(): - print(f'\nBuilding libsecp256k1 (cwd={str(src_path)})') + print(f'\nBuilding libsecp256k1 (cwd={src_path!s})') cmds = ( ['sh', './autogen.sh'], ['sh', './configure', 'CFLAGS=-g -O2 -fPIC', '--disable-dependency-tracking', diff --git a/test/cmdtest_d/input.py b/test/cmdtest_d/input.py index 0743fb0e..e48a1be0 100755 --- a/test/cmdtest_d/input.py +++ b/test/cmdtest_d/input.py @@ -269,7 +269,7 @@ class CmdTestInput(CmdTestBase): else: t.send(text, delay=delay) ret = t.expect_getend(' ==> ') - assert ret == repr(expect), f'Text mismatch! {ret} != {repr(expect)}' + assert ret == repr(expect), f'Text mismatch! {ret} != {expect!r}' return t def _get_char(self, func_args, text, expect, term): diff --git a/test/cmdtest_d/main.py b/test/cmdtest_d/main.py index ba0c6aa6..099660ad 100755 --- a/test/cmdtest_d/main.py +++ b/test/cmdtest_d/main.py @@ -639,7 +639,7 @@ class CmdTestMain(CmdTestBase, CmdTestShared): ad.add(al) aix = AddrIdxList(fmt_str=self.cfgs[s]['addr_idx_list']) if len(aix) != addrs_per_wallet: - die('TestSuiteFatalException', f'Address index list length != {addrs_per_wallet}: {repr(aix)}') + die('TestSuiteFatalException', f'Address index list length != {addrs_per_wallet}: {aix!r}') tx_data[s] = { 'addrfile': addrfile, 'chk': al.chksum, diff --git a/test/cmdtest_d/swap.py b/test/cmdtest_d/swap.py index bcd700b1..d80e70fb 100755 --- a/test/cmdtest_d/swap.py +++ b/test/cmdtest_d/swap.py @@ -494,7 +494,7 @@ class CmdTestSwap(CmdTestSwapMethods, CmdTestRegtest, CmdTestAutosignThreaded): '--usr-randchars=0', '--hash-preset=1', '--label=SwapWalletLabel', - f'--outdir={str(dest)}', + f'--outdir={dest!s}', dfl_bip39_file]) t.expect('wallet: ', rt_pw + '\n') t.expect('phrase: ', rt_pw + '\n') diff --git a/test/modtest_d/amt.py b/test/modtest_d/amt.py index d0084383..6174223c 100755 --- a/test/modtest_d/amt.py +++ b/test/modtest_d/amt.py @@ -48,7 +48,7 @@ def test_fmt(data): res = amt.fmt(*args, **kwargs) vmsg(fs.format( proto.upper(), - f'[{str(amt)}]', + f'[{amt!s}]', 'None' if iwidth is None else iwidth, 'None' if prec is None else prec, f'[{res}]'))