-
-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Inherited members showing up inappropriately #102
Comments
I find that still leaves some broken cross references for some class methods that come from another library. If I go into griffe and modify @cached_property
def members(self) -> dict[str, Object | Alias]: # noqa: D102
final_target = self.final_target
return {name: Alias(name, target=member, parent=self, inherited=final_target.inherited) for name, member in final_target.members.items()} That takes care of the remaining problem (as far as I can tell). I assume there is a good reason that Alias does not just delegate the |
There is not! Perfect catch! That's my fault, I didn't think of reapplying the property. Is this fix enough or is the hack in |
It's more like this but you did find the right place: @cached_property
def members(self) -> dict[str, Object | Alias]: # noqa: D102
final_target = self.final_target
return {
name: Alias(name, target=member, parent=self, inherited=False)
for name, member in final_target.members.items()
}
@cached_property
def inherited_members(self) -> dict[str, Alias]: # noqa: D102
final_target = self.final_target
return {
name: Alias(name, target=member, parent=self, inherited=True)
for name, member in final_target.inherited_members.items()
} |
Fix released in v0.35.1. |
This fix seems to do the trick. |
Using mkdocstrings-python 1.5.2 w/ griffe 0.35, we noticed that suddenly inherited members
started showing up in our API docs although we did not ask for them. They show up even
when explicitly turned off.
Our code is internal, so I cannot share it, but I did some poking into
do_filter_objects
and found that the offending members are aliases whose target is inherited. This hack
in
do_filter_objects
appears to mimic the old behavior:Hope that is enough to go on....
The text was updated successfully, but these errors were encountered: