-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
E1124:redundant-keyword-arg
false positive on dataclass with kw_only=False
that extends dataclass with kw_only=True
#7290
Comments
Re-opening as I'd like to refocus #5767 to the See also: Happens with the """Quick test to demonstrate pylint errors when using kw_only dataclass
fields."""
from dataclasses import dataclass, field
@dataclass
class Creature:
"""Defines a creature with one or more names (first names, middle names,
last names, etc.)"""
names: list[str] = field(kw_only=True)
@dataclass
class Human(Creature):
"""Defines a human who has a home address."""
address: str
donna = Human('1858 Hidden Meadow Drive, East Grand Forks, ND 56721',
names=['Donna', 'Jennings'])
print(donna) Running pylint (2.12.2):
Running Python 3.10.2:
Originally posted by @Infernio in #5767 (comment) |
I posted a fix to |
Finally got around to testing this. Unfortunately, I still get errors when using """Docstring to quiet pylint."""
from dataclasses import dataclass, field
@dataclass
class ClassA:
"""Docstring to quiet pylint."""
kw_field: str = field(kw_only=True)
@dataclass
class ClassB(ClassA):
"""Docstring to quiet pylint."""
normal_field: int
print(ClassB(42, kw_field='Hello World')) Runs fine on Python 3.10.7:
But produces these errors when run through pylint (v2.15.4, with astroid v2.12.11):
Should I open a new issue for that? |
Can you open a new issue for this. Perhaps even in the The issue is that we don't support |
Bug description
Configuration
No response
Command used
Pylint output
Expected behavior
no error
Pylint version
OS / Environment
No response
Additional dependencies
No response
The text was updated successfully, but these errors were encountered: