From 28e06ae168d9c8bc654b5af854cd4a623b7508de Mon Sep 17 00:00:00 2001 From: The MMGen Project Date: Fri, 7 Aug 2026 09:37:47 +0000 Subject: [PATCH] ruff SIM103 (return the negated condition directly) --- mmgen/proto/btc/rpc/local.py | 5 +---- mmgen/proto/vm/tx/completed.py | 4 +--- mmgen/wallet/mmgen.py | 13 +++++++------ pyproject.toml | 1 - 4 files changed, 9 insertions(+), 14 deletions(-) diff --git a/mmgen/proto/btc/rpc/local.py b/mmgen/proto/btc/rpc/local.py index 84629be1..7db35a6a 100755 --- a/mmgen/proto/btc/rpc/local.py +++ b/mmgen/proto/btc/rpc/local.py @@ -406,10 +406,7 @@ class BitcoinRPCClient(RPCClient, metaclass=AsyncInit): except: pass - if self.cfg.test_suite and not self.chain == 'regtest': - return True - - return False + return self.cfg.test_suite and not self.chain == 'regtest' return locals()[info_id]() diff --git a/mmgen/proto/vm/tx/completed.py b/mmgen/proto/vm/tx/completed.py index d97d68b6..dff32374 100755 --- a/mmgen/proto/vm/tx/completed.py +++ b/mmgen/proto/vm/tx/completed.py @@ -30,9 +30,7 @@ class Completed: def check_sigs(self): # TODO from ....util import is_hex_str - if is_hex_str(self.serialized): - return True - return False + return is_hex_str(self.serialized) def check_pubkey_scripts(self): pass diff --git a/mmgen/wallet/mmgen.py b/mmgen/wallet/mmgen.py index 139cf125..6d969ba5 100755 --- a/mmgen/wallet/mmgen.py +++ b/mmgen/wallet/mmgen.py @@ -106,12 +106,13 @@ class wallet(wallet): msg(f'Incorrect master checksum ({lines[0]}) in {desc} data') return False - chk = make_chksum_6(' '.join(lines[1:])) - if not self.cfg._util.compare_chksums(lines[0], 'master', chk, 'computed', - hdr='For wallet master checksum', verbose=True): - return False - - return True + return self.cfg._util.compare_chksums( + lines[0], + 'master', + make_chksum_6(' '.join(lines[1:])), + 'computed', + hdr = 'For wallet master checksum', + verbose = True) lines = self.fmt_data.splitlines() if not check_master_chksum(lines, self.desc): diff --git a/pyproject.toml b/pyproject.toml index 23264d64..5f43eaf2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -34,7 +34,6 @@ ignore = [ "S102", # Use of `exec` detected "S110", # `try`-`except`-`pass` detected, consider logging the exception "SIM102", # Use a single `if` statement instead of nested `if` statements - "SIM103", # Return the negated condition directly "SIM114", # Combine `if` branches using logical `or` operator "SIM115", # Use a context manager for opening files "SIM118", # Use `key in dict` instead of `key in dict.keys()`