From c6ede7eaadd6483958bdb46f678641e29c3ecc92 Mon Sep 17 00:00:00 2001 From: The MMGen Project Date: Fri, 7 Aug 2026 09:37:47 +0000 Subject: [PATCH] ruff various minor --- pyproject.toml | 16 +++++++--------- test/cmdtest_d/httpd/thornode/swap.py | 2 +- test/include/unit_test.py | 1 - 3 files changed, 8 insertions(+), 11 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 5293e997..7658a9e6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -24,20 +24,13 @@ ignore = [ "E722", # bare except "I001", # Import block is un-sorted or un-formatted "ISC004", # Unparenthesized implicit string concatenation in collection - "N999", # Invalid module name: 'import' + "N999", # Invalid module name: 'import'... "PLC0206", # Extracting value from dictionary without calling `.items()` - "PLC3002", # Lambda expression called directly. Execute the expression inline instead. - "PLW0406", # Module `test.include.common` imports itself - "PLW0602", # Using global for `stderr_save` but no assignment is done - "PLW0602", # Using global for `stdout_save` but no assignment is done "PLW1510", # `subprocess.run` without explicit `check` argument "RET501", # Do not explicitly `return None` in function if it is the only possible return value "RUF012", # Mutable default value for class attribute - "RUF013", # PEP 484 prohibits implicit `Optional` "RUF015", # Prefer `next(s for s in res if 'ersion' in s)` over single element slice "RUF022", # `__all__` is not sorted - "RUF046", # Value being cast to `int` is already an integer - "RUF059", # Unpacked variable `recv_chain` is never used "RUF100", # Unused `noqa` directive (non-enabled: `F401`) "S102", # Use of `exec` detected "S110", # `try`-`except`-`pass` detected, consider logging the exception @@ -66,12 +59,17 @@ ignore = [ ] [tool.ruff.lint.per-file-ignores] +"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 +"mmgen/tool/rpc.py" = [ "RUF013" ] # PEP 484 prohibits implicit `Optional` "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' +"test/include/common.py" = [ + "F821", # undefined name 'cfg' + "PLW0406" # self-import +] "test/misc/input_func.py" = [ "F401" ] # imported but unused "test/modtest_d/cashaddr.py" = [ "F841" ] # assigned to but never used "test/modtest_d/dep.py" = [ "F401" ] # imported but unused diff --git a/test/cmdtest_d/httpd/thornode/swap.py b/test/cmdtest_d/httpd/thornode/swap.py index 6991da5b..262974cd 100755 --- a/test/cmdtest_d/httpd/thornode/swap.py +++ b/test/cmdtest_d/httpd/thornode/swap.py @@ -134,7 +134,7 @@ class ThornodeSwapServer(ThornodeServer): def make_response_body(self, method, environ): m = re.search(self.request_pat, request_uri(environ)) - send_chain, send_asset, recv_chain, recv_asset, amt_atomic = m.groups() + send_chain, send_asset, _, recv_asset, amt_atomic = m.groups() in_amt = UniAmt(int(amt_atomic), from_unit='satoshi') out_amt = in_amt * (prices[send_asset] / prices[recv_asset]) diff --git a/test/include/unit_test.py b/test/include/unit_test.py index e559c6ca..5a7ba794 100755 --- a/test/include/unit_test.py +++ b/test/include/unit_test.py @@ -124,7 +124,6 @@ def silence(): def end_silence(): if not cfg.verbose: - global stdout_save, stderr_save sys.stdout = gv.stdout = stdout_save sys.stderr = gv.stderr = stderr_save