ruff B010 (setattr with constant attribute value)
This commit is contained in:
parent
69288c3cb0
commit
f311f46840
4 changed files with 3 additions and 4 deletions
|
|
@ -68,6 +68,6 @@ def init_dev():
|
|||
import builtins
|
||||
# MMGenObject is added to the namespace by objmethods.py, so we must name the builtin differently
|
||||
# to avoid inadvertently adding MMGenObject to the global namespace here:
|
||||
setattr(builtins, 'MMGenObjectDevTools', MMGenObjectDevTools)
|
||||
builtins.MMGenObjectDevTools = MMGenObjectDevTools
|
||||
for funcname, func in devtools_funcs.items():
|
||||
setattr(builtins, funcname, func)
|
||||
|
|
|
|||
|
|
@ -411,7 +411,7 @@ class oneshot_warning:
|
|||
msg(getattr(color, wcls.color)('WARNING: ' + wcls.message.format(*fmt_args)))
|
||||
|
||||
if not hasattr(wcls, 'data'):
|
||||
setattr(wcls, 'data', [])
|
||||
wcls.data = []
|
||||
|
||||
data = wcls.data
|
||||
condition = (div in data) if reverse else (not div in data)
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@ indent-style = "tab"
|
|||
ignore = [
|
||||
"ASYNC221", # blocking method in async function (mmgen/rpc/backends/curl.py)
|
||||
"B006", # Do not use mutable data structures for argument defaults
|
||||
"B010", # Do not call `setattr` with a constant attribute value. It is not any safer than normal property access.
|
||||
"B018", # Found useless expression. Either assign it to a variable or remove it.
|
||||
"B023", # Function definition does not bind loop variable `confs`
|
||||
"B026", # Star-arg unpacking after a keyword argument is strongly discouraged
|
||||
|
|
|
|||
|
|
@ -339,7 +339,7 @@ if cfg.list_tests:
|
|||
Msg('Available tests:')
|
||||
for modname, cmdlist in main_tool.mods.items():
|
||||
cls = importlib.import_module(f'mmgen.tool.{modname}').tool_cmd
|
||||
Msg(f' {modname:10} - {docstring_head(cls)}')
|
||||
Msg(f' {modname:6} - {docstring_head(cls)}')
|
||||
sys.exit(0)
|
||||
|
||||
if cfg.list_tested_cmds:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue