diff --git a/src/_griffe/agents/visitor.py b/src/_griffe/agents/visitor.py index 8cc6aae3..8f57ed9d 100644 --- a/src/_griffe/agents/visitor.py +++ b/src/_griffe/agents/visitor.py @@ -423,7 +423,7 @@ def handle_function(self, node: ast.AsyncFunctionDef | ast.FunctionDef, labels: if overload: self.current.overloads[function.name].append(function) elif property_function: - base_property: Function = self.current.members[node.name] # type: ignore[assignment] + base_property: Attribute = self.current.members[node.name] # type: ignore[assignment] if property_function == "setter": base_property.setter = function base_property.labels.add("writable") diff --git a/src/_griffe/models.py b/src/_griffe/models.py index 364f183b..0d124822 100644 --- a/src/_griffe/models.py +++ b/src/_griffe/models.py @@ -1741,12 +1741,13 @@ def __init__( """The function return type annotation.""" self.decorators: list[Decorator] = decorators or [] """The function decorators.""" - self.setter: Function | None = None - """The setter linked to this function (property).""" - self.deleter: Function | None = None - """The deleter linked to this function (property).""" self.overloads: list[Function] | None = None """The overloaded signatures of this function.""" + # YORE: Bump 1: Remove block. + self.setter: Function | None = None + """Deprecated. See [Attribute.setter][griffe.Attribute.setter].""" + self.deleter: Function | None = None + """Deprecated. See [Attribute.deleter][griffe.Attribute.deleter].""" for parameter in self.parameters: parameter.function = self @@ -1797,6 +1798,10 @@ def __init__( """The attribute value.""" self.annotation: str | Expr | None = annotation """The attribute type annotation.""" + self.setter: Function | None = None + """The setter linked to this property.""" + self.deleter: Function | None = None + """The deleter linked to this property.""" def as_dict(self, **kwargs: Any) -> dict[str, Any]: """Return this function's data as a dictionary.