Skip to content

Commit

Permalink
feat: Get class parameters from parent's __init__ method
Browse files Browse the repository at this point in the history
Issue #205: #205
  • Loading branch information
pawamoy committed Sep 1, 2023
1 parent 1c4340b commit e8a9fdc
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/griffe/dataclasses.py
Original file line number Diff line number Diff line change
Expand Up @@ -1333,11 +1333,15 @@ def __init__(
def parameters(self) -> Parameters:
"""Return the parameters of this class' `__init__` method, if any.
This property fetches inherited members,
and therefore is part of the consumer API:
do not use when producing Griffe trees!
Returns:
The parameters containter.
The parameters container.
"""
try:
return self.members["__init__"].parameters # type: ignore[union-attr]
return self.all_members["__init__"].parameters # type: ignore[union-attr]
except KeyError:
if "dataclass" in self.labels:
return Parameters(
Expand Down

0 comments on commit e8a9fdc

Please sign in to comment.