dataclass-wizard icon indicating copy to clipboard operation
dataclass-wizard copied to clipboard

`E3701: Invalid usage of field(), it should be the value of an assignment within a dataclass. (invalid-field-call)`

Open stdedos opened this issue 1 year ago • 1 comments

  • Dataclass Wizard version:
  • Python version:
  • Operating System:

Description

Describe what you were trying to get done. Tell us what happened, what went wrong, and what you expected to happen.

If I run exactly the "Dataclass Properties with property_wizard" (https://dataclass-wizard.readthedocs.io/en/stable/) example, I get

$  pylint p.py
************* Module p
p.py:10:0: C0115: Missing class docstring (missing-class-docstring)
p.py:11:33: E3701: Invalid usage of field(), it should be the value of an assignment within a dataclass. (invalid-field-call)
p.py:29:7: R2004: Consider using a named constant or an enum instead of '6'. (magic-value-comparison)

-----------------------------------
Your code has been rated at 5.33/10

I am just checking if this is the correct way to use it (and therefore pylint might need to learn the dataclass-wizard-way), or "you are doing something wrong".

What I Did

Paste the command(s) you ran and the output.
If there was a crash, please include the traceback here.

stdedos avatar Dec 13 '24 08:12 stdedos

Also

$ mypy p.py
p.py:10: error: Invalid metaclass "property_wizard"  [misc]
p.py:15: error: Name "wheels" already defined on line 11  [no-redef]
p.py:24: error: Missing positional argument "wheels" in call to "Vehicle"  [call-arg]
Found 3 errors in 1 file (checked 1 source file)

stdedos avatar Dec 13 '24 09:12 stdedos