-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Open
Labels
previewRelated to preview mode featuresRelated to preview mode featuresquestionAsking for support or clarificationAsking for support or clarificationruleImplementing or modifying a lint ruleImplementing or modifying a lint rule
Description
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?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
previewRelated to preview mode featuresRelated to preview mode featuresquestionAsking for support or clarificationAsking for support or clarificationruleImplementing or modifying a lint ruleImplementing or modifying a lint rule