ruff F401 (imported but unused)

This commit is contained in:
The MMGen Project 2026-08-10 09:54:39 +00:00
commit 9c10ee7a03
Signed by: mmgen
GPG key ID: 3F8B1861E32B7DA2
31 changed files with 30 additions and 49 deletions

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -35,7 +35,6 @@ from mmgen.wallet import Wallet, get_wallet_cls
from ..include.common import (
imsg,
omsg,
ok,
stop_test_daemons,
joinpath,
silence,

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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