def get_members(obj: Any) -> List[Node]: sourcefiles = get_sourcefiles(obj) members = [] for name, obj in inspect.getmembers(obj): sourcefile_index = is_member(obj, name, sourcefiles) if sourcefile_index != -1 and not from_object(obj): member = get_node(obj, sourcefile_index) if member.docstring: members.append(member) return sorted(members, key=lambda x: (-x.sourcefile_index, x.lineno))
def get_members(obj: Any) -> List[Node]: if isinstance(obj, property): return [] recursive = not inspect.ismodule(obj) sourcefiles = get_sourcefiles(obj) members = [] for name, obj in inspect.getmembers(obj): sourcefile_index = is_member(name, obj, sourcefiles) if sourcefile_index != -1 and not from_object(obj): member = get_node(obj, recursive, sourcefile_index) if member.docstring: members.append(member) return sorted(members, key=lambda x: (-x.sourcefile_index, x.lineno))
def test_get_sourcefiles(): files = get_sourcefiles(C) assert len(files) == 1