Online Treelib Compiler

Online Treelib Compiler and Playground.

Python
from treelib import Node, Tree
from treelib.exceptions import DuplicatedNodeIdError
from collections.abc import Sized as root

tree = Tree()

def add_to_tree(node, parent=None):
    tree.create_node(node.__name__, id(node), parent=parent)
    subclasses = node.__subclasses__()
    for sc in subclasses:
        try:
            add_to_tree(sc, parent=id(node))
        except DuplicatedNodeIdError:
            pass

add_to_tree(root)
tree.show()
Sized
├── Collection
│   ├── Mapping
│   │   ├── LazyDict
│   │   ├── MutableMapping
│   │   │   ├── ChainMap
│   │   │   ├── PickleShareDB
│   │   │   ├── SignalDict
│   │   │   ├── UserDict
│   │   │   ├── WeakKeyDictionary
│   │   │   ├── WeakValueDictionary
│   │   │   └── _Environ
│   │   ├── UsedNamesMapping
│   │   └── _SelectorMapping
│   ├── Sequence
│   │   ├── ByteString
│   │   ├── MutableSequence
│   │   │   └── UserList
│   │   ├── UserString
│   │   └── _PathParents
│   ├── Set
│   │   ├── ItemsView
│   │   │   └── _OrderedDictItemsView
│   │   ├── KeysView
│   │   │   └── _OrderedDictKeysView
│   │   └── MutableSet
│   └── ValuesView
│       └── _OrderedDictValuesView
└── MappingView