如何使 PyCharm "Unexpected argument" 消息静音以创建简单的间接对象

How can I silence a PyCharm "Unexpected argument" message for simple, indirect object creation

我在使用以下代码时收到 Python 3.7 和 PyCharm 2020.2 的“意外参数”消息。

from dataclasses import dataclass


@dataclass
class Foo(object):
    x: int
    y: str
        
        
arg_dict = {'x': 1, 'y': 'bar'}

the_class = Foo

a = Foo(**arg_dict)

b = the_class(**arg_dict)

我怎样才能阻止或抑制它?

您可以使用

禁用警告
# noinspection PyArgumentList

在线前发生。

JetBrains 没有正确记录各种可能的 noinspection,这就是我发现以下列表有用的原因:https://gist.github.com/pylover/7870c235867cf22817ac5b096defb768.

我可以通过

在 per-project 的基础上将它们静音
File > Settings > Editor > Inspections > [search/select: 'Incorrect call arguments']

在“Severity by Scope”一角,将范围更改为“Project Files”并将严重性设置为“Typo”。