You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the __post_init__ method of a dataclass, the InitVar's cannot be passed by keyword argument, they must be positional. But in this case, FBT001 is trigged. For example:
If we instead change the definition to def __post_init__(self, *, force: bool) -> None:, then FBT001 is no longer triggered, but the code will not work:
$ python test.py
Traceback (most recent call last):
File "<snip>/test.py", line 11, in <module>
Fit(True)
File "<string>", line 3, in __init__
TypeError: Fit.__post_init__() takes 1 positional argument but 2 were given
I suggest that dataclasses __post_init__ be added to an internal whitelist to be ignored by FBT001.
The text was updated successfully, but these errors were encountered:
In the
__post_init__
method of a dataclass, the InitVar's cannot be passed by keyword argument, they must be positional. But in this case, FBT001 is trigged. For example:And then with Ruff:
If we instead change the definition to
def __post_init__(self, *, force: bool) -> None:
, then FBT001 is no longer triggered, but the code will not work:I suggest that dataclasses
__post_init__
be added to an internal whitelist to be ignored by FBT001.The text was updated successfully, but these errors were encountered: