示例#1
0
 def _make_tree(root: str) -> Node:
     path = root[:-1]
     doc = DOCS.get(path)
     return Node(
         path=path,
         title=doc.title if doc else root,
         children=sorted(
             (_make_tree(child) for child in {
                 root + doc.name[len(root):].split('/', 1)[0] + '/'
                 for doc in DOCS.values() if doc.name.startswith(root)
                 and not exclude.match(doc.name)
             }),
             key=attrgetter('title'),
         ),
     )
示例#2
0
文件: docs.py 项目: n-patel/ocfweb
 def _make_tree(root):
     path = root[:-1]
     doc = DOCS.get(path)
     return Node(
         path=path,
         title=doc.title if doc else root,
         children=sorted(
             [
                 _make_tree(child)
                 for child in
                 {
                     root + doc.name[len(root):].split('/', 1)[0] + '/'
                     for doc in DOCS.values()
                     if doc.name.startswith(root) and not exclude.match(doc.name)
                 }
             ],
             key=attrgetter('path'),
         ),
     )