ruff (various)

This commit is contained in:
The MMGen Project 2026-08-07 09:37:47 +00:00
commit 223c971175
Signed by: mmgen
GPG key ID: 3F8B1861E32B7DA2
6 changed files with 3 additions and 12 deletions

View file

@ -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)

View file

@ -1,6 +1,5 @@
class RLPException(Exception):
"""Base class for exceptions raised by this package."""
pass
class EncodingError(RLPException):

View file

@ -477,4 +477,3 @@ class Serializable(BaseSerializable, metaclass=SerializableBase):
"""
The base class for serializable objects.
"""
pass

View file

@ -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`

View file

@ -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')

View file

@ -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)