Skip to content

Commit

Permalink
refactor: Get annotation with the same property on functions
Browse files Browse the repository at this point in the history
  • Loading branch information
pawamoy committed Feb 12, 2022
1 parent e225d26 commit ecc7bba
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/griffe/dataclasses.py
Original file line number Diff line number Diff line change
Expand Up @@ -1095,6 +1095,15 @@ def __init__(
self.returns: str | Name | Expression | None = returns
self.decorators: list[Decorator] = decorators or []

@property
def annotation(self) -> str | Name | Expression | None:
"""Return the return annotation.
Returns:
The function return annotation.
"""
return self.returns

def as_dict(self, **kwargs: Any) -> dict[str, Any]: # type: ignore[override]
"""Return this function's data as a dictionary.
Expand Down

0 comments on commit ecc7bba

Please sign in to comment.