From d8dd0cc2464676716e1d2399b6ecd8a861cfe7b6 Mon Sep 17 00:00:00 2001 From: The MMGen Project Date: Fri, 7 Aug 2026 09:37:47 +0000 Subject: [PATCH] ruff FURB163 (`math.log`), FURB166 (base16 w/o prefix) --- mmgen/color.py | 2 +- pyproject.toml | 3 +-- test/altcointest.py | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/mmgen/color.py b/mmgen/color.py index 68eda9f5..6f9c9f0a 100755 --- a/mmgen/color.py +++ b/mmgen/color.py @@ -73,7 +73,7 @@ def get_terminfo_colors(term=None): if s.isdecimal(): return int(s) elif s.startswith('0x') and is_hex_str(s[2:]): - return int(s[2:], 16) + return int(s, 16) else: return None diff --git a/pyproject.toml b/pyproject.toml index 5329eb6b..dde68724 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -22,8 +22,6 @@ ignore = [ "B026", # Star-arg unpacking after a keyword argument is strongly discouraged "BLE001", # Do not catch blind exception: `Exception` "E722", # bare except - "FURB163", # Prefer `math.log2(state.lanew)` over `math.log` with a redundant base - "FURB166", # Use of `int` with explicit `base=16` after removing prefix "FURB192", # Prefer `max` over `sorted()` to compute the maximum value in a sequence "I001", # Import block is un-sorted or un-formatted "ISC004", # Unparenthesized implicit string concatenation in collection @@ -73,6 +71,7 @@ ignore = [ [tool.ruff.lint.per-file-ignores] "mmgen/tool/*" = [ "F821" ] # Undefined name `sstr` "mmgen/tool/file.py" = [ "B008" ] # function call in dfl args +"mmgen/contrib/keccak.py" = [ "FURB163" ] # `math.log` -> `math.log2(state.lanew)` "examples/*" = [ "ASYNC230" ] # open() in async function "test/include/common.py" = [ "F821" ] # undefined name 'cfg' diff --git a/test/altcointest.py b/test/altcointest.py index ec30add5..7c3bf2b3 100755 --- a/test/altcointest.py +++ b/test/altcointest.py @@ -240,7 +240,7 @@ class TestCoinInfo(CoinInfo): def fix_ver_info(e, k): e[k] = list(e[k]) e[k][0] = myhex(e[k][0]) - s1 = cls.find_addr_leading_symbol(int(e[k][0][2:], 16)) + s1 = cls.find_addr_leading_symbol(int(e[k][0], 16)) m = f'Fixing leading address letter for coin {e["symbol"]} ({e[k][1]!r} --> {s1})' if e[k][1] != '?': assert s1 == e[k][1], f'First letters do not match! {m}'