MCPcopy Index your code
hub / github.com/python/cpython / walktree

Function walktree

Lib/inspect.py:1189–1197  ·  view source on GitHub ↗

Recursive helper function for getclasstree().

(classes, children, parent)

Source from the content-addressed store, hash-verified

1187
1188# --------------------------------------------------- class tree extraction
1189def walktree(classes, children, parent):
1190 """Recursive helper function for getclasstree()."""
1191 results = []
1192 classes.sort(key=attrgetter('__module__', '__name__'))
1193 for c in classes:
1194 results.append((c, c.__bases__))
1195 if c in children:
1196 results.append(walktree(children[c], children, c))
1197 return results
1198
1199def getclasstree(classes, unique=False):
1200 """Arrange the given list of classes into a hierarchy of nested lists.

Callers 1

getclasstreeFunction · 0.85

Calls 3

attrgetterClass · 0.90
sortMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…