Skip to content

Commit

Permalink
Tmp
Browse files Browse the repository at this point in the history
  • Loading branch information
sveinugu committed Oct 8, 2023
1 parent 22acdab commit bb98e06
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 20 deletions.
25 changes: 13 additions & 12 deletions docs/templates/pdocs/class.mako
Original file line number Diff line number Diff line change
Expand Up @@ -68,19 +68,20 @@ ${cls.docstring}
mro = cls.mro()
subclasses = cls.subclasses()
%>
% if mro:
${h4('Ancestors (in MRO)')}
% for c in mro:
* ${c.refname}
% endfor
% endif
% if subclasses:
${h4('Descendants')}
% for c in subclasses:
* ${c.refname}
% endfor
% endif
## % if mro:
## ${h4('Ancestors (in MRO)')}
## % for c in mro:
## * ${c.refname}
## % endfor
## % endif
## % if subclasses:
## ${h4('Descendants')}
## % for c in subclasses:
## * ${c.refname}
## % endfor
## % endif
% if class_vars_internal:
${h4('Class variables')}
Expand Down
20 changes: 12 additions & 8 deletions src/omnipy/util/mako_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,21 @@ def filter_external(members: List[Doc]):


def filter_internal(members: List[Doc]):
return list(_ for _ in members if not externally_inherited(_))
ret = {_.name: externally_inherited(_) for _ in members}

ret = list(_ for _ in members if not externally_inherited(_))
return ret


def externally_inherited(member: Doc):
if hasattr(member, 'inherits'):
if externally_inherited(member.inherits):
return True
elif not member.inherits.cls.module.name.startswith('omnipy'):
print(member.inherits.cls.module.name)
return True
return member.name not in vars(member.cls.cls)
inherited = member.name not in vars(member.cls.cls)
if hasattr(member.cls.cls, member.name):
member_obj = getattr(member.cls.cls, member.name)
internal = hasattr(member_obj, '__module__') and member_obj.__module__.startswith('omnipy')
else:
internal = False

return inherited and not internal


def merge_signature_with_docstring(func: Function,
Expand Down

0 comments on commit bb98e06

Please sign in to comment.