From 9c10ee7a031277d569a355d48b2b776e913a4c67 Mon Sep 17 00:00:00 2001 From: The MMGen Project Date: Mon, 10 Aug 2026 09:54:39 +0000 Subject: [PATCH] ruff F401 (imported but unused) --- pyproject.toml | 9 +++------ test/altcointest.py | 2 +- test/cmdtest.py | 4 ++-- test/cmdtest_d/automount_eth.py | 4 +--- test/cmdtest_d/autosign.py | 4 ++-- test/cmdtest_d/ethbump.py | 5 +---- test/cmdtest_d/ethdev.py | 1 - test/cmdtest_d/ethswap.py | 3 +-- test/cmdtest_d/include/group_mgr.py | 1 - test/cmdtest_d/include/runner.py | 4 ++-- test/cmdtest_d/ref.py | 2 -- test/cmdtest_d/regtest.py | 1 - test/cmdtest_d/rune.py | 2 +- test/cmdtest_d/xmrwallet.py | 2 +- test/colortest.py | 2 +- test/daemontest.py | 2 +- test/daemontest_d/exec.py | 2 +- test/gentest.py | 2 +- test/hashfunc.py | 2 +- test/misc/input_func.py | 2 +- test/misc/led.py | 1 - test/modtest.py | 2 +- test/modtest_d/amt.py | 1 - test/modtest_d/rune.py | 2 +- test/modtest_d/seedsplit.py | 1 - test/modtest_d/subseed.py | 2 -- test/modtest_d/testdep.py | 4 ++-- test/objattrtest.py | 2 +- test/objtest.py | 2 +- test/scrambletest.py | 2 +- test/tooltest2.py | 4 ++-- 31 files changed, 30 insertions(+), 49 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 7273d983..37be1dfd 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -54,6 +54,9 @@ ignore = [ "RUF100" # Unused `noqa` directive (non-enabled: `F401`) ] +"test/objattrtest_d/*" = [ "F401" ] # imported but unused +"test/objtest_d/*" = [ "F401" ] # imported but unused +"test/modtest_d/dep.py" = [ "F401" ] # imported but unused "test/include/common.py" = [ "F821", # undefined name 'cfg' "PLW0406" # self-import @@ -62,15 +65,9 @@ ignore = [ "SIM115", # open() with context manager "ASYNC230" # open() in async func ] -"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 -"test/modtest_d/testdep.py" = [ "F401" ] # imported but unused "test/modtest_d/obj.py" = [ "F841" ] # assigned to but never used -"test/objtest_d/*" = [ "F401" ] # imported but unused -"test/objattrtest_d/*" = [ "F401" ] # imported but unused "test/overlay/fakemods/*" = [ "F403", "F405" ] # `import *` used -"test/*.py" = [ "F401" ] # imported but unused "test/colortest.py" = [ "F403", "F405" ] # `import *` used "test/tooltest2.py" = [ "F403", "F405" ] # `import *` used "test/cmdtest_d/*" = [ "ASYNC251" ] # time.sleep() in async function diff --git a/test/altcointest.py b/test/altcointest.py index 0ddf0053..d7be3f16 100755 --- a/test/altcointest.py +++ b/test/altcointest.py @@ -17,7 +17,7 @@ import sys try: from include import test_init except ImportError: - from test.include import test_init + from test.include import test_init # noqa: F401 from mmgen.cfg import gc, Config from mmgen.util import msg diff --git a/test/cmdtest.py b/test/cmdtest.py index c8dfd3d5..daad2a8f 100755 --- a/test/cmdtest.py +++ b/test/cmdtest.py @@ -82,8 +82,8 @@ except ImportError: from test.include.test_init import repo_root from mmgen.cfg import Config, gc -from mmgen.color import red, yellow, green, blue, init_color -from mmgen.util import msg, Msg, rmsg, die +from mmgen.color import red, yellow, blue, init_color +from mmgen.util import Msg, rmsg, die from test.include.common import ( set_globals, diff --git a/test/cmdtest_d/automount_eth.py b/test/cmdtest_d/automount_eth.py index e6968b5b..23c22634 100755 --- a/test/cmdtest_d/automount_eth.py +++ b/test/cmdtest_d/automount_eth.py @@ -11,12 +11,10 @@ """ test.cmdtest_d.automount_eth: Ethereum automount autosigning tests for the cmdtest.py test suite """ -import os, re from .autosign import CmdTestAutosignThreaded from .ethdev import CmdTestEthdev, CmdTestEthdevMethods -from .include.common import dfl_words_file -from ..include.common import cfg, joinpath +from ..include.common import cfg class CmdTestAutosignETH(CmdTestAutosignThreaded, CmdTestEthdev, CmdTestEthdevMethods): 'automounted transacting operations for Ethereum via ethdev' diff --git a/test/cmdtest_d/autosign.py b/test/cmdtest_d/autosign.py index c4ee7395..b8aeec68 100755 --- a/test/cmdtest_d/autosign.py +++ b/test/cmdtest_d/autosign.py @@ -20,12 +20,12 @@ test.cmdtest_d.autosign: Autosign tests for the cmdtest.py test suite """ -import sys, os, time, shutil, atexit +import os, time, shutil, atexit from subprocess import run, DEVNULL from pathlib import Path from mmgen.cfg import Config, gc -from mmgen.color import red, blue, yellow, cyan, orange, purple, gray +from mmgen.color import red, blue, cyan, orange, purple, gray from mmgen.util import msg, suf, die, indent, fmt from mmgen.led import LEDControl from mmgen.autosign import Autosign diff --git a/test/cmdtest_d/ethbump.py b/test/cmdtest_d/ethbump.py index bf35f7da..8390498b 100755 --- a/test/cmdtest_d/ethbump.py +++ b/test/cmdtest_d/ethbump.py @@ -14,17 +14,14 @@ test.cmdtest_d.ethbump: Ethereum transaction bumping tests for the cmdtest.py te import sys, time, asyncio, json -from mmgen.cfg import Config -from mmgen.protocol import init_proto from mmgen.util import ymsg, suf from ..include.common import imsg, omsg_r from .include.common import cleanup_env, dfl_words_file, dfl_sid -from .include.runner import CmdTestRunner from .httpd.thornode.swap import ThornodeSwapServer -from .ethdev import CmdTestEthdev, CmdTestEthdevMethods +from .ethdev import CmdTestEthdev from .regtest import CmdTestRegtest from .swap import CmdTestSwapMethods, create_cross_methods from .ethswap import CmdTestEthSwapMethods diff --git a/test/cmdtest_d/ethdev.py b/test/cmdtest_d/ethdev.py index 1bc599bb..9b1a9b3d 100755 --- a/test/cmdtest_d/ethdev.py +++ b/test/cmdtest_d/ethdev.py @@ -57,7 +57,6 @@ from .include.common import ( tw_comment_zh, tw_comment_lat_cyr_gr, get_file_with_ext, - ok_msg, Ctrl_U, cleanup_env, thorchain_router_addr_file) diff --git a/test/cmdtest_d/ethswap.py b/test/cmdtest_d/ethswap.py index 31138919..47cf7a18 100755 --- a/test/cmdtest_d/ethswap.py +++ b/test/cmdtest_d/ethswap.py @@ -14,8 +14,7 @@ test.cmdtest_d.ethswap: Ethereum swap tests for the cmdtest.py test suite from subprocess import run, PIPE, DEVNULL -from mmgen.util import msg_r, rmsg, die -from mmgen.protocol import init_proto +from mmgen.util import rmsg, die from mmgen.fileutil import get_data_from_file from ..include.common import imsg, chk_equal diff --git a/test/cmdtest_d/include/group_mgr.py b/test/cmdtest_d/include/group_mgr.py index 0a6a705c..7b748d7d 100755 --- a/test/cmdtest_d/include/group_mgr.py +++ b/test/cmdtest_d/include/group_mgr.py @@ -12,7 +12,6 @@ cmdtest_d.include.group_mgr: Command group manager for the MMGen Wallet cmdtest suite """ -import sys, os, time from collections import namedtuple from mmgen.color import yellow, green, cyan diff --git a/test/cmdtest_d/include/runner.py b/test/cmdtest_d/include/runner.py index 06d6ffae..e572ca99 100755 --- a/test/cmdtest_d/include/runner.py +++ b/test/cmdtest_d/include/runner.py @@ -16,8 +16,8 @@ import sys, os, time, asyncio from collections import namedtuple from mmgen.cfg import gc -from mmgen.color import red, yellow, green, blue, cyan, gray, nocolor -from mmgen.util import msg, Msg, rmsg, ymsg, bmsg, die, suf, make_timestr, isAsync, capfirst +from mmgen.color import red, yellow, green, cyan, gray, nocolor +from mmgen.util import ymsg, bmsg, die, suf, make_timestr, isAsync, capfirst from ...include.common import ( cmdtest_py_log_fn, diff --git a/test/cmdtest_d/ref.py b/test/cmdtest_d/ref.py index ec7647f9..e687ce88 100755 --- a/test/cmdtest_d/ref.py +++ b/test/cmdtest_d/ref.py @@ -20,8 +20,6 @@ test.cmdtest_d.ref: Reference file tests for the cmdtest.py test suite """ -import os - from mmgen.util import capfirst from mmgen.wallet import get_wallet_cls from ..include.common import ( diff --git a/test/cmdtest_d/regtest.py b/test/cmdtest_d/regtest.py index ee37001d..86dc76fc 100755 --- a/test/cmdtest_d/regtest.py +++ b/test/cmdtest_d/regtest.py @@ -35,7 +35,6 @@ from mmgen.wallet import Wallet, get_wallet_cls from ..include.common import ( imsg, omsg, - ok, stop_test_daemons, joinpath, silence, diff --git a/test/cmdtest_d/rune.py b/test/cmdtest_d/rune.py index 3ceb4307..42c18895 100755 --- a/test/cmdtest_d/rune.py +++ b/test/cmdtest_d/rune.py @@ -16,7 +16,7 @@ from hashlib import md5 from mmgen.fileutil import get_data_from_file -from .include.common import dfl_sid, dfl_words_file +from .include.common import dfl_words_file from .include.proxy import TestProxy from .httpd.thornode.rpc import ThornodeRPCServer from .ethdev import CmdTestEthdevMethods diff --git a/test/cmdtest_d/xmrwallet.py b/test/cmdtest_d/xmrwallet.py index 8e3d00f9..ef72fb4c 100755 --- a/test/cmdtest_d/xmrwallet.py +++ b/test/cmdtest_d/xmrwallet.py @@ -21,7 +21,7 @@ test.cmdtest_d.xmrwallet: xmrwallet tests for the cmdtest.py test suite """ import os, time, re, atexit, asyncio, shutil -from subprocess import run, PIPE +from subprocess import run from collections import namedtuple from mmgen.cfg import gc diff --git a/test/colortest.py b/test/colortest.py index 7852bce6..9b27ca00 100755 --- a/test/colortest.py +++ b/test/colortest.py @@ -12,7 +12,7 @@ import os try: from include import test_init except ImportError: - from test.include import test_init + from test.include import test_init # noqa: F401 from mmgen.color import * from mmgen.util import msg, ymsg, gmsg diff --git a/test/daemontest.py b/test/daemontest.py index 4c4c3b3c..fb62295b 100755 --- a/test/daemontest.py +++ b/test/daemontest.py @@ -7,4 +7,4 @@ test/daemontest.py: Daemon-related unit tests for the MMGen suite try: from include import unit_test except ImportError: - from test.include import unit_test + from test.include import unit_test # noqa: F401 diff --git a/test/daemontest_d/exec.py b/test/daemontest_d/exec.py index 55241b02..c20a10ff 100755 --- a/test/daemontest_d/exec.py +++ b/test/daemontest_d/exec.py @@ -12,7 +12,7 @@ from mmgen.color import orange, red from mmgen.util import fmt_list, in_nix_environment from mmgen.daemon import CoinDaemon -from ..include.common import cfg, qmsg, qmsg_r, vmsg, msg, msg_r +from ..include.common import cfg, qmsg, qmsg_r, vmsg, msg def test_flags(coin): d = CoinDaemon(cfg, network_id=coin) diff --git a/test/gentest.py b/test/gentest.py index 9a9e48ed..acda09bb 100755 --- a/test/gentest.py +++ b/test/gentest.py @@ -25,7 +25,7 @@ import sys, os, time try: from include import test_init except ImportError: - from test.include import test_init + from test.include import test_init # noqa: F401 # Import these _after_ local path's been added to sys.path from mmgen.cfg import gc, Config diff --git a/test/hashfunc.py b/test/hashfunc.py index ec1aa871..8587870a 100755 --- a/test/hashfunc.py +++ b/test/hashfunc.py @@ -25,7 +25,7 @@ import sys try: from include import test_init except ImportError: - from test.include import test_init + from test.include import test_init # noqa: F401 from mmgen.util import msg, msg_r, die diff --git a/test/misc/input_func.py b/test/misc/input_func.py index 06f6d758..ad3dfc61 100755 --- a/test/misc/input_func.py +++ b/test/misc/input_func.py @@ -27,7 +27,7 @@ match cfg._args: msg('Entered: {}'.format(' '.join(pw))) case 'get_char' | 'line_input' as cmd, args: from mmgen.term import get_char - from mmgen.ui import line_input + from mmgen.ui import line_input # noqa: F401 from ast import literal_eval func_args = literal_eval(args) msg(f'\n term: {get_char.__self__.__name__}') diff --git a/test/misc/led.py b/test/misc/led.py index 5e59eff3..e7052b26 100755 --- a/test/misc/led.py +++ b/test/misc/led.py @@ -7,7 +7,6 @@ os.chdir(parpar) sys.path[0] = os.curdir from mmgen.cfg import Config -from mmgen.util import msg from mmgen.ui import keypress_confirm from mmgen.led import LEDControl diff --git a/test/modtest.py b/test/modtest.py index d21bd4e2..c40781ea 100755 --- a/test/modtest.py +++ b/test/modtest.py @@ -7,4 +7,4 @@ test/modtest.py: Unit tests for the MMGen suite try: from include import unit_test except ImportError: - from test.include import unit_test + from test.include import unit_test # noqa: F401 diff --git a/test/modtest_d/amt.py b/test/modtest_d/amt.py index 6174223c..7bba230a 100755 --- a/test/modtest_d/amt.py +++ b/test/modtest_d/amt.py @@ -8,7 +8,6 @@ from decimal import Decimal from mmgen.protocol import init_proto from mmgen.tx.new import parse_fee_spec -from mmgen.cfg import Config from mmgen.amt import TokenAmt from ..include.common import cfg, vmsg diff --git a/test/modtest_d/rune.py b/test/modtest_d/rune.py index 54ddf0de..691c3fc3 100755 --- a/test/modtest_d/rune.py +++ b/test/modtest_d/rune.py @@ -203,7 +203,7 @@ class unit_tests: return True def rpc(self, name, ut, desc='remote RPC operations'): - import sys, asyncio + import asyncio from mmgen.rpc import rpc_init from ..cmdtest_d.httpd.thornode.rpc import ThornodeRPCServer diff --git a/test/modtest_d/seedsplit.py b/test/modtest_d/seedsplit.py index 53262f2c..bf2d18d9 100755 --- a/test/modtest_d/seedsplit.py +++ b/test/modtest_d/seedsplit.py @@ -4,7 +4,6 @@ test.modtest_d.seedsplit: seed splitting unit tests for the MMGen suite """ -from mmgen.util import msg, msg_r from mmgen.color import pink from mmgen.seed import Seed from mmgen.seedsplit import SeedShareList, SeedShareIdx diff --git a/test/modtest_d/subseed.py b/test/modtest_d/subseed.py index 9f8a5134..77d89eb2 100755 --- a/test/modtest_d/subseed.py +++ b/test/modtest_d/subseed.py @@ -4,7 +4,6 @@ test.modtest_d.subseed: subseed unit tests for the MMGen suite """ -from mmgen.util import msg from mmgen.seed import Seed from mmgen.subseed import SubSeedList, SubSeedIdxRange @@ -178,7 +177,6 @@ class unit_tests: assert seed.subseed(last_idx).sid == last_sid, seed.subseed(last_idx).sid for sid in ss.data['long']: - # msg(sid) assert sid not in ss.data['short'] collisions = 0 diff --git a/test/modtest_d/testdep.py b/test/modtest_d/testdep.py index ecf56409..cdf2c7d0 100755 --- a/test/modtest_d/testdep.py +++ b/test/modtest_d/testdep.py @@ -7,7 +7,7 @@ test.modtest_d.testdep: test dependency unit tests for the MMGen suite import os from subprocess import run, DEVNULL -from mmgen.util import ymsg, bmsg +from mmgen.util import ymsg from ..include.common import cfg, get_ethkey sec = 'deadbeef' * 8 @@ -62,7 +62,7 @@ class unit_tests: def eth_keys(self, name, ut): try: - from eth_keys import keys + from eth_keys import keys # noqa: F401 return True except ImportError: if get_ethkey(): diff --git a/test/objattrtest.py b/test/objattrtest.py index fc35f1ea..0b9d2269 100755 --- a/test/objattrtest.py +++ b/test/objattrtest.py @@ -27,7 +27,7 @@ from collections import namedtuple try: from include import test_init except ImportError: - from test.include import test_init + from test.include import test_init # noqa: F401 from mmgen.cfg import Config from mmgen.util import msg, msg_r, gmsg, die diff --git a/test/objtest.py b/test/objtest.py index 0e12b295..eec629b7 100755 --- a/test/objtest.py +++ b/test/objtest.py @@ -25,7 +25,7 @@ import os, re try: from include import test_init except ImportError: - from test.include import test_init + from test.include import test_init # noqa: F401 # for objtest, violate MMGen Project best practices and allow use of the dev tools # in production code: diff --git a/test/scrambletest.py b/test/scrambletest.py index 44e0f706..0da91b15 100755 --- a/test/scrambletest.py +++ b/test/scrambletest.py @@ -28,7 +28,7 @@ from collections import namedtuple try: from include import test_init except ImportError: - from test.include import test_init + from test.include import test_init # noqa: F401 from mmgen.main import launch from mmgen.cfg import Config, gc diff --git a/test/tooltest2.py b/test/tooltest2.py index e8ec747e..1d598036 100755 --- a/test/tooltest2.py +++ b/test/tooltest2.py @@ -24,12 +24,12 @@ test/tooltest2.py: Test the 'mmgen-tool' utility # TODO: move all(?) tests in 'tooltest.py' here (or duplicate them?) import sys, os, time, importlib, asyncio -from subprocess import run, PIPE +from subprocess import run try: from include import test_init except ImportError: - from test.include import test_init + from test.include import test_init # noqa: F401 from test.include.common import set_globals, end_msg, init_coverage