string-dot-format-extra-named-arguments (F522) (字符串格式化多余的命名参数)
派生自 Pyflakes 代码检查器。
有时提供修复。
作用
Checks for str.format
calls with unused keyword arguments. (检查 str.format
调用中未使用的关键字参数。)
为什么这不好?
Unused keyword arguments are redundant, and often indicative of a mistake. They should be removed. (未使用的关键字参数是多余的,通常表明存在错误。 应该删除它们。)
示例
建议改为
修复安全性
This rule's fix is marked as unsafe if the unused keyword argument contains a function call with potential side effects, because removing such arguments could change the behavior of the code. (如果未使用的关键字参数包含具有潜在副作用的函数调用,则此规则的修复将被标记为不安全,因为删除此类参数可能会改变代码的行为。)
例如,在以下情况下,修复将被标记为不安全