diff --git a/src/griffe/dataclasses.py b/src/griffe/dataclasses.py index 42ef0dfa..2c76e600 100644 --- a/src/griffe/dataclasses.py +++ b/src/griffe/dataclasses.py @@ -192,6 +192,9 @@ def __str__(self) -> str: return f"[{self.kind.value}] {param}" return param + def __repr__(self) -> str: + return f"Parameter(name={self.name!r}, annotation={self.annotation!r}, kind={self.kind!r}, default={self.default!r})" + @property def required(self) -> bool: """Whether this parameter is required.""" @@ -237,6 +240,9 @@ def __init__(self, *parameters: Parameter) -> None: for parameter in parameters: self.add(parameter) + def __repr__(self) -> str: + return f"Parameters({', '.join(repr(param) for param in self._parameters_list)})" + def __getitem__(self, name_or_index: int | str) -> Parameter: if isinstance(name_or_index, int): return self._parameters_list[name_or_index]