Description
ruff version: 0.9.7
command: ruff check test.py --select RUF --preview
import functools
from collections.abc import Callable
from dataclasses import dataclass
@dataclass
class Vector:
x: float
y: float
def __call__(self) -> None:
print(self)
# RUF045: Assignment without annotation found in dataclass body
call = __call__
call2: Callable[..., None] = __call__ # this makes new field
def add(self, x: float, y: float):
return Vector(x=self.x + x, y=self.y + y)
# RUF045: Assignment without annotation found in dataclass body
add_x = functools.partialmethod(add, y=0)
I am not sure if it's intended, but ruff check RUF045 for assigning a method of dataclass.
Is there a more appropriate way for typing new method, perhaps?
Description
ruff version: 0.9.7
command:
ruff check test.py --select RUF --previewI am not sure if it's intended, but ruff check RUF045 for assigning a method of dataclass.
Is there a more appropriate way for typing new method, perhaps?