Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

I am getting an "Unexpected argument" message with Python 3.7 and PyCharm 2020.2 when using the code below.

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)

How can I prevent it or silence it?

like image 241
Jim Biard Avatar asked Oct 18 '25 14:10

Jim Biard


1 Answers

You can disable the warning by using

# noinspection PyArgumentList

on the line before it occurs.

The various possible noinspections are not properly documented by JetBrains, which is why I find the following list useful: https://gist.github.com/pylover/7870c235867cf22817ac5b096defb768.

like image 146
Legendre17 Avatar answered Oct 20 '25 03:10

Legendre17



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!