From 223c971175658625e2c9832d89edeeb2210f0d2a Mon Sep 17 00:00:00 2001 From: The MMGen Project Date: Fri, 7 Aug 2026 09:37:47 +0000 Subject: [PATCH] ruff (various) --- mmgen/proto/eth/rlp/atomic.py | 3 --- mmgen/proto/eth/rlp/exceptions.py | 1 - mmgen/proto/eth/rlp/sedes/serializable.py | 1 - pyproject.toml | 4 ---- test/gentest.py | 4 ++-- test/tooltest2.py | 2 +- 6 files changed, 3 insertions(+), 12 deletions(-) diff --git a/mmgen/proto/eth/rlp/atomic.py b/mmgen/proto/eth/rlp/atomic.py index 1898b08d..8fb4d148 100644 --- a/mmgen/proto/eth/rlp/atomic.py +++ b/mmgen/proto/eth/rlp/atomic.py @@ -1,10 +1,7 @@ import abc - class Atomic(metaclass=abc.ABCMeta): """ABC for objects that can be RLP encoded as is.""" - pass - Atomic.register(bytes) Atomic.register(bytearray) diff --git a/mmgen/proto/eth/rlp/exceptions.py b/mmgen/proto/eth/rlp/exceptions.py index eaf5c31f..8efe40e1 100644 --- a/mmgen/proto/eth/rlp/exceptions.py +++ b/mmgen/proto/eth/rlp/exceptions.py @@ -1,6 +1,5 @@ class RLPException(Exception): """Base class for exceptions raised by this package.""" - pass class EncodingError(RLPException): diff --git a/mmgen/proto/eth/rlp/sedes/serializable.py b/mmgen/proto/eth/rlp/sedes/serializable.py index 0e20041d..5e9b6f91 100644 --- a/mmgen/proto/eth/rlp/sedes/serializable.py +++ b/mmgen/proto/eth/rlp/sedes/serializable.py @@ -477,4 +477,3 @@ class Serializable(BaseSerializable, metaclass=SerializableBase): """ The base class for serializable objects. """ - pass diff --git a/pyproject.toml b/pyproject.toml index 37e87217..41f3daea 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -22,7 +22,6 @@ ignore = [ "B026", # Star-arg unpacking after a keyword argument is strongly discouraged "BLE001", # Do not catch blind exception: `Exception` "E722", # bare except - "FURB129", # Instead of calling `readlines()`, iterate over file object directly "FURB157", # Verbose expression in `Decimal` constructor "FURB163", # Prefer `math.log2(state.lanew)` over `math.log` with a redundant base "FURB166", # Use of `int` with explicit `base=16` after removing prefix @@ -30,9 +29,6 @@ ignore = [ "I001", # Import block is un-sorted or un-formatted "ISC004", # Unparenthesized implicit string concatenation in collection "N999", # Invalid module name: 'import' - "PERF102", # When using only the keys of a dict use the `keys()` method - "PIE790", # Unnecessary `pass` statement - "PIE804", # Unnecessary `dict` kwargs "PLC0206", # Extracting value from dictionary without calling `.items()` "PLC3002", # Lambda expression called directly. Execute the expression inline instead. "PLR1704", # Redefining argument with the local name `tx` diff --git a/test/gentest.py b/test/gentest.py index bcf4fced..9a9e48ed 100755 --- a/test/gentest.py +++ b/test/gentest.py @@ -162,7 +162,7 @@ class GenTool: else: ret = self.run(sec, vcoin) if cache_data: - self.data[key] = sd(**{'reduced':sec.hex()}, **ret._asdict()) + self.data[key] = sd(reduced=sec.hex(), **ret._asdict()) return ret class GenToolEth_keys(GenTool): @@ -453,7 +453,7 @@ def speed_test(proto, kg, ag, rounds): def dump_test(proto, kg, ag, filename): with open(filename) as fp: - dump = [[*(e.split()[0] for e in line.split('addr='))] for line in fp.readlines() if 'addr=' in line] + dump = [[*(e.split()[0] for e in line.split('addr='))] for line in fp if 'addr=' in line] if not dump: die(1, f'File {filename!r} appears not to be a wallet dump') diff --git a/test/tooltest2.py b/test/tooltest2.py index 044fca1a..fcccdf49 100755 --- a/test/tooltest2.py +++ b/test/tooltest2.py @@ -337,7 +337,7 @@ if cfg.tool_api: if cfg.list_tests: Msg('Available tests:') - for modname, cmdlist in main_tool.mods.items(): + for modname in main_tool.mods.keys(): cls = importlib.import_module(f'mmgen.tool.{modname}').tool_cmd Msg(f' {modname:6} - {docstring_head(cls)}') sys.exit(0)