ruff various minor

This commit is contained in:
The MMGen Project 2026-08-07 09:37:48 +00:00
commit 9672837cfb
Signed by: mmgen
GPG key ID: 3F8B1861E32B7DA2
5 changed files with 10 additions and 12 deletions

View file

@ -228,7 +228,7 @@ class Config(Lockable):
enable_erigon = False
autochg_ignore_labels = False
autosign = False
threaded_python = sys.version_info.minor > 12 and not sys._is_gil_enabled()
threaded_python = sys.version_info >= (3, 13) and not sys._is_gil_enabled()
aes_backend = 'cryptography'
# regtest:

View file

@ -4,7 +4,8 @@
#
import struct, functools
from typing import Any, Callable, TypeVar
from typing import Any, TypeVar
from collections.abc import Callable
ALL_BYTES = tuple(struct.pack('B', i) for i in range(256))

View file

@ -103,7 +103,7 @@ class Sha2:
self.M = tuple(unpack(self.word_fmt, self.M[i*ws:ws+(i*ws)])[0] for i in range(len(self.M) // ws))
def digest(self):
return b''.join((pack(self.word_fmt, w) for w in self.H))
return b''.join(pack(self.word_fmt, w) for w in self.H)
def hexdigest(self):
return self.digest().hex()

View file

@ -228,7 +228,7 @@ def decode_pretty_hexdump(data):
pat = re.compile(fr'^[{hexdigits}]+:\s+')
lines = [pat.sub('', line) for line in data.splitlines()]
try:
return bytes.fromhex(''.join((''.join(lines).split())))
return bytes.fromhex(''.join(''.join(lines).split()))
except:
msg('Data not in hexdump format')
return False

View file

@ -16,7 +16,6 @@ indent-style = "tab"
[tool.ruff.lint]
ignore = [
"ASYNC221", # blocking method in async function (mmgen/rpc/backends/curl.py)
"B006", # Do not use mutable data structures for argument defaults
"B018", # Found useless expression. Either assign it to a variable or remove it.
"B026", # Star-arg unpacking after a keyword argument is strongly discouraged
@ -30,22 +29,18 @@ ignore = [
"RET501", # Do not explicitly `return None` in function if it is the only possible return value
"RUF012", # Mutable default value for class attribute
"RUF022", # `__all__` is not sorted
"RUF100", # Unused `noqa` directive (non-enabled: `F401`)
"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
"SIM114", # Combine `if` branches using logical `or` operator
"SIM905", # Consider using a list literal instead of `str.split`
"UP030", # Use implicit references for positional format fields
"UP031", # Use format specifiers instead of percent format
"UP032", # Use f-string instead of `format` call
"UP034", # Avoid extraneous parentheses
"UP035", # `typing.List` is deprecated, use `list` instead
"UP045", # Use `X | None` for type annotations
"YTT204", # `sys.version_info.minor` compared to integer (python4), compare `sys.version_info` to tuple
]
[tool.ruff.lint.per-file-ignores]
"protobuf.py" = [ "UP045" ] # Use `X | None` for type annotations
"mmgen/rpc/backends/curl.py" = [ "ASYNC221" ] # blocking method in async function
"mmgen/xmrwallet/__init__.py" = [ "PLC3002" ] # Lambda expression called directly
"mmgen/tool/*" = [ "F821" ] # Undefined name `sstr`
"mmgen/tool/file.py" = [ "B008" ] # function call in dfl args
@ -55,7 +50,9 @@ ignore = [
"mmgen/proto/eth/rlp/*" = [
"TRY002", # create your own exception
"UP004", # class `Binary` inherits from `object`
"UP008" # Use `super()` instead of `super(__class__, self)`
"UP008", # Use `super()` instead of `super(__class__, self)`
"UP030", # Use implicit references for positional format fields
"RUF100" # Unused `noqa` directive (non-enabled: `F401`)
]
"test/include/common.py" = [