ruff SIM118 (use key in dict instead of `key in dict.keys())

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

View file

@ -196,7 +196,7 @@ class coin_msg:
fs_hdr = '{:%s} {}' % max(len(v[0]) for v in hdr_data.values())
fs_sig = '%s{:%s} %s{}' % (
' ' * (2 if req_addr else 5),
max(len(labels[k]) for v in self.sigs.values() for k in v.keys()),
max(len(labels[k]) for v in self.sigs.values() for k in v),
self.msg_cls.sigdata_pfx or ''
) if self.sigs else None

View file

@ -35,7 +35,6 @@ ignore = [
"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
"SIM118", # Use `key in dict` instead of `key in dict.keys()`
"SIM201", # Use `path.stat().st_mode & S_IWUSR | S_IRUSR != S_IWUSR | S_IRUSR` instead of `not path.stat().st_mode & S_IWUSR | S_IRUSR == S_IWUSR | S_IRUSR`
"SIM210", # Use `bool(...)` instead of `True if ... else False`
"SIM401", # Use `d.get(arg, text)` instead of an `if` block

View file

@ -269,7 +269,7 @@ class TestCoinInfo(CoinInfo):
if isinstance(e['p2sh_info'], tuple):
fix_ver_info(e, 'p2sh_info')
for k in e.keys():
for k in e:
e[k] = repr(e[k])
e[k] = re.sub(r"'0x(..)'", r'0x\1', e[k])
e[k] = re.sub(r"'0x(....)'", r'0x\1', e[k])

View file

@ -337,9 +337,9 @@ if cfg.tool_api:
if cfg.list_tests:
Msg('Available tests:')
for modname in main_tool.mods.keys():
for modname in main_tool.mods:
cls = importlib.import_module(f'mmgen.tool.{modname}').tool_cmd
Msg(f' {modname:6} - {docstring_head(cls)}')
Msg(f' {modname:10} - {docstring_head(cls)}')
sys.exit(0)
if cfg.list_tested_cmds: